Project

General

Profile

Actions

Bug #8717

closed

Negation of a rational/imaginary number literal isn't working

Added by takuto_h (Takuto Hayashi) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-08-02 trunk 42320) [x86_64-linux]
[ruby-core:56316]

Description

Hello.
I've found that negation of a rational/imaginary number literal isn't working.

irb(main):001:0> RUBY_DESCRIPTION
=> "ruby 2.1.0dev (2013-08-02 trunk 42320) [x86_64-linux]"
irb(main):002:0> -3r
=> (3/1)
irb(main):003:0> -2i
=> (0+2i)
irb(main):004:0> 

The attached file is a patch to fix this bug.
Thanks.


Files

negate_ratio_lit.patch (851 Bytes) negate_ratio_lit.patch Bug fix for the negation of a rational/imaginary number literal takuto_h (Takuto Hayashi), 08/02/2013 10:03 AM
Actions #1

Updated by Anonymous over 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42323.
Takuto, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • parse.y (negate_lit): add T_RATIONAL and T_COMPLEX to the switch
    statement, and call rb_bug() if an unknown type is passed to
    negate_lit(). [ruby-core:56316] [Bug #8717]

  • bootstraptest/test_literal_suffix.rb (assert_equal): add test

Actions

Also available in: Atom PDF

Like0
Like0