summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-04-16 23:59:09 +0000
committerJakub Jelinek <jakub@redhat.com>2007-04-16 23:59:09 +0000
commite220c524c93b053a1dea504a2d18288ff8f32b9a (patch)
tree4193293c838a7db46f2cc0c2b50cb8601dcddb8d /sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
parenta891c7b0e014df5df027249f59cb444b87afdf30 (diff)
Updated to fedora-glibc-20070416T2350cvs/fedora-glibc-2_5_90-21
Diffstat (limited to 'sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c')
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
index d52526f719..68027f26fa 100644
--- a/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
+++ b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
@@ -20,7 +20,10 @@
* Special cases:
*/
+#include <math.h>
+#include <math_private.h>
#include <math_ldbl_opt.h>
+#include <float.h>
float __nldbl_nexttowardf(float x, double y);
@@ -39,10 +42,12 @@ float __nldbl_nexttowardf(float x, double y)
return x+y;
if((double) x==y) return y; /* x=y, return y */
if(ix==0) { /* x == 0 */
- float x2;
+ float u;
SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/
- x2 = x*x;
- if(x2==x) return x2; else return x; /* raise underflow flag */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(hx>=0) { /* x > 0 */
if(hy<0||(ix>>23)>(iy>>20)-0x380
@@ -60,13 +65,16 @@ float __nldbl_nexttowardf(float x, double y)
hx += 1;
}
hy = hx&0x7f800000;
- if(hy>=0x7f800000) return x+x; /* overflow */
- if(hy<0x00800000) { /* underflow */
- float x2 = x*x;
- if(x2!=x) { /* raise underflow flag */
- SET_FLOAT_WORD(x2,hx);
- return x2;
- }
+ if(hy>=0x7f800000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0)
+ /* Force conversion to float. */
+ asm ("" : "+m"(x));
+ return x;
+ }
+ if(hy<0x00800000) {
+ float u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
}
SET_FLOAT_WORD(x,hx);
return x;