From: Jamis Buck Date: 2004-10-28T03:25:40+09:00 Subject: Re: Rounding error, (100.0 * 9.95).to_i == 994 Dan Janowski wrote: > I can understand floating point errors, but this one seems too small for > that. > Especially given this: > > irb(main):023:0> v=100.0*9.95 > => 995 > irb(main):024:0> v.to_i > => 994 a = 100 * 9.95 "%.16f" % a => "994.9999999999998863" It's not a problem with Ruby, it's a problem with floating point numbers in general. :( - Jamis -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis