[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.4.0 (work2) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sun, 26 Aug 2018 17:18:58 -0300
> On Sun, Aug 26, 2018 at 2:05 PM, Dirk Laurie wrote:
> > the correct value ... that Lua 5.3 returns.
> Indeed, fmod() is doing its job very well.
> IMO, fmod() does worth its performance price.
Going down all the way, the multiplication used in 5.3 to test
the sign of the result may underflow:
$ Lua 5.3.2 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> -2.1^-1000 % 2^-1000
The result should be non negative, in the range [0,2^-1000). It is
better to use explicit tests:
/* m is not zero and m and b have different signs */
if ((m) < 0 && ((m) < 0) != ((b) < 0)) (m) += (b);