summaryrefslogtreecommitdiffstats
path: root/lib/msun/src
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2008-01-18 22:19:04 +0000
committerdas <das@FreeBSD.org>2008-01-18 22:19:04 +0000
commit6cc44c600b906a61a18878b032c4380eea2814ec (patch)
treeaa3851c02f4fdecc3c96f6a16c93c2d4f4a2d82b /lib/msun/src
parent8a38a2ddf2dcdd33ce3459224eb04b8a66814202 (diff)
downloadFreeBSD-src-6cc44c600b906a61a18878b032c4380eea2814ec.zip
FreeBSD-src-6cc44c600b906a61a18878b032c4380eea2814ec.tar.gz
Use volatile hacks to make sure these functions generate an underflow
exception when they're supposed to. Previously, gcc -O2 was optimizing away the statement that generated it.
Diffstat (limited to 'lib/msun/src')
-rw-r--r--lib/msun/src/e_expf.c3
-rw-r--r--lib/msun/src/s_exp2.c3
-rw-r--r--lib/msun/src/s_exp2f.c3
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/msun/src/e_expf.c b/lib/msun/src/e_expf.c
index b9eb0fc..50b91da 100644
--- a/lib/msun/src/e_expf.c
+++ b/lib/msun/src/e_expf.c
@@ -24,7 +24,6 @@ static const float
one = 1.0,
halF[2] = {0.5,-0.5,},
huge = 1.0e+30,
-twom100 = 7.8886090522e-31, /* 2**-100=0x0d800000 */
o_threshold= 8.8721679688e+01, /* 0x42b17180 */
u_threshold= -1.0397208405e+02, /* 0xc2cff1b5 */
ln2HI[2] ={ 6.9314575195e-01, /* 0x3f317200 */
@@ -38,6 +37,8 @@ P3 = 6.6137559770e-05, /* 0x388ab355 */
P4 = -1.6533901999e-06, /* 0xb5ddea0e */
P5 = 4.1381369442e-08; /* 0x3331bb4c */
+static volatile float twom100 = 7.8886090522e-31; /* 2**-100=0x0d800000 */
+
float
__ieee754_expf(float x) /* default IEEE double exp */
{
diff --git a/lib/msun/src/s_exp2.c b/lib/msun/src/s_exp2.c
index 6593a50..464e39c 100644
--- a/lib/msun/src/s_exp2.c
+++ b/lib/msun/src/s_exp2.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
static const double
huge = 0x1p1000,
- twom1000 = 0x1p-1000,
redux = 0x1.8p52 / TBLSIZE,
P1 = 0x1.62e42fefa39efp-1,
P2 = 0x1.ebfbdff82c575p-3,
@@ -45,6 +44,8 @@ static const double
P4 = 0x1.3b2ab88f70400p-7,
P5 = 0x1.5d88003875c74p-10;
+static volatile double twom1000 = 0x1p-1000;
+
static const double tbl[TBLSIZE * 2] = {
/* exp2(z + eps) eps */
0x1.6a09e667f3d5dp-1, 0x1.9880p-44,
diff --git a/lib/msun/src/s_exp2f.c b/lib/msun/src/s_exp2f.c
index 1bc026a..0a6142f 100644
--- a/lib/msun/src/s_exp2f.c
+++ b/lib/msun/src/s_exp2f.c
@@ -35,13 +35,14 @@ __FBSDID("$FreeBSD$");
static const float
huge = 0x1p100f,
- twom100 = 0x1p-100f,
redux = 0x1.8p23f / TBLSIZE,
P1 = 0x1.62e430p-1f,
P2 = 0x1.ebfbe0p-3f,
P3 = 0x1.c6b348p-5f,
P4 = 0x1.3b2c9cp-7f;
+static volatile float twom100 = 0x1p-100f;
+
static const double exp2ft[TBLSIZE] = {
0x1.6a09e667f3bcdp-1,
0x1.7a11473eb0187p-1,
OpenPOWER on IntegriCloud