[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Must "attempt to get length of a number value" be an error?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sat, 11 May 2019 11:27:19 -0300
> > [...] . Functions with
> > the annotation "integer/float" give integer results for integer
> > arguments and float results for float (or mixed) arguments.
> > [...]
> > math.abs(x)
> > Returns the absolute valud of x. (integer/float)
>
> According to Lua manual, math.abs() must return the absolute value of its
> argument.
> Obviously, math.abs(math.mininteger) not equals to the absolute value.
> That's a bug.
>
> "bug" means that behavior does not match documentation.
> Either behavior should be changed (to return correct result)
> or documentation should be changed (to claim math.abs as returning result
> modulo 2^64 instead of the correct result)
The manual has incompatible requirements. As it is clear in your
message, the manual requires that 'math.abs(math.mininteger)' returns
an integer. So, returning a float would fix a bug to create another
(behavior *still* does not match documentation). So, one solution is
to change the documentation; the other is to change the behavior *and*
the documentation.
-- Roberto
- References:
- Re: Must "attempt to get length of a number value" be an error?, Coda Highland
- Re: Must "attempt to get length of a number value" be an error?, Philippe Verdy
- Re: Must "attempt to get length of a number value" be an error?, Coda Highland
- Re: Must "attempt to get length of a number value" be an error?, Dirk Laurie
- Re: Must "attempt to get length of a number value" be an error?, Egor Skriptunoff
- Re: Must "attempt to get length of a number value" be an error?, Egor Skriptunoff
- Re: Must "attempt to get length of a number value" be an error?, Sean Conner
- Re: Must "attempt to get length of a number value" be an error?, Egor Skriptunoff
- Re: Must "attempt to get length of a number value" be an error?, Sean Conner
- Re: Must "attempt to get length of a number value" be an error?, Egor Skriptunoff