[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: math.min, math.max
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 9 Apr 2014 12:27:22 +0200
2014-04-09 12:15 GMT+02:00 Oliver Kroth <oliver.kroth@nec-i.de>:
> Is this so?
>
> I would expect the minimum or maximum element of the argument list to be
> returned as result.
> With an empty list, I would not be confused to get nil.
It's the same principle by which when n<1,
1 + 2 + 3 + ... + n
evaluates to 0 and
1 * 2 * 3 * ... * n
evaluates to 1.
max satisfies relationships like: max(a,b,c,d) = max(max(a,b),max(c,d)),
no matter how you split up the arguments. For a consistent definition
of max(), you need max(a,b,c,d) = max(max(),max(a,b,c,d)). But the
only value of x for which always y = max(x,y) is x=-math.huge.
At present you don't get nil, you get an error.