lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>	Could anyone tell me if this is supposed to happen?  It didn't look very good on my numerical analysis class. :-)

Are you taking a numerical analysis course?
Didn't they tell you that real numbers are represented in floating-point and
that most numbers are not *exactly* representable?
0.15 is not exactly representable in binary and so adding it several times
is not the same as adding a multiple of it.
Try 0.125 instead (0.125 *is* exactly representable in binary)
--lhf