<noreply / rubyforge.org> writes:

> Summary: Weird rounding behavior..
>
> Initial Comment:
> irb(main):002:0> n=4
> => 4
> irb(main):003:0> a=(52.07825 * (10.0 ** n))
> => 520782.5
> irb(main):004:0> a.round
> => 520782

irb(main):003:0> "%.30f" % a
=> "520782.499999999941792339086532592773"

> Which is WRONG it should be 520783.
> Using an other number:
>
> irb(main):005:0> a=(52.07835 * (10.0 ** n))
> => 520783.5
> irb(main):006:0> a.round
> => 520784

irb(main):005:0> "%.30f" % a
=> "520783.500000000000000000000000000000"

> This is correct behavior.. really WEIRD isn't it?

Not at all.  Please learn how floating-point works.
-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org