[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.3 work1 Considering math.isinteger or type()
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 24 Jul 2013 20:48:53 -0300
> Out of curiosity… as the 46 (and counting) messages in this thread haven't made it very clear, at least to me… why do we even care if a number is an integer, float, real, double, whatnot? Isn't the purpose of that int vs. float dichotomy to be purely an implementation detail? Wholly transparent? And a number stays a number? Irrespectively of internal representation? Or?
The difference between integers and floats should not bother most
programmers, but it is not transparent (e.g., you can distinguish them
using a clever piece of code). It is not totally unlike +0.0 versus
-0.0, which are equal all the time except when they are not.
(Actually, the only use I see for this functionality is when linearizing
data, so that we can save an integer as an integer and a float as a
float. I do not know of any other real use.)
The fact that most people should not bother with this difference was
the initial motivation to put the distinction in the debug library.
-- Roberto