[MacRuby-devel] [MacRuby] #584: BigMath.sqrt always returns NaN

MacRuby ruby-noreply at macosforge.org
Wed Feb 3 05:05:12 PST 2010


#584: BigMath.sqrt always returns NaN
-------------------------------------+--------------------------------------
 Reporter:  hghoehne@…               |       Owner:  lsansonetti@…        
     Type:  defect                   |      Status:  new                  
 Priority:  major                    |   Milestone:  MacRuby 0.5          
Component:  MacRuby                  |    Keywords:                       
-------------------------------------+--------------------------------------

Comment(by hghoehne@…):

 Replying to [comment:2 maxime.curioni@…]:

 The "correct" way to check for sqrt in 1.87, 1.92 and macruby is
 {{{
 BigDecimal.method_defined? :sqrt
 }}}
 which returns true in ruby 1.87, ruby 1.92 and macruby.

 In 1.87 and macruby you can call
 {{{
 result = BigDecimal.sqrt(..,..)
 }}}
 That doesn't work in 1.92. Here you call
 {{{
 result = BigMath.sqrt(..,..)
 }}}
 which also works in 1.87 and macruby. But
 {{{
 BigMath.method_defined? :sqrt
 }}}
 will return false in ruby 1.92, but true in 1.87 and macruby.

 {{{
 include BigMath
 result = sqrt(..,..)
 }}}
 is working in all versions. This small changes are definitely confusing
 and probably a bug in ruby 1.92.

 But BigMath.sqrt is defined in macruby: calling sqrt doesn't raise a
 NoMethodError, but returns NaN for any BigDecimal object.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/584#comment:3>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list