lua-users home
lua-l archive

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


Pick a rounding behaviour. math.tointeger only converts to integer if x
% 1.0 == 0.0.

   Floating Point Demystified, Part 1
   http://blog.reverberate.org/2014/09/what-every-computer-programmer-should.html

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.