From: Hugh Sasse Date: 2006-11-09T03:18:48+09:00 Subject: Re: Simple Math Problem On Thu, 9 Nov 2006, Tim Pease wrote: > On 11/8/06, Hugh Sasse wrote: > > irb(main):002:0> v2 = 0.12 * 667 > > => 80.04 [...] > > irb(main):004:0> puts "%.20f" % v2 > > 80.03999999999999204192 [...] > > With IEEE 754 floating point values you only have 15 digits of I just picked a large value. This seemed the clearest way to show what was going on, from my viewpoint. > precision (8 byte doubles). Ara's little example above demonstrates > that very nicely. Things go pear shaped in the 17th digit with the > "exact" value 80.04 (v1). > [other good points trimmed] Hugh