From: Eric Hodel Date: 2007-10-14T17:03:25+09:00 Subject: Re: Bug: Numeric#divmod calculates wrongly On Oct 14, 2007, at 24:18 , Dirk Traulsen wrote: > I tested Numeric#divmod on two more systems: SUSE 10.1 and Kubuntu > 6.10. > They both run Ruby 1.8.4 and under both systems Numeric#divmod works > correctly! > So this bug was either introduced between Ruby 1.8.4 and 1.8.6 or > it is > a problem depending on the OS. > > Could somebody please confirm these findings? Especially with other > System and Ruby version combinations this would be really helpful to > nail down this massive bug. A computer should really calculate > correctly... You may want to bring this up on ruby-core (maybe you have? There was also a documentation patch for divmod, so I may be confused). I get the same results for 1.8.6 and 1.9.0: ruby 1.8.6 (2007-09-23) [powerpc-darwin8.10.0] ruby 1.9.0 (2007-10-13) [powerpc-darwin8.10.0] x=[0.58, 0.59, 0.63, 0.66, 0.67] y=1/12.0 x/y --- 6.96 7.08 7.56 7.92 8.04 x.divmod(y) ----------- [6, 0.08] [6, 0.00666666666666667] [6, 0.0466666666666667] [6, 0.0766666666666667] [8, 0.00333333333333341] -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars