diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-03-20 03:23:21 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-03-20 03:23:21 +0000 |
commit | c55caac80eb5de1b1bf273e38c6f01c6308f01b3 (patch) | |
tree | a775ad06ce2bf9d041dd325a4ea9b5767e79eab3 /sysdeps/libm-ieee754 | |
parent | 46da0971fe3287760356549436140a80204d3c47 (diff) |
Add definition for `signbit' function. Future releases will have this
function.
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r-- | sysdeps/libm-ieee754/w_pow.c | 12 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_powf.c | 12 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_powl.c | 12 |
3 files changed, 36 insertions, 0 deletions
diff --git a/sysdeps/libm-ieee754/w_pow.c b/sysdeps/libm-ieee754/w_pow.c index 1711d71bda..f1a9b98dfd 100644 --- a/sysdeps/libm-ieee754/w_pow.c +++ b/sysdeps/libm-ieee754/w_pow.c @@ -20,6 +20,18 @@ #include "math_private.h" +/* This is a quick hack for now. In version 2.1.x we'll have a real + function. */ +static inline int +signbit (double x) +{ + int32_t hx; + + GET_HIGH_WORD (hx, x); + return hx & 0x80000000; +} + + #ifdef __STDC__ double __pow(double x, double y) /* wrapper pow */ #else diff --git a/sysdeps/libm-ieee754/w_powf.c b/sysdeps/libm-ieee754/w_powf.c index 0b20822be8..17da39cd03 100644 --- a/sysdeps/libm-ieee754/w_powf.c +++ b/sysdeps/libm-ieee754/w_powf.c @@ -25,6 +25,18 @@ static char rcsid[] = "$NetBSD: w_powf.c,v 1.3 1995/05/10 20:49:41 jtc Exp $"; #include "math_private.h" +/* This is a quick hack for now. In version 2.1.x we'll have a real + function. */ +static inline int +signbit (float x) +{ + int32_t hx; + + GET_FLOAT_WORD (hx, x); + return hx & 0x80000000; +} + + #ifdef __STDC__ float __powf(float x, float y) /* wrapper powf */ #else diff --git a/sysdeps/libm-ieee754/w_powl.c b/sysdeps/libm-ieee754/w_powl.c index aea572d905..44924a99c1 100644 --- a/sysdeps/libm-ieee754/w_powl.c +++ b/sysdeps/libm-ieee754/w_powl.c @@ -22,6 +22,18 @@ #include "math_private.h" +/* This is a quick hack for now. In version 2.1.x we'll have a real + function. */ +static inline int +signbit (long double x) +{ + int32_t e; + + GET_LDOUBLE_EXP (e, x); + return e & 0x8000; +} + + #ifdef __STDC__ long double __powl(long double x, long double y)/* wrapper powl */ #else |