From: Marc-Andre Lafortune Date: 2011-08-10T10:41:16+09:00 Subject: [ruby-core:38886] [Ruby 1.9 - Bug #5179][Open] Complex#rationalize and to_r with approximate zeros Issue #5179 has been reported by Marc-Andre Lafortune. ---------------------------------------- Bug #5179: Complex#rationalize and to_r with approximate zeros http://redmine.ruby-lang.org/issues/5179 Author: Marc-Andre Lafortune Status: Open Priority: Normal Assignee: Category: core Target version: ruby -v: r32354 Currently, Complex#rationalize and Complex#to_r raise a RangeError if the imaginary part is nonzero *or is a Float*. Note that a BigDecimal(0) is accepted, though: Complex(1, 0).to_r # => Rational(1,1) Complex(1, BigDecimal("0.0")).to_r # => Rational(1,1) Complex(1, 0.0).to_r # => RangeError This is inconsistent. I recommend not raising an error for 0.0 (Float or BigDecimal). Any objection? -- http://redmine.ruby-lang.org