From: Tom Rauchenwald Date: 2006-07-10T09:17:40+09:00 Subject: Re: [QUIZ] Panagrams (#86) "Tim Hollingsworth" writes: > Hello > > First post here, by the way. Greetings to all:) New to ruby, love it, slaps > on backs all round. > > While I haven't solved the pangram problem, I did find what appears to be a > bug in Numeric.divmod on large numbers, as can be seen when using > Bignum.modulo: > > irb(main):017:0> 1e22 % 1e21 > => 0.0 > irb(main):018:0> 1e23 % 1e22 > => 9.99999999999999e+021 > > whoops! Not quite. 1e23 is a float, that's why you run into precision problems. This has been discussed here not long ago. If you use Bignums it works as expected: ,---- | irb(main):001:0> 1e23.class | => Float | irb(main):002:0> (10**23).class | => Bignum | irb(main):003:0> 10**23 % 10**22 | => 0 `---- Tom