Due to their "inverse" treatment of the fraction's MSb, update NAN

conversion to construct a quiet NaN on hppa, mips, sh3, and sh5 as well.
Also, remove the portion constructing a ROP on vax; this is not required
by the standard, and in its consequences it is not an appropriate
substitute for a qNaN.
This commit is contained in:
kleink 2005-04-15 22:46:21 +00:00
parent b2cb7fcd8a
commit d6a0715a49
2 changed files with 16 additions and 17 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: strtod.3,v 1.15 2003/08/07 16:43:44 agc Exp $
.\" $NetBSD: strtod.3,v 1.16 2005/04/15 22:46:21 kleink Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,7 +33,7 @@
.\"
.\" from: @(#)strtod.3 8.1 (Berkeley) 6/4/93
.\"
.Dd January 28, 2002
.Dd April 15, 2005
.Dt STRTOD 3
.Os
.Sh NAME
@ -101,9 +101,7 @@ A character sequence
.Li NAN
or
.Li NAN(n-char-sequence-opt)
is converted to a quiet \*(Na, if supported, else to a
.Dq reserved operand
for that machine (i.e.,
is converted to a quiet \*(Na, if supported, else remain unrecognized (i.e.,
.Tn VAX ) .
.Pp
If

View File

@ -1,4 +1,4 @@
/* $NetBSD: strtod.c,v 1.45 2005/02/09 21:35:47 kleink Exp $ */
/* $NetBSD: strtod.c,v 1.46 2005/04/15 22:46:21 kleink Exp $ */
/****************************************************************
*
@ -93,7 +93,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: strtod.c,v 1.45 2005/02/09 21:35:47 kleink Exp $");
__RCSID("$NetBSD: strtod.c,v 1.46 2005/04/15 22:46:21 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -125,6 +125,13 @@ __RCSID("$NetBSD: strtod.c,v 1.45 2005/02/09 21:35:47 kleink Exp $");
#define VAX
#endif
#if defined(__hppa__) || defined(__mips__) || defined(__sh__)
#define NAN_WORD0 0x7ff40000
#else
#define NAN_WORD0 0x7ff80000
#endif
#define NAN_WORD1 0
#define Long int32_t
#define ULong u_int32_t
@ -1255,19 +1262,12 @@ strtod
goto ret;
}
#ifdef IEEE_Arith
/* "NAN" or "NAN(n-char-sequence-opt)" */
if (tolower((unsigned char)*s) == 'n' && strncasecmp(s, "nan", 3) == 0) {
#ifdef IEEE_Arith
/* Build a quiet NaN. */
word0(rv) = Exp_mask | ((1 << Exp_shift) - 1);
word1(rv) = 0;
#else
#ifdef VAX
/* Lacking a quiet NaN, build a reserved operand. */
word0(rv) = Sign_bit;
word1(rv) = 0;
#endif
#endif
word0(rv) = NAN_WORD0;
word1(rv) = NAN_WORD1;
s+= 3;
/* Don't interpret (n-char-sequence-opt), for now. */
@ -1283,6 +1283,7 @@ strtod
goto ret;
}
#endif
if (*s == '0') {
nz0 = 1;