[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Bug ? math.tointeger strange behavior
- From: Loïc Le Cunff <loic.lcf@...>
- Date: Mon, 9 May 2016 20:27:30 +0200
Pick a rounding behaviour. math.tointeger only converts to integer if x
% 1.0 == 0.0.
Floating Point Demystified, Part 1
Alright, it makes sense, thanks.
I just didn't expect the test to be that strict.
For instance, math.integer(600eX/5eX) returns 120 for X going from -5 to
20 (didn't test beyond that), and nil below -5.
PS: I shouldn't have subscribed to the digest mode, now I got no idea
how to reply properly, hopefully I don't break anything, sorry if I do =/
PPS: Lua is a great lib.