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

MacRuby ruby-noreply at macosforge.org
Fri Jun 4 12:01:11 PDT 2010


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

  * milestone:  MacRuby 0.5 =>


Old description:

> require "bigdecimal"
> require "bigdecimal/math"
> four = BigDecimal("4")
> puts BigMath.sqrt(four, 10)
> NaN

New description:

 {{{
 #!ruby
 require "bigdecimal"
 require "bigdecimal/math"
 four = BigDecimal("4")
 puts BigMath.sqrt(four, 10) #=> NaN
 }}}

--

Comment:

 I commited an updated version of bigdecimal/math with r4202, but for some
 reason,  get NaN when I include both `bigdecimal` and `bigdecimal/math`,
 but not if I include any of them:
 {{{
 $> macruby -r bigdecimal/math -e 'p BigDecimal.new("2").sqrt(10)'
 #<BigDecimal:2000f15a0,'0.1414213562 3730950488 016887185E1',32(32)>
 $> macruby -r bigdecimal -e 'p BigDecimal.new("2").sqrt(10)'
 #<BigDecimal:2000e0aa0,'0.1414213562 3730950488 016887185E1',32(32)>
 $> macruby -r bigdecimal -r bigdecimal/math -e 'p
 BigDecimal.new("2").sqrt(10)'
 #<BigDecimal:2000d0660,'NaN',4(32)>
 }}}

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



More information about the MacRuby-devel mailing list