From: Gary Wright Date: 2012-01-25T09:40:43+09:00 Subject: Re: Microrant on Ruy's Math Skills On Jan 24, 2012, at 9:01 AM, Peter Vandenabeele wrote: > Ha, just discovering the 'to_d' function in 'bigdecimal/util' > 1.9.3p0 :005 > a/b == 7.89.to_d > => true > 1.9.3p0 :006 > 1.234567890123.to_d Be careful with these last two. The Float => BigDecimal conversion that is happening with to_d is doing some rounding: ("%.60f" % 7.89) #=> "7.889999999999999680255768907954916357994079589843750000000000" ("%.60f" % 7.89).to_d == "7.89".to_d #=> false Gary Wright