Sun Jun 5 14:43:13 2011 UTC ()
Revert previous and make frach be 0xc0000000 for NAN's generated by strtold()
as suggested by tron.


(christos)
diff -r1.1 -r1.2 src/lib/libc/arch/i386/gdtoa/gd_qnan.h
diff -r1.7 -r1.8 src/lib/libc/arch/i386/gen/isnanl.c
diff -r1.2 -r1.3 src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h
diff -r1.7 -r1.8 src/lib/libc/arch/x86_64/gen/isnanl.c

cvs diff -r1.1 -r1.2 src/lib/libc/arch/i386/gdtoa/gd_qnan.h (expand / switch to unified diff)

--- src/lib/libc/arch/i386/gdtoa/gd_qnan.h 2006/01/25 15:33:28 1.1
+++ src/lib/libc/arch/i386/gdtoa/gd_qnan.h 2011/06/05 14:43:12 1.2
@@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
1/* $NetBSD: gd_qnan.h,v 1.1 2006/01/25 15:33:28 kleink Exp $ */ 1/* $NetBSD: gd_qnan.h,v 1.2 2011/06/05 14:43:12 christos Exp $ */
2 2
3#define f_QNAN 0x7fc00000 3#define f_QNAN 0x7fc00000
4#define d_QNAN0 0x0 4#define d_QNAN0 0x0
5#define d_QNAN1 0x7ff80000 5#define d_QNAN1 0x7ff80000
6#define ldus_QNAN0 0x0 6#define ldus_QNAN0 0x0
7#define ldus_QNAN1 0x0 7#define ldus_QNAN1 0x0
8#define ldus_QNAN2 0x0 8#define ldus_QNAN2 0x0
9#define ldus_QNAN3 0x4000 9#define ldus_QNAN3 0xc000
10#define ldus_QNAN4 0x7fff 10#define ldus_QNAN4 0x7fff
11/* 2 bytes of tail padding follow, per i386 ABI */ 11/* 2 bytes of tail padding follow, per i386 ABI */

cvs diff -r1.7 -r1.8 src/lib/libc/arch/i386/gen/isnanl.c (expand / switch to unified diff)

--- src/lib/libc/arch/i386/gen/isnanl.c 2011/06/04 15:45:41 1.7
+++ src/lib/libc/arch/i386/gen/isnanl.c 2011/06/05 14:43:13 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: isnanl.c,v 1.7 2011/06/04 15:45:41 christos Exp $ */ 1/* $NetBSD: isnanl.c,v 1.8 2011/06/05 14:43:13 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This software was developed by the Computer Systems Engineering group 7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley. 9 * contributed to Berkeley.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -30,34 +30,35 @@ @@ -30,34 +30,35 @@
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE. 33 * SUCH DAMAGE.
34 * 34 *
35 * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp 35 * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39#if defined(LIBC_SCCS) && !defined(lint) 39#if defined(LIBC_SCCS) && !defined(lint)
40#if 0 40#if 0
41static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93"; 41static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
42#else 42#else
43__RCSID("$NetBSD: isnanl.c,v 1.7 2011/06/04 15:45:41 christos Exp $"); 43__RCSID("$NetBSD: isnanl.c,v 1.8 2011/06/05 14:43:13 christos Exp $");
44#endif 44#endif
45#endif /* LIBC_SCCS and not lint */ 45#endif /* LIBC_SCCS and not lint */
46 46
47#include <machine/ieee.h> 47#include <machine/ieee.h>
48#include <math.h> 48#include <math.h>
49 49
50/* 50/*
51 * 7.12.3.4 isnan - test for a NaN 51 * 7.12.3.4 isnan - test for a NaN
52 * IEEE 754 compatible 80-bit extended-precision Intel 386 version 52 * IEEE 754 compatible 80-bit extended-precision Intel 386 version
53 */ 53 */
54int 54int
55__isnanl(long double x) 55__isnanl(long double x)
56{ 56{
57 union ieee_ext_u u; 57 union ieee_ext_u u;
58 58
59 u.extu_ld = x; 59 u.extu_ld = x;
60 60
61 return u.extu_ext.ext_exp == EXT_EXP_INFNAN && 61 return (u.extu_ext.ext_exp == EXT_EXP_INFNAN &&
62 (u.extu_ext.ext_frach != 0 || u.extu_ext.ext_fracl != 0); 62 (u.extu_ext.ext_frach & 0x80000000) != 0 &&
 63 (u.extu_ext.ext_frach != 0x80000000 || u.extu_ext.ext_fracl != 0));
63} 64}

