diff options
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r-- | sysdeps/libm-ieee754/s_asinhl.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_log2f.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_nan.c | 30 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_nanf.c | 30 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_nanl.c | 30 |
5 files changed, 38 insertions, 56 deletions
diff --git a/sysdeps/libm-ieee754/s_asinhl.c b/sysdeps/libm-ieee754/s_asinhl.c index d5b307753e..6eb434c44b 100644 --- a/sysdeps/libm-ieee754/s_asinhl.c +++ b/sysdeps/libm-ieee754/s_asinhl.c @@ -65,6 +65,6 @@ huge= 1.000000000000000000e+4900L; t = x*x; w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t))); } - if(hx>0x8000) return -w; else return w; + if(hx&0x8000) return -w; else return w; } weak_alias (__asinhl, asinhl) diff --git a/sysdeps/libm-ieee754/s_log2f.c b/sysdeps/libm-ieee754/s_log2f.c index c204e2266a..6415c37f53 100644 --- a/sysdeps/libm-ieee754/s_log2f.c +++ b/sysdeps/libm-ieee754/s_log2f.c @@ -69,7 +69,7 @@ static float zero = 0.0; if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ if(f==zero) return dk; R = f*f*((float)0.5-(float)0.33333333333333333*f); - return dk-(R-f);} + return dk-(R-f); } s = f/((float)2.0+f); z = s*s; diff --git a/sysdeps/libm-ieee754/s_nan.c b/sysdeps/libm-ieee754/s_nan.c index 0d065d5c72..35d92646c0 100644 --- a/sysdeps/libm-ieee754/s_nan.c +++ b/sysdeps/libm-ieee754/s_nan.c @@ -18,31 +18,25 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* XXX The ISO C 9X standard mentions a `n-char-sequence' which is provided - as the argument to this function but I have no clue what this means. - Perhaps it is a description of the bits set in the mantissa. */ #include <math.h> -#ifdef HANDLE_TAGP -# include <stdlib.h> -# include <string.h> -#else -# include <ieee754.h> -#endif +#include <stdlib.h> +#include <string.h> +#include <ieee754.h> double __nan (const char *tagp) { -#ifdef HANDLE_TAGP - /* If we ever should have use of the TAGP parameter we will use the - strtod function to analyze it. */ - char buf[6 + strlen (tagp)]; - sprintf (buf, "NAN(%s)", tagp); - return strtod (buf, NULL); -#else static const union ieee754_double nan_value = - { ieee: { mantissa1: 0x1, mantissa0: 0x0, exponent: 0x7ff, negative: 0 } }; + { ieee: { mantissa1: 0, mantissa0: 0x80000, exponent: 0x7ff, negative: 0 } }; + + if (tagp[0] != '\0') + { + char buf[6 + strlen (tagp)]; + sprintf (buf, "NAN(%s)", tagp); + return strtod (buf, NULL); + } + return nan_value.d; -#endif } weak_alias (__nan, nan) diff --git a/sysdeps/libm-ieee754/s_nanf.c b/sysdeps/libm-ieee754/s_nanf.c index 660f30daf3..8e6e3fc1fd 100644 --- a/sysdeps/libm-ieee754/s_nanf.c +++ b/sysdeps/libm-ieee754/s_nanf.c @@ -18,31 +18,25 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* XXX The ISO C 9X standard mentions a `n-char-sequence' which is provided - as the argument to this function but I have no clue what this means. - Perhaps it is a description of the bits set in the mantissa. */ #include <math.h> -#ifdef HANDLE_TAGP -# include <stdlib.h> -# include <string.h> -#else -# include <ieee754.h> -#endif +#include <stdlib.h> +#include <string.h> +#include <ieee754.h> float __nanf (const char *tagp) { -#ifdef HANDLE_TAGP - /* If we ever should have use of the TAGP parameter we will use the - strtod function to analyze it. */ - char buf[6 + strlen (tagp)]; - sprintf (buf, "NAN(%s)", tagp); - return strtof (buf, NULL); -#else static const union ieee754_float nan_value = - { ieee: { mantissa: 0x1, exponent: 0xff, negative: 0 } }; + { ieee: { mantissa: 0x400000, exponent: 0xff, negative: 0 } }; + + if (tagp[0] != '\0') + { + char buf[6 + strlen (tagp)]; + sprintf (buf, "NAN(%s)", tagp); + return strtof (buf, NULL); + } + return nan_value.f; -#endif } weak_alias (__nanf, nanf) diff --git a/sysdeps/libm-ieee754/s_nanl.c b/sysdeps/libm-ieee754/s_nanl.c index 4ade80424f..1cd026e00c 100644 --- a/sysdeps/libm-ieee754/s_nanl.c +++ b/sysdeps/libm-ieee754/s_nanl.c @@ -18,32 +18,26 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* XXX The ISO C 9X standard mentions a `n-char-sequence' which is provided - as the argument to this function but I have no clue what this means. - Perhaps it is a description of the bits set in the mantissa. */ #include <math.h> -#ifdef HANDLE_TAGP -# include <stdlib.h> -# include <string.h> -#else -# include <ieee754.h> -#endif +#include <stdlib.h> +#include <string.h> +#include <ieee754.h> long double __nanl (const char *tagp) { -#ifdef HANDLE_TAGP - /* If we ever should have use of the TAGP parameter we will use the - strtod function to analyze it. */ - char buf[6 + strlen (tagp)]; - sprintf (buf, "NAN(%s)", tagp); - return strtold (buf, NULL); -#else static const union ieee854_long_double nan_value = - { ieee: { mantissa1: 0x1, mantissa0: 0x80000000, + { ieee: { mantissa1: 0, mantissa0: 0xc0000000, exponent: 0x7fff, negative: 0 } }; + + if (tagp[0] != '\0') + { + char buf[6 + strlen (tagp)]; + sprintf (buf, "NAN(%s)", tagp); + return strtold (buf, NULL); + } + return nan_value.d; -#endif } weak_alias (__nanl, nanl) |