lua-users home
lua-l archive

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


2016-01-14 22:39 GMT+02:00 Tom N Harris <telliamed@whoopdedo.org>:
> While making sure that for any number N, N+1 > N makes sense to
> mathematicians that's not how the underlying representation works
> and ultimately Lua operates on number representations, not number
> theory.

Well, actually all that switching transparently from integer to float
would achieve is to make sure that for any number N, N+1 >= N,
and while that might sense to mathematicians (they're good at
redefining "makes sense") I can't see them thinking it's a useful
thing to achieve.

> Lua doesn't hide the imprecision of floats, nor do I think it should
> hide the overflow of integers.

I grew up in a time when integer overflow caused a program to
crash unless you had explicitly set a CPU flag that would make
it wrap around. Don't modern machines have such a flag, only
by default it is off? And if so, is the feature accessible from C?