[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why do some math functions return -0
- From: David Kastrup <dak@...>
- Date: Mon, 20 Sep 2010 14:36:21 +0200
Tony Finch <dot@dotat.at> writes:
> On Mon, 20 Sep 2010, David Kastrup wrote:
>> Tony Finch <dot@dotat.at> writes:
>> > On 20 Sep 2010, at 09:18, David Kastrup <dak@gnu.org> wrote:
>> > > Tony Finch <dot@dotat.at> writes:
>> > > >
>> > > > It can happen if the rounding mode is towards negative
>> > > > infinity.
>> > >
>> > > Please point out the line in question where this would apply.
>> >
>> > There are lots of subtractions in the code.
>>
>> Hogwash.
>
> Have a look at the Lua reference manual:
>
> Modulo is defined as
>
> a % b == a - math.floor(a/b)*b
>
> That is, it is the remainder of a division that rounds the
> quotient towards minus infinity.
"Defined as" is not the same as "implemented as". In particular, there
is no guarantee of bug compatibility.
--
David Kastrup
- References:
- Why do some math functions return -0, Mike McGonagle
- Re: Why do some math functions return -0, Drake Wilson
- Re: Why do some math functions return -0, Mike McGonagle
- Re: Why do some math functions return -0, caseyh
- Re: Why do some math functions return -0, David Kastrup
- Re: Why do some math functions return -0, HyperHacker
- Re: Why do some math functions return -0, KHMan
- Re: Why do some math functions return -0, HyperHacker
- Re: Why do some math functions return -0, David Kastrup
- Re: Why do some math functions return -0, Tony Finch
- Re: Why do some math functions return -0, David Kastrup
- Re: Why do some math functions return -0, Tony Finch
- Re: Why do some math functions return -0, David Kastrup
- Re: Why do some math functions return -0, Tony Finch