From: Steve Wilhelm Date: 2009-11-29T16:27:52+09:00 Subject: Re: Just found a round problem Florian Gilcher wrote: > On Nov 29, 2009, at 12:06 AM, Ruby Newbee wrote: > >> irb(main):026:0> 10.499999999999999.round >> => 10 >> irb(main):027:0> 10.4999999999999999.round >> => 11 >> >> >> Does this happen due to the float problem in any languages including >> ruby? >> Thanks. > > > Thats IEEE 754 float behaviour, yes. python behaves exactly the same. > > - -- > Florian Gilcher > And PHP 5 as well. php -r 'echo sprintf ("PHP Version = %s\nround(10.499999999999999) = %d\nround(10.4999999999999999) = %d\n", phpversion(), round(10.499999999999999), round(10.4999999999999999));' PHP Version = 5.2.6 round(10.499999999999999) = 10 round(10.4999999999999999) = 11 -- Posted via http://www.ruby-forum.com/.