Tadashi Saito
6/16/2006 3:24:00 AM
Hi all,
On 9 Jun 2006 02:15:22 -0700
djreid@ihug.co.nz wrote:
> all this I understand BUT
>
> >> 4.1 % 2
> => 0.0999999999999996
>
> Should be .1
Yes, I think so, too. The shortest solution is:
>> require "bigdecimal"
=> true
>> BigDecimal("4.1") % 2
=> #<BigDecimal:125e8,'0.1E0',4(16)>
>> BigDecimal("4.1") % 2 == BigDecimal("0.1")
=> true
--
Tadashi Saito