cvs diff -r1.2 -r1.3 src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h (expand / switch to unified diff)

--- src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h 2011/03/20 23:16:07 1.2
+++ src/lib/libc/arch/x86_64/gdtoa/gd_qnan.h 2011/06/05 14:43:13 1.3
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1/* $NetBSD: gd_qnan.h,v 1.2 2011/03/20 23:16:07 christos Exp $ */ 1/* $NetBSD: gd_qnan.h,v 1.3 2011/06/05 14:43:13 christos Exp $ */
2 2
3#define f_QNAN 0x7fc00000 3#define f_QNAN 0x7fc00000
4#define d_QNAN0 0x0 4#define d_QNAN0 0x0
5#define d_QNAN1 0x7ff80000 5#define d_QNAN1 0x7ff80000
6#define ld_QNAN0 0x0 6#define ld_QNAN0 0x0
7#define ld_QNAN1 0xc0000000 7#define ld_QNAN1 0xc0000000
8#define ld_QNAN2 0x7fff 8#define ld_QNAN2 0x7fff
9#define ld_QNAN3 0x0 9#define ld_QNAN3 0x0
10#define ldus_QNAN0 0x0 10#define ldus_QNAN0 0x0
11#define ldus_QNAN1 0x0 11#define ldus_QNAN1 0x0
12#define ldus_QNAN2 0x0 12#define ldus_QNAN2 0x0
13#define ldus_QNAN3 0x4000 13#define ldus_QNAN3 0xc000
14#define ldus_QNAN4 0x7fff 14#define ldus_QNAN4 0x7fff
15/* 6 bytes of tail padding follow, per AMD64 ABI */ 15/* 6 bytes of tail padding follow, per AMD64 ABI */

cvs diff -r1.7 -r1.8 src/lib/libc/arch/x86_64/gen/isnanl.c (expand / switch to unified diff)

--- src/lib/libc/arch/x86_64/gen/isnanl.c 2011/06/04 15:45:41 1.7
+++ src/lib/libc/arch/x86_64/gen/isnanl.c 2011/06/05 14:43:13 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: isnanl.c,v 1.7 2011/06/04 15:45:41 christos Exp $ */ 1/* $NetBSD: isnanl.c,v 1.8 2011/06/05 14:43:13 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This software was developed by the Computer Systems Engineering group 7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley. 9 * contributed to Berkeley.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -30,34 +30,35 @@ @@ -30,34 +30,35 @@
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE. 33 * SUCH DAMAGE.
34 * 34 *
35 * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp 35 * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39#if defined(LIBC_SCCS) && !defined(lint) 39#if defined(LIBC_SCCS) && !defined(lint)
40#if 0 40#if 0
41static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93"; 41static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
42#else 42#else
43__RCSID("$NetBSD: isnanl.c,v 1.7 2011/06/04 15:45:41 christos Exp $"); 43__RCSID("$NetBSD: isnanl.c,v 1.8 2011/06/05 14:43:13 christos Exp $");
44#endif 44#endif
45#endif /* LIBC_SCCS and not lint */ 45#endif /* LIBC_SCCS and not lint */
46 46
47#include <machine/ieee.h> 47#include <machine/ieee.h>
48#include <math.h> 48#include <math.h>
49 49
50/* 50/*
51 * 7.12.3.4 isnan - test for a NaN 51 * 7.12.3.4 isnan - test for a NaN
52 * IEEE 754 compatible 80-bit extended-precision Intel 386 version 52 * IEEE 754 compatible 80-bit extended-precision Intel 386 version
53 */ 53 */
54int 54int
55__isnanl(long double x) 55__isnanl(long double x)
56{ 56{
57 union ieee_ext_u u; 57 union ieee_ext_u u;
58 58
59 u.extu_ld = x; 59 u.extu_ld = x;
60 60
61 return u.extu_ext.ext_exp == EXT_EXP_INFNAN && 61 return (u.extu_ext.ext_exp == EXT_EXP_INFNAN &&
62 (u.extu_ext.ext_frach != 0 || u.extu_ext.ext_fracl != 0); 62 (u.extu_ext.ext_frach & 0x80000000) != 0 &&
 63 (u.extu_ext.ext_frach != 0x80000000 || u.extu_ext.ext_fracl != 0));
63} 64}