mailing list of musl libc
 help / color / mirror / code / Atom feed
* Possible Mistype in exp.c
@ 2019-01-28  6:59 Damian McGuckin
  2019-01-29 11:01 ` Szabolcs Nagy
  0 siblings, 1 reply; 18+ messages in thread
From: Damian McGuckin @ 2019-01-28  6:59 UTC (permalink / raw)
  To: musl


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.

I believe that for doubles, this needs to be

 	0x1p-1074

for doubles, i.e. 0x1p-1022 * 0x1p-52 if you want a conceptual match.

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-04-03  1:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28  6:59 Possible Mistype in exp.c Damian McGuckin
2019-01-29 11:01 ` Szabolcs Nagy
2019-01-29 11:26   ` Damian McGuckin
2019-01-29 11:43     ` Szabolcs Nagy
2019-01-30  1:18       ` Damian McGuckin
2019-01-30  9:37         ` Szabolcs Nagy
2019-01-30 11:14           ` Damian McGuckin
2019-01-30 12:19             ` Szabolcs Nagy
2019-01-30 12:44               ` Alexander Monakov
2019-01-30 14:10                 ` Szabolcs Nagy
2019-02-01 23:26                   ` Morten Welinder
2019-02-02  3:39                     ` Szabolcs Nagy
2019-02-03  2:05                       ` Morten Welinder
2019-02-03  3:07                         ` Damian McGuckin
2019-04-03  1:13                       ` Floating Point Accuracy Damian McGuckin
2019-01-30 12:56           ` Possible Mistype in exp.c Damian McGuckin
2019-01-31  0:04             ` Szabolcs Nagy
2019-01-31  0:39               ` Damian McGuckin

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).