From: "trans. (T. Onoma)" Date: 2004-10-16T02:27:51+09:00 Subject: Re: Rounding to X digits On Friday 15 October 2004 12:02 pm, Markus wrote: | Peeling one layer of the onion, they differ because: | | irb(main):033:0> printf "%20.15f",(134.45 * (1.0/0.1)) | 1344.500000000000000=> nil | irb(main):034:0> printf "%20.15f",(134.45/0.1) | 1344.499999999999773=> nil That isn't too... er... reassuring. | I suppose this is not unexpected (my mama warned me 'bout floats) but it | is a little unexpected--no, I'm wrong, 1/5 is a repeating decimal base | 2, so it's perfectly expected. Expected, really? I'm not all that familiar with floating point standards, but I would have though this kind of thing would have been worked out long ago. It's a pretty substantiate miscalculation. --And the fact that simply using '*(1.0/0.1)' fixes it, makes me think so even more. T.