Project

General

Profile

Bug #8717

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

Added by Takuto Hayashi almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
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.

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

Associated revisions

Revision 42323
Added by Charlie Somerville almost 3 years ago

  • 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(). [Bug #8717]

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

Revision 42323
Added by Charlie Somerville almost 3 years ago

  • 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(). [Bug #8717]

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

Revision 42323
Added by Charlie Somerville almost 3 years ago

  • 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(). [Bug #8717]

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

History

#1 Updated by Charlie Somerville almost 3 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(). [Bug #8717]

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

Also available in: Atom PDF