2007/8/30, Charlie Lehardy <charlie.lehardy / gmail.com>:
> Modulo should be a fairly simple operation, however I'm finding some very
> odd results and am wondering what is going on... For instance:
>
> irb(main):001:0> 1 % 0.1
> => 0.1

Floats are not very well suited for modulo operations.  Btw, here's
why you probably see 0.1:

irb(main):001:0> (1 % 0.1) - 0.1
=> -5.55111512312578e-17

You should probably read up a bit on numeric issues with floating
point arithmetic.  See also other postings for explanations.

Kind regards

robert