Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 29 Jan 2019 12:01:36 +0100
From: Szabolcs Nagy <>
Cc: Damian McGuckin <>
Subject: Re: Possible Mistype in exp.c

* Damian McGuckin <> [2019-01-28 17:59:53 +1100]:
> In 1.1.21 in exp.c
>        if (x < -708.39641853226410622) {
>             /* underflow if x!=-inf */
>             FORCE_EVAL((float)(-0x1p-149/x));
>             if (x < -745.13321910194110842)
> The constant also appears is expf.c.
> For floats and for floats, the constant
> 	0x1p-149
> is the smallest non-zero finite number and will do the right thing.
> Using that with doubles will not trigger an underflow exception.

it's not the division that's supposed to raise the exception,
but the cast (although the division might in case of an x with
sufficiently large magnitude).

> I believe that for doubles, this needs to be
> 	0x1p-1074

i don't remember the reson why i wrote the code the way it is,
probably i wanted to avoid subnormal range division as it can
be a lot slower than subnormal range cast (but this code will
be slow either way which is ok since it's a rare special case)
it can also save space on hw that can load float values into
double (powerpc?), but really this is just bikeshedding.

in any case i plan to completely rewrite exp and other
important math functions:

that implementation is >2x faster in general than the old
fdlibm code as well as more precise.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.