diff options
author | Timo Teräs <timo.teras@iki.fi> | 2016-03-08 13:27:16 +0000 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2016-03-08 13:28:32 +0000 |
commit | 05ce1370975a5a4585f4f5da9e05d97c489ed2ab (patch) | |
tree | 61a8eaf4da541e91e6fb7cf3f3405f46afeb8426 /main/musl/0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch | |
parent | ff6077a1aadbd77723d97a5dc1f83b7d76e6818c (diff) | |
download | aports-05ce1370975a5a4585f4f5da9e05d97c489ed2ab.tar.bz2 aports-05ce1370975a5a4585f4f5da9e05d97c489ed2ab.tar.xz |
main/musl: cherry-pick fixes, remove ucontext.h
Diffstat (limited to 'main/musl/0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch')
-rw-r--r-- | main/musl/0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/main/musl/0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch b/main/musl/0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch new file mode 100644 index 0000000000..e9eadc9718 --- /dev/null +++ b/main/musl/0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch @@ -0,0 +1,43 @@ +From b023c03b574acdfd73418314a5dcaa83e5cea5a0 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy <nsz@port70.net> +Date: Fri, 4 Mar 2016 21:23:33 +0000 +Subject: [PATCH] math: fix expf(-NAN) and exp2f(-NAN) to return -NAN instead + of 0 + +expf(-NAN) was treated as expf(-large) which unconditionally +returns +0, so special case +-NAN. +reported by Petr Hosek. +--- + src/math/exp2f.c | 2 ++ + src/math/expf.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/src/math/exp2f.c b/src/math/exp2f.c +index cf6126e..296b634 100644 +--- a/src/math/exp2f.c ++++ b/src/math/exp2f.c +@@ -91,6 +91,8 @@ float exp2f(float x) + /* Filter out exceptional cases. */ + ix = u.i & 0x7fffffff; + if (ix > 0x42fc0000) { /* |x| > 126 */ ++ if (ix > 0x7f800000) /* NaN */ ++ return x; + if (u.i >= 0x43000000 && u.i < 0x80000000) { /* x >= 128 */ + x *= 0x1p127f; + return x; +diff --git a/src/math/expf.c b/src/math/expf.c +index 16e9afe..feee2b0 100644 +--- a/src/math/expf.c ++++ b/src/math/expf.c +@@ -39,6 +39,8 @@ float expf(float x) + + /* special cases */ + if (hx >= 0x42aeac50) { /* if |x| >= -87.33655f or NaN */ ++ if (hx > 0x7f800000) /* NaN */ ++ return x; + if (hx >= 0x42b17218 && !sign) { /* x >= 88.722839f */ + /* overflow */ + x *= 0x1p127f; +-- +2.7.2 + |