aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_nan.c')
-rw-r--r--sysdeps/libm-ieee754/s_nan.c30
1 files changed, 12 insertions, 18 deletions
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)