[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.3: 1 Month of use
- From: Coda Highland <chighland@...>
- Date: Tue, 4 Mar 2014 09:23:14 -0800
On Tue, Mar 4, 2014 at 9:17 AM, Roberto Ierusalimschy
> Maybe a new function to "normalize" a number (make it an integer if
> it has an integer value) would be a useful adddition...
Please don't. :( There's no good way to do this. A
round-to-nearest-integer function should be sufficient for when people
have a float that needs to turn into an integer (where //1's flooring
behavior would be destructive on something like (1.0/3.0) * 3.0) but
trying to claim that a function is smart about knowing when a float is
actually an integer... not a good idea. MATLAB tries and gets subtle
errors as a result.