summaryrefslogtreecommitdiff
path: root/libc/sysdeps/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/ieee754')
-rw-r--r--libc/sysdeps/ieee754/dbl-64/e_pow.c13
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c10
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c10
-rw-r--r--libc/sysdeps/ieee754/ldbl-96/printf_fphex.c3
4 files changed, 23 insertions, 13 deletions
diff --git a/libc/sysdeps/ieee754/dbl-64/e_pow.c b/libc/sysdeps/ieee754/dbl-64/e_pow.c
index 28435fd36..f668b4b5f 100644
--- a/libc/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/libc/sysdeps/ieee754/dbl-64/e_pow.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001, 2002, 2004, 2011 Free Software Foundation
+ * Copyright (C) 2001-2012 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -41,6 +41,7 @@
#include "MathLib.h"
#include "upow.tbl"
#include "math_private.h"
+#include <fenv.h>
#ifndef SECTION
# define SECTION
@@ -84,6 +85,11 @@ __ieee754_pow(double x, double y) {
(u.i[HIGH_HALF]==0 && u.i[LOW_HALF]!=0)) &&
/* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */
(v.i[HIGH_HALF]&0x7fffffff) < 0x4ff00000) { /* if y<-1 or y>1 */
+ fenv_t env;
+ double retval;
+
+ libc_feholdexcept_setround (&env, FE_TONEAREST);
+
z = log1(x,&aa,&error); /* x^y =e^(y log (X)) */
t = y*134217729.0;
y1 = t - (t-y);
@@ -97,7 +103,10 @@ __ieee754_pow(double x, double y) {
a2 = (a-a1)+aa;
error = error*ABS(y);
t = __exp1(a1,a2,1.9e16*error); /* return -10 or 0 if wasn't computed exactly */
- return (t>0)?t:power1(x,y);
+ retval = (t>0)?t:power1(x,y);
+
+ libc_feupdateenv (&env);
+ return retval;
}
if (x == 0) {
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
index ebc943639..569b8418b 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
@@ -20,9 +20,9 @@
* 2*exp(x)
*
* exp(x) + 1/exp(x)
- * ln2/2 <= x <= 22 : cosh(x) := -------------------
+ * ln2/2 <= x <= 40 : cosh(x) := -------------------
* 2
- * 22 <= x <= lnovft : cosh(x) := exp(x)/2
+ * 40 <= x <= lnovft : cosh(x) := exp(x)/2
* lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2)
* ln2ovft < x : cosh(x) := huge*huge (overflow)
*
@@ -57,13 +57,13 @@ __ieee754_coshl (long double x)
return one+(t*t)/(w+w);
}
- /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
- if (ix < 0x4036000000000000LL) {
+ /* |x| in [0.5*ln2,40], return (exp(|x|)+1/exp(|x|)/2; */
+ if (ix < 0x4044000000000000LL) {
t = __ieee754_expl(fabsl(x));
return half*t+half/t;
}
- /* |x| in [22, log(maxdouble)] return half*exp(|x|) */
+ /* |x| in [40, log(maxdouble)] return half*exp(|x|) */
if (ix < 0x40862e42fefa39efLL) return half*__ieee754_expl(fabsl(x));
/* |x| in [log(maxdouble), overflowthresold] */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
index b8e86b1a6..4b53d90c9 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
@@ -16,10 +16,10 @@
* 1. Replace x by |x| (sinh(-x) = -sinh(x)).
* 2.
* E + E/(E+1)
- * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
+ * 0 <= x <= 40 : sinh(x) := --------------, E=expm1(x)
* 2
*
- * 22 <= x <= lnovft : sinh(x) := exp(x)/2
+ * 40 <= x <= lnovft : sinh(x) := exp(x)/2
* lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2)
* ln2ovft < x : sinh(x) := x*shuge (overflow)
*
@@ -48,8 +48,8 @@ __ieee754_sinhl(long double x)
h = 0.5;
if (jx<0) h = -h;
- /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
- if (ix < 0x4036000000000000LL) { /* |x|<22 */
+ /* |x| in [0,40], return sign(x)*0.5*(E+E/(E+1))) */
+ if (ix < 0x4044000000000000LL) { /* |x|<40 */
if (ix<0x3e20000000000000LL) /* |x|<2**-29 */
if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */
t = __expm1l(fabsl(x));
@@ -57,7 +57,7 @@ __ieee754_sinhl(long double x)
return h*(t+t/(t+one));
}
- /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
+ /* |x| in [40, log(maxdouble)] return 0.5*exp(|x|) */
if (ix < 0x40862e42fefa39efLL) return h*__ieee754_expl(fabsl(x));
/* |x| in [log(maxdouble), overflowthresold] */
diff --git a/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c b/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c
index b1c9d7364..acb0508b8 100644
--- a/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c
+++ b/libc/sysdeps/ieee754/ldbl-96/printf_fphex.c
@@ -1,5 +1,5 @@
/* Print floating point number in hexadecimal notation according to ISO C99.
- Copyright (C) 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -58,6 +58,7 @@ do { \
\
/* We use a full nibble for the leading digit. */ \
leading = *numstr++; \
+ wnumstr++; \
\
/* We have 3 bits from the mantissa in the leading nibble. \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \