[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: math.min, math.max
- From: Andrew Starks <andrew.starks@...>
- Date: Wed, 9 Apr 2014 08:56:36 -0700
On Wednesday, April 9, 2014, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> Dirk Laurie <dirk.laurie@gmail.com> wrote:
> > 1. If the argument list always has a first element, there is no reason to
> > stay with numbers. Anything for which less-than is defined can work.
>
> This could be useful! Actually, if you asked me if this was already
> the behavior, I wouldn't know it for sure.
This is how it is implemented now (for the next work version). The
main motivation is for working correctly with integers, too:
> math.max(4611686018427387901, 461168601842738790) --> 4611686018427387901
The original version would lose precision in that case.
-- Roberto
In the case that this feed back is helpful:
I would continue to patch math max and min to accept (nil) as valid and to have it return nil in that case.
If huge or -(huge) were the result of (nil), I probably would not patch it and instead change the logic in my code to use the new result, but it doesn't sound like this would be correct.
- References:
- math.min, math.max, Dirk Laurie
- Re: math.min, math.max, Oliver Kroth
- Re: math.min, math.max, Dirk Laurie
- Re: math.min, math.max, Hisham
- Re: math.min, math.max, Roberto Ierusalimschy