[MacRuby] #1042: BigMath::log and BigMath:exp are broken

MacRuby ruby-noreply at macosforge.org
Tue Dec 14 20:27:38 PST 2010


#1042: BigMath::log and BigMath:exp are broken
-------------------------------------+--------------------------------------
 Reporter:  hghoehne@…               |       Owner:  lsansonetti@…        
     Type:  defect                   |      Status:  new                  
 Priority:  blocker                  |   Milestone:                       
Component:  MacRuby                  |    Keywords:                       
-------------------------------------+--------------------------------------

Comment(by watson1978@…):

 as follow changing, It seems that MacRuby returns same result when change
 a SIZEOF_BDIGITS.

 Will it be a problem of the calculation precision?
 I cannot yet understand a problem definitely.

 {{{
 #!diff
 diff --git a/include/ruby/defines.h b/include/ruby/defines.h
 index c5b144b..b88820e 100644
 --- a/include/ruby/defines.h
 +++ b/include/ruby/defines.h
 @@ -83,7 +83,7 @@ void xfree(void*);

  #if defined(__LP64__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
  # define BDIGIT uint64_t
 -# define SIZEOF_BDIGITS 8
 +# define SIZEOF_BDIGITS 4
  # define BDIGIT_DBL __uint128_t
  # define BDIGIT_DBL_SIGNED __int128_t
  #elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG
 }}}

 {{{
 $ macruby -ve 'require "bigdecimal/math"; include BigMath; p
 exp(log(BigDecimal("20.0"), 200), 200).to_f'
 MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64]
 20.0
 }}}

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



More information about the macruby-tickets mailing list