[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Number type limitations
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 5 Apr 2016 08:02:39 -0300
> > =math.fmod(235.7, 0.05)
> 0.049999999999976
This is not a bug in Lua. It's a limitation of floating point arithmetic.
Neither 235.7 nor 0.05 have exact representation in floating point:
> print(string.format("%.20f",235.7))
235.69999999999998863132
> print(string.format("%.20f",0.05))
0.05000000000000000278
See for instance http://floating-point-gui.de .