diff --git a/contrib/gdtoa/README b/contrib/gdtoa/README index 6bece758de30..cf1947aa216b 100644 --- a/contrib/gdtoa/README +++ b/contrib/gdtoa/README @@ -144,18 +144,33 @@ appropriate depends on the compiler; for this to work, it may be necessary to #include "float.h" or another system-dependent header file. -The values returned for NaNs may be signaling NaNs on some systems, -since the rules for distinguishing signaling from quiet NaNs are -system-dependent. You can easily fix this by suitably modifying the -ULto* routines in strtor*.c. +Source file strtodnrp.c gives a strtod that does not require 53-bit +rounding precision on systems (such as Intel IA32 systems) that may +suffer double rounding due to use of extended-precision registers. +For some conversions this variant of strtod is less efficient than the +one in strtod.c when the latter is run with 53-bit rounding precision. + +The values that the strto* routines return for NaNs are determined by +gd_qnan.h, which the makefile generates by running the program whose +source is qnan.c. Note that the rules for distinguishing signaling +from quiet NaNs are system-dependent. For cross-compilation, you need +to determine arith.h and gd_qnan.h suitably, e.g., using the +arithmetic of the target machine. C99's hexadecimal floating-point constants are recognized by the strto* routines (but this feature has not yet been heavily tested). Compiling with NO_HEX_FP #defined disables this feature. -The strto* routines do not (yet) recognize C99's NaN(...) syntax; the -strto* routines simply regard '(' as the first unprocessed input -character. +When compiled with -DINFNAN_CHECK, the strto* routines recognize C99's +NaN and Infinity syntax. Moreover, unless No_Hex_NaN is #defined, the +strto* routines also recognize C99's NaN(...) syntax: they accept +(case insensitively) strings of the form NaN(x), where x is a string +of hexadecimal digits and spaces; if there is only one string of +hexadecimal digits, it is taken for the fraction bits of the resulting +NaN; if there are two or more strings of hexadecimal digits, each +string is assigned to the next available sequence of 32-bit words of +fractions bits (starting with the most significant), right-aligned in +each sequence. For binary -> decimal conversions, I've provided just one family of helper routines: @@ -213,7 +228,7 @@ for intermediate quantities, and MALLOC (see gdtoaimp.h) is called only if the private pool does not suffice. 2000 is large enough that MALLOC is called only under very unusual circumstances (decimal -> binary conversion of very long strings) for conversions to and from double -precision. For systems with preemptivaly scheduled multiple threads +precision. For systems with preemptively scheduled multiple threads or for conversions to extended or quad, it may be appropriate to #define PRIVATE_MEM nnnn, where nnnn is a suitable value > 2000. For extended and quad precisions, -DPRIVATE_MEM=20000 is probably @@ -317,7 +332,5 @@ Compiling g__fmt.c, strtod.c, and strtodg.c with -DUSE_LOCALE causes the decimal-point character to be taken from the current locale; otherwise it is '.'. -Please send comments to - - David M. Gay - dmg@acm.org +Please send comments to David M. Gay (dmg at acm dot org, with " at " +changed at "@" and " dot " changed to "."). diff --git a/contrib/gdtoa/arithchk.c b/contrib/gdtoa/arithchk.c index 59eaad75d27f..3211aeda42ce 100644 --- a/contrib/gdtoa/arithchk.c +++ b/contrib/gdtoa/arithchk.c @@ -136,6 +136,7 @@ fzcheck() return b == 0.; } + int main() { Akind *a = 0; diff --git a/contrib/gdtoa/dmisc.c b/contrib/gdtoa/dmisc.c index 14b5d7e6834b..ce170c733bf7 100644 --- a/contrib/gdtoa/dmisc.c +++ b/contrib/gdtoa/dmisc.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/dtoa.c b/contrib/gdtoa/dtoa.c index 20e240590c3e..e808cc1f4f32 100644 --- a/contrib/gdtoa/dtoa.c +++ b/contrib/gdtoa/dtoa.c @@ -26,21 +26,15 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" /* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. * * Inspired by "How to Print Floating-Point Numbers Accurately" by - * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 92-101]. + * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. * * Modifications: * 1. Rather than iterating, we use a simple numeric overestimate diff --git a/contrib/gdtoa/g_Qfmt.c b/contrib/gdtoa/g_Qfmt.c index 896b9d40f7db..2b9b36799635 100644 --- a/contrib/gdtoa/g_Qfmt.c +++ b/contrib/gdtoa/g_Qfmt.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -83,7 +77,7 @@ g_Qfmt(char *buf, void *V, int ndig, unsigned bufsize) if (ex == 0x7fff) { /* Infinity or NaN */ if (bits[0] | bits[1] | bits[2] | bits[3]) - b = strcpy(b, "NaN"); + b = strcp(b, "NaN"); else { b = buf; if (sign) diff --git a/contrib/gdtoa/g__fmt.c b/contrib/gdtoa/g__fmt.c index 6274681308f4..021ecfb57283 100644 --- a/contrib/gdtoa/g__fmt.c +++ b/contrib/gdtoa/g__fmt.c @@ -26,10 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - dmg@acm.org - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/g_ddfmt.c b/contrib/gdtoa/g_ddfmt.c index 7d214ba8a401..7fc30578a903 100644 --- a/contrib/gdtoa/g_ddfmt.c +++ b/contrib/gdtoa/g_ddfmt.c @@ -26,14 +26,7 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg@acm.org). */ #include "gdtoaimp.h" #include diff --git a/contrib/gdtoa/g_dfmt.c b/contrib/gdtoa/g_dfmt.c index 1ade8344f06f..db2636f6da99 100644 --- a/contrib/gdtoa/g_dfmt.c +++ b/contrib/gdtoa/g_dfmt.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/g_ffmt.c b/contrib/gdtoa/g_ffmt.c index 851394a3d800..612adfae3829 100644 --- a/contrib/gdtoa/g_ffmt.c +++ b/contrib/gdtoa/g_ffmt.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/g_xLfmt.c b/contrib/gdtoa/g_xLfmt.c index fc1764376b7a..1bbc6e215edf 100644 --- a/contrib/gdtoa/g_xLfmt.c +++ b/contrib/gdtoa/g_xLfmt.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/g_xfmt.c b/contrib/gdtoa/g_xfmt.c index 1e2a381b5f01..47a862d6bc7b 100644 --- a/contrib/gdtoa/g_xfmt.c +++ b/contrib/gdtoa/g_xfmt.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -96,6 +90,7 @@ g_xfmt(char *buf, void *V, int ndig, unsigned bufsize) } else if (bits[0] | bits[1]) { i = STRTOG_Denormal; + ex = 1; } else { b = buf; diff --git a/contrib/gdtoa/gdtoa.c b/contrib/gdtoa/gdtoa.c index 706c055d62e5..8ff8cc587ea6 100644 --- a/contrib/gdtoa/gdtoa.c +++ b/contrib/gdtoa/gdtoa.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -83,7 +77,7 @@ bitstob(ULong *bits, int nbits, int *bbits) /* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. * * Inspired by "How to Print Floating-Point Numbers Accurately" by - * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 92-101]. + * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. * * Modifications: * 1. Rather than iterating, we use a simple numeric overestimate diff --git a/contrib/gdtoa/gdtoa.h b/contrib/gdtoa/gdtoa.h index 62553f2ed05d..ee6a9e53fafa 100644 --- a/contrib/gdtoa/gdtoa.h +++ b/contrib/gdtoa/gdtoa.h @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #ifndef GDTOA_H_INCLUDED #define GDTOA_H_INCLUDED diff --git a/contrib/gdtoa/gethex.c b/contrib/gdtoa/gethex.c index fadb5de81260..610f74735e98 100644 --- a/contrib/gdtoa/gethex.c +++ b/contrib/gdtoa/gethex.c @@ -26,10 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - dmg@acm.org - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -47,7 +45,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) { Bigint *b; CONST unsigned char *decpt, *s0, *s, *s1; - int esign, havedig, irv, k, n, nbits, up; + int esign, havedig, irv, k, n, nbits, up, zret; ULong L, lostbits, *x; Long e, e1; #ifdef USE_LOCALE @@ -65,22 +63,20 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) s0 += havedig; s = s0; decpt = 0; + zret = 0; + e = 0; if (!hexdig[*s]) { - if (*s == decimalpoint) { - decpt = ++s; - if (!hexdig[*s]) - goto ret0; - } - else { - ret0: - *sp = (char*)s; - return havedig ? STRTOG_Zero : STRTOG_NoNumber; - } + zret = 1; + if (*s != decimalpoint) + goto pcheck; + decpt = ++s; + if (!hexdig[*s]) + goto pcheck; while(*s == '0') s++; + if (hexdig[*s]) + zret = 0; havedig = 1; - if (!hexdig[*s]) - goto ret0; s0 = s; } while(hexdig[*s]) @@ -90,9 +86,9 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) while(hexdig[*s]) s++; } - e = 0; if (decpt) e = -(((Long)(s-decpt)) << 2); + pcheck: s1 = s; switch(*s) { case 'p': @@ -117,6 +113,8 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) e += e1; } *sp = (char*)s; + if (zret) + return havedig ? STRTOG_Zero : STRTOG_NoNumber; n = s1 - s0 - 1; for(k = 0; n > 7; n >>= 1) k++; diff --git a/contrib/gdtoa/gmisc.c b/contrib/gdtoa/gmisc.c index 1607f4b19a67..8270ef944797 100644 --- a/contrib/gdtoa/gmisc.c +++ b/contrib/gdtoa/gmisc.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/hd_init.c b/contrib/gdtoa/hd_init.c index 73afca14a06e..fa6e18dee8f4 100644 --- a/contrib/gdtoa/hd_init.c +++ b/contrib/gdtoa/hd_init.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/hexnan.c b/contrib/gdtoa/hexnan.c index 7a7e03add268..591cad134e7d 100644 --- a/contrib/gdtoa/hexnan.c +++ b/contrib/gdtoa/hexnan.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/makefile b/contrib/gdtoa/makefile index 3387a651683e..209fefc5cea4 100644 --- a/contrib/gdtoa/makefile +++ b/contrib/gdtoa/makefile @@ -30,13 +30,18 @@ CFLAGS = -g -DINFNAN_CHECK .c.o: $(CC) -c $(CFLAGS) $*.c -all: arith.h gdtoa.a +all: arith.h gd_qnan.h gdtoa.a arith.h: arithchk.c $(CC) $(CFLAGS) arithchk.c || $(CC) -DNO_LONG_LONG $(CFLAGS) arithchk.c ./a.out >arith.h rm -f a.out arithchk.o +gd_qnan.h: arith.h qnan.c + $(CC) $(CFLAGS) qnan.c + ./a.out >gd_qnan.h + rm -f a.out qnan.o + gdtoa.a: dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c g_ffmt.c\ g_xLfmt.c g_xfmt.c gdtoa.c gethex.c gmisc.c hd_init.c hexnan.c\ misc.c smisc.c strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c\ @@ -51,10 +56,10 @@ gdtoa.a: dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c g_ffmt.c\ xs0 = README arithchk.c dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c\ g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h gdtoaimp.h gethex.c\ - gmisc.c hd_init.c hexnan.c makefile misc.c smisc.c strtoIQ.c\ + gmisc.c hd_init.c hexnan.c makefile misc.c qnan.c smisc.c strtoIQ.c\ strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c strtoIxL.c\ - strtod.c strtodI.c strtodg.c strtof.c strtopQ.c strtopd.c strtopdd.c\ - strtopf.c strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c\ + strtod.c strtodI.c strtodg.c strtodnrp.c strtof.c strtopQ.c strtopd.c\ + strtopdd.c strtopf.c strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c\ strtorf.c strtorx.c strtorxL.c sum.c ulp.c # "make xsum.out" to check for transmission errors; source for xsum is @@ -66,4 +71,4 @@ xsum.out: xsum0.out $(xs0) cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out clean: - rm -f arith.h *.[ao] xsum.out xsum1.out + rm -f arith.h gd_qnan.h *.[ao] xsum.out xsum1.out diff --git a/contrib/gdtoa/misc.c b/contrib/gdtoa/misc.c index 5f5cbc2c27de..b3ce7c9b8a4a 100644 --- a/contrib/gdtoa/misc.c +++ b/contrib/gdtoa/misc.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -143,7 +137,7 @@ lo0bits if (!(x & 1)) { k++; x >>= 1; - if (!x & 1) + if (!x) return 32; } *y = x; @@ -208,7 +202,7 @@ multadd } int -hi0bits +hi0bits_D2A #ifdef KR_headers (x) register ULong x; #else @@ -686,7 +680,10 @@ d2b #endif { Bigint *b; - int de, i, k; +#ifndef Sudden_Underflow + int i; +#endif + int de, k; ULong *x, y, z; #ifdef VAX ULong d0, d1; @@ -723,7 +720,10 @@ d2b } else x[0] = y; - i = b->wds = (x[1] = z) !=0 ? 2 : 1; +#ifndef Sudden_Underflow + i = +#endif + b->wds = (x[1] = z) !=0 ? 2 : 1; } else { #ifdef DEBUG @@ -732,7 +732,10 @@ d2b #endif k = lo0bits(&z); x[0] = z; - i = b->wds = 1; +#ifndef Sudden_Underflow + i = +#endif + b->wds = 1; k += 32; } #else diff --git a/contrib/gdtoa/qnan.c b/contrib/gdtoa/qnan.c new file mode 100644 index 000000000000..118e749216ab --- /dev/null +++ b/contrib/gdtoa/qnan.c @@ -0,0 +1,110 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 2005 by David M. Gay +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that the copyright notice and this permission notice and warranty +disclaimer appear in supporting documentation, and that the name of +the author or any of his current or former employers not be used in +advertising or publicity pertaining to distribution of the software +without specific, written prior permission. + +THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN +NO EVENT SHALL THE AUTHOR OR ANY OF HIS CURRENT OR FORMER EMPLOYERS BE +LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +/* Program to compute quiet NaNs of various precisions (float, */ +/* double, and perhaps long double) on the current system, */ +/* provided the system uses binary IEEE (P754) arithmetic. */ +/* Note that one system's quiet NaN may be a signaling NaN on */ +/* another system. The IEEE arithmetic standards (P754, P854) */ +/* do not specify how to distinguish signaling NaNs from quiet */ +/* ones, and this detail varies across systems. The computed */ +/* NaN values are encoded in #defines for values for an */ +/* unsigned 32-bit integer type, called Ulong below, and */ +/* (for long double) perhaps as unsigned short values. Once */ +/* upon a time, there were PC compilers for Intel CPUs that */ +/* had sizeof(long double) = 10. Are such compilers still */ +/* distributed? */ + +#include +#include "arith.h" + +#ifndef Long +#define Long long +#endif + +typedef unsigned Long Ulong; + +#undef HAVE_IEEE +#ifdef IEEE_8087 +#define _0 1 +#define _1 0 +#define HAVE_IEEE +#endif +#ifdef IEEE_MC68k +#define _0 0 +#define _1 1 +#define HAVE_IEEE +#endif + +#define UL (unsigned long) + + int +main(void) +{ +#ifdef HAVE_IEEE + typedef union { + float f; + double d; + Ulong L[4]; +#ifndef NO_LONG_LONG + unsigned short u[5]; + long double D; +#endif + } U; + U a, b, c; + int i; + + a.L[0] = b.L[0] = 0x7f800000; + c.f = a.f - b.f; + printf("#define f_QNAN 0x%lx\n", UL c.L[0]); + a.L[_0] = b.L[_0] = 0x7ff00000; + a.L[_1] = b.L[_1] = 0; + c.d = a.d - b.d; /* quiet NaN */ + printf("#define d_QNAN0 0x%lx\n", UL c.L[0]); + printf("#define d_QNAN1 0x%lx\n", UL c.L[1]); +#ifdef NO_LONG_LONG + for(i = 0; i < 4; i++) + printf("#define ld_QNAN%d 0xffffffff\n", i); + for(i = 0; i < 5; i++) + printf("#define ldus_QNAN%d 0xffff\n", i); +#else + b.D = c.D = a.d; + if (printf("") < 0) + c.D = 37; /* never executed; just defeat optimization */ + a.L[2] = a.L[3] = 0; + a.D = b.D - c.D; + for(i = 0; i < 4; i++) + printf("#define ld_QNAN%d 0x%lx\n", i, UL a.L[i]); + for(i = 0; i < 5; i++) + printf("#define ldus_QNAN%d 0x%x\n", i, a.u[i]); +#endif +#endif /* HAVE_IEEE */ + return 0; + } diff --git a/contrib/gdtoa/smisc.c b/contrib/gdtoa/smisc.c index e20e9da97f0f..163011e0aa2f 100644 --- a/contrib/gdtoa/smisc.c +++ b/contrib/gdtoa/smisc.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtoIQ.c b/contrib/gdtoa/strtoIQ.c index 0ce04207d088..9ce5120e6b7f 100644 --- a/contrib/gdtoa/strtoIQ.c +++ b/contrib/gdtoa/strtoIQ.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtoId.c b/contrib/gdtoa/strtoId.c index f986e041618a..1c97d382deae 100644 --- a/contrib/gdtoa/strtoId.c +++ b/contrib/gdtoa/strtoId.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtoIdd.c b/contrib/gdtoa/strtoIdd.c index 9622c186881a..40b7936bc002 100644 --- a/contrib/gdtoa/strtoIdd.c +++ b/contrib/gdtoa/strtoIdd.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtoIf.c b/contrib/gdtoa/strtoIf.c index c439ff5a934d..65ecab2e0b83 100644 --- a/contrib/gdtoa/strtoIf.c +++ b/contrib/gdtoa/strtoIf.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtoIg.c b/contrib/gdtoa/strtoIg.c index a7668134dea2..ec46a3ebb755 100644 --- a/contrib/gdtoa/strtoIg.c +++ b/contrib/gdtoa/strtoIg.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtoIx.c b/contrib/gdtoa/strtoIx.c index d699f04c8122..783a631f0669 100644 --- a/contrib/gdtoa/strtoIx.c +++ b/contrib/gdtoa/strtoIx.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtoIxL.c b/contrib/gdtoa/strtoIxL.c index c5795891399b..869bfd16fb81 100644 --- a/contrib/gdtoa/strtoIxL.c +++ b/contrib/gdtoa/strtoIxL.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtod.c b/contrib/gdtoa/strtod.c index 4913d5089c94..66a3baa2bc3d 100644 --- a/contrib/gdtoa/strtod.c +++ b/contrib/gdtoa/strtod.c @@ -26,12 +26,13 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - dmg@acm.org - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" +#ifndef NO_FENV_H +#include +#endif #ifdef USE_LOCALE #include "locale.h" @@ -68,7 +69,7 @@ strtod #ifdef Avoid_Underflow int scale; #endif - int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, + int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, dsign, e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; CONST char *s, *s0, *s1; double aadj, aadj1, adj, rv, rv0; @@ -82,7 +83,7 @@ strtod int rounding; #endif - sign = nz0 = nz = 0; + sign = nz0 = nz = decpt = 0; dval(rv) = 0.; for(s = s00;;s++) switch(*s) { case '-': @@ -114,7 +115,18 @@ strtod switch(s[1]) { case 'x': case 'X': - switch((i = gethex(&s, &fpi, &exp, &bb, sign)) & STRTOG_Retmask) { + { +#if defined(FE_DOWNWARD) && defined(FE_TONEAREST) && defined(FE_TOWARDZERO) && defined(FE_UPWARD) + FPI fpi1 = fpi; + switch(fegetround()) { + case FE_TOWARDZERO: fpi1.rounding = 0; break; + case FE_UPWARD: fpi1.rounding = 2; break; + case FE_DOWNWARD: fpi1.rounding = 3; + } +#else +#define fpi1 fpi +#endif + switch((i = gethex(&s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) { case STRTOG_NoNumber: s = s00; sign = 0; @@ -126,7 +138,7 @@ strtod Bfree(bb); } ULtod(((U*)&rv)->L, bits, exp, i); - } + }} goto ret; } } @@ -150,6 +162,7 @@ strtod if (c == '.') #endif { + decpt = 1; c = *++s; if (!nd) { for(; c == '0'; c = *++s) @@ -225,7 +238,8 @@ strtod ULong bits[2]; static FPI fpinan = /* only 52 explicit bits */ { 52, 1-1023-53+1, 2046-1023-53+1, 1, SI }; - switch(c) { + if (!decpt) + switch(c) { case 'i': case 'I': if (match(&s,"nf")) { @@ -248,8 +262,10 @@ strtod word1(rv) = bits[0]; } else { +#endif word0(rv) = NAN_WORD0; word1(rv) = NAN_WORD1; +#ifndef No_Hex_NaN } #endif goto ret; diff --git a/contrib/gdtoa/strtodI.c b/contrib/gdtoa/strtodI.c index 163f363f8534..98f889110e0e 100644 --- a/contrib/gdtoa/strtodI.c +++ b/contrib/gdtoa/strtodI.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -61,11 +55,7 @@ strtodI(s, sp, dd) CONST char *s; char **sp; double *dd; strtodI(CONST char *s, char **sp, double *dd) #endif { -#ifdef Sudden_Underflow - static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 1 }; -#else - static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 }; -#endif + static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; ULong bits[2], sign; Long exp; int j, k; @@ -165,8 +155,8 @@ strtodI(CONST char *s, char **sp, double *dd) break; case STRTOG_NaN: - u->L[_0] = u->L[2+_0] = 0x7fffffff | sign; - u->L[_1] = u->L[2+_1] = (ULong)-1; + u->L[0] = u->L[2] = d_QNAN0; + u->L[1] = u->L[3] = d_QNAN1; break; case STRTOG_NaNbits: diff --git a/contrib/gdtoa/strtodg.c b/contrib/gdtoa/strtodg.c index bf30e33ecf57..cbdf4aadf299 100644 --- a/contrib/gdtoa/strtodg.c +++ b/contrib/gdtoa/strtodg.c @@ -26,10 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - dmg@acm.org - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -239,7 +237,7 @@ rvOK inex = STRTOG_Inexhi; b = increment(b); if ( (j = nb & kmask) !=0) - j = 32 - j; + j = ULbits - j; if (hi0bits(b->x[b->wds - 1]) != j) { if (!lostbits) lostbits = b->x[0] & 1; @@ -325,8 +323,8 @@ strtodg #endif { int abe, abits, asub; - int bb0, bb2, bb5, bbe, bd2, bd5, bbbits, bs2; - int c, denorm, dsign, e, e1, e2, emin, esign, finished, i, inex, irv; + int bb0, bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, denorm; + int dsign, e, e1, e2, emin, esign, finished, i, inex, irv; int j, k, nbits, nd, nd0, nf, nz, nz0, rd, rvbits, rve, rve1, sign; int sudden_underflow; CONST char *s, *s0, *s1; @@ -385,7 +383,7 @@ strtodg sudden_underflow = fpi->sudden_underflow; s0 = s; y = z = 0; - for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) + for(decpt = nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) if (nd < 9) y = 10*y + c - '0'; else if (nd < 16) @@ -397,6 +395,7 @@ strtodg if (c == '.') #endif { + decpt = 1; c = *++s; if (!nd) { for(; c == '0'; c = *++s) @@ -471,7 +470,8 @@ strtodg if (!nz && !nz0) { #ifdef INFNAN_CHECK /* Check for Nan and Infinity */ - switch(c) { + if (!decpt) + switch(c) { case 'i': case 'I': if (match(&s,"nf")) { @@ -632,7 +632,14 @@ strtodg dval(rv) *= tinytens[j]; } } - +#ifdef IBM + /* e2 is a correction to the (base 2) exponent of the return + * value, reflecting adjustments above to avoid overflow in the + * native arithmetic. For native IBM (base 16) arithmetic, we + * must multiply e2 by 4 to change from base 16 to 2. + */ + e2 <<= 2; +#endif rvb = d2b(dval(rv), &rve, &rvbits); /* rv = rvb * 2^rve */ rve += e2; if ((j = rvbits - nbits) > 0) { @@ -642,16 +649,8 @@ strtodg } bb0 = 0; /* trailing zero bits in rvb */ e2 = rve + rvbits - nbits; - if (e2 > fpi->emax) { - rvb->wds = 0; - irv = STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi; -#ifndef NO_ERRNO - errno = ERANGE; -#endif - infnanexp: - *exp = fpi->emax + 1; - goto ret; - } + if (e2 > fpi->emax + 1) + goto huge; rve1 = rve + rvbits - nbits; if (e2 < (emin = fpi->emin)) { denorm = 1; @@ -823,8 +822,8 @@ strtodg break; if (dsign) { rvb = increment(rvb); - if ( (j = rvbits >> kshift) !=0) - j = 32 - j; + if ( (j = rvbits & kmask) !=0) + j = ULbits - j; if (hi0bits(rvb->x[(rvb->wds - 1) >> kshift]) != j) rvbits++; @@ -965,9 +964,11 @@ strtodg Bfree(bs); Bfree(delta); } - if (!denorm && rvbits < nbits) { - j = nbits - rvbits; - rvb = lshift(rvb, j); + if (!denorm && (j = nbits - rvbits)) { + if (j > 0) + rvb = lshift(rvb, j); + else + rshift(rvb, -j); rve -= j; } *exp = rve; @@ -976,6 +977,16 @@ strtodg Bfree(bs); Bfree(bd0); Bfree(delta); + if (rve > fpi->emax) { + huge: + rvb->wds = 0; + irv = STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi; +#ifndef NO_ERRNO + errno = ERANGE; +#endif + infnanexp: + *exp = fpi->emax + 1; + } ret: if (denorm) { if (sudden_underflow) { diff --git a/contrib/gdtoa/strtodnrp.c b/contrib/gdtoa/strtodnrp.c new file mode 100644 index 000000000000..19a769f0b43c --- /dev/null +++ b/contrib/gdtoa/strtodnrp.c @@ -0,0 +1,87 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 2004 by David M. Gay. +All Rights Reserved +Based on material in the rest of /netlib/fp/gdota.tar.gz, +which is copyright (C) 1998, 2000 by Lucent Technologies. + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* This is a variant of strtod that works on Intel ia32 systems */ +/* with the default extended-precision arithmetic -- it does not */ +/* require setting the precision control to 53 bits. */ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + double +#ifdef KR_headers +strtod(s, sp) CONST char *s; char **sp; +#else +strtod(CONST char *s, char **sp) +#endif +{ + static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; + ULong bits[2]; + Long exp; + int k; + union { ULong L[2]; double d; } u; + + k = strtodg(s, sp, &fpi, &exp, bits); + switch(k & STRTOG_Retmask) { + case STRTOG_NoNumber: + case STRTOG_Zero: + u.L[0] = u.L[1] = 0; + break; + + case STRTOG_Normal: + u.L[_1] = bits[0]; + u.L[_0] = (bits[1] & ~0x100000) | ((exp + 0x3ff + 52) << 20); + break; + + case STRTOG_Denormal: + u.L[_1] = bits[0]; + u.L[_0] = bits[1]; + break; + + case STRTOG_Infinite: + u.L[_0] = 0x7ff00000; + u.L[_1] = 0; + break; + + case STRTOG_NaN: + u.L[0] = d_QNAN0; + u.L[1] = d_QNAN1; + break; + + case STRTOG_NaNbits: + u.L[_0] = 0x7ff00000 | bits[1]; + u.L[_1] = bits[0]; + } + if (k & STRTOG_Neg) + u.L[_0] |= 0x80000000L; + return u.d; + } diff --git a/contrib/gdtoa/strtof.c b/contrib/gdtoa/strtof.c index bb283ae03d6d..21bc6c15bfe7 100644 --- a/contrib/gdtoa/strtof.c +++ b/contrib/gdtoa/strtof.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -44,11 +38,7 @@ strtof(s, sp) CONST char *s; char **sp; strtof(CONST char *s, char **sp) #endif { -#ifdef Sudden_Underflow - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, 1 }; -#else - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, 0 }; -#endif + static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; ULong bits[1]; Long exp; int k; @@ -75,7 +65,7 @@ strtof(CONST char *s, char **sp) break; case STRTOG_NaN: - u.L[0] = 0x7fffffff; + u.L[0] = f_QNAN; } if (k & STRTOG_Neg) u.L[0] |= 0x80000000L; diff --git a/contrib/gdtoa/strtopQ.c b/contrib/gdtoa/strtopQ.c index 4bcc581e7400..dd5dab826c97 100644 --- a/contrib/gdtoa/strtopQ.c +++ b/contrib/gdtoa/strtopQ.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -62,11 +56,7 @@ strtopQ(s, sp, V) CONST char *s; char **sp; void *V; strtopQ(CONST char *s, char **sp, void *V) #endif { -#ifdef Sudden_Underflow - static FPI fpi = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 1 }; -#else - static FPI fpi = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 }; -#endif + static FPI fpi = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, SI }; ULong bits[4]; Long exp; int k; @@ -100,8 +90,10 @@ strtopQ(CONST char *s, char **sp, void *V) break; case STRTOG_NaN: - L[_0] = 0x7fffffff; - L[_1] = L[_2] = L[_3] = (ULong)-1; + L[0] = ld_QNAN0; + L[1] = ld_QNAN1; + L[2] = ld_QNAN2; + L[3] = ld_QNAN3; } if (k & STRTOG_Neg) L[_0] |= 0x80000000L; diff --git a/contrib/gdtoa/strtopd.c b/contrib/gdtoa/strtopd.c index 54e0838a9ac3..42c57fcc1fc5 100644 --- a/contrib/gdtoa/strtopd.c +++ b/contrib/gdtoa/strtopd.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/strtopdd.c b/contrib/gdtoa/strtopdd.c index f71bced1cb91..9b788eecc9aa 100644 --- a/contrib/gdtoa/strtopdd.c +++ b/contrib/gdtoa/strtopdd.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -173,8 +167,8 @@ strtopdd(CONST char *s, char **sp, double *dd) break; case STRTOG_NaN: - u->L[_0] = u->L[2+_0] = 0x7fffffff; - u->L[_1] = u->L[2+_1] = (ULong)-1; + u->L[0] = u->L[2] = d_QNAN0; + u->L[1] = u->L[3] = d_QNAN1; } if (rv & STRTOG_Neg) { u->L[ _0] |= 0x80000000L; diff --git a/contrib/gdtoa/strtopf.c b/contrib/gdtoa/strtopf.c index c49fc96e809a..cc7c970cba4d 100644 --- a/contrib/gdtoa/strtopf.c +++ b/contrib/gdtoa/strtopf.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -44,11 +38,7 @@ strtopf(s, sp, f) CONST char *s; char **sp; float *f; strtopf(CONST char *s, char **sp, float *f) #endif { -#ifdef Sudden_Underflow - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, 1 }; -#else - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, 0 }; -#endif + static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; ULong bits[1], *L; Long exp; int k; @@ -75,7 +65,7 @@ strtopf(CONST char *s, char **sp, float *f) break; case STRTOG_NaN: - L[0] = 0x7fffffff; + L[0] = f_QNAN; } if (k & STRTOG_Neg) L[0] |= 0x80000000L; diff --git a/contrib/gdtoa/strtopx.c b/contrib/gdtoa/strtopx.c index 190b80f78028..4dcb06ae73c9 100644 --- a/contrib/gdtoa/strtopx.c +++ b/contrib/gdtoa/strtopx.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -64,11 +58,7 @@ strtopx(s, sp, V) CONST char *s; char **sp; void *V; strtopx(CONST char *s, char **sp, void *V) #endif { -#ifdef Sudden_Underflow - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 1 }; -#else - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; -#endif + static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; ULong bits[2]; Long exp; int k; @@ -81,14 +71,18 @@ strtopx(CONST char *s, char **sp, void *V) L[0] = L[1] = L[2] = L[3] = L[4] = 0; break; - case STRTOG_Normal: case STRTOG_Denormal: + L[_0] = 0; + goto normal_bits; + + case STRTOG_Normal: case STRTOG_NaNbits: + L[_0] = exp + 0x3fff + 63; + normal_bits: L[_4] = (UShort)bits[0]; L[_3] = (UShort)(bits[0] >> 16); L[_2] = (UShort)bits[1]; L[_1] = (UShort)(bits[1] >> 16); - L[_0] = exp + 0x3fff + 63; break; case STRTOG_Infinite: @@ -97,8 +91,11 @@ strtopx(CONST char *s, char **sp, void *V) break; case STRTOG_NaN: - L[_0] = 0x7fff; - L[_1] = L[_2] = L[_3] = L[_4] = (UShort)-1; + L[0] = ldus_QNAN0; + L[1] = ldus_QNAN1; + L[2] = ldus_QNAN2; + L[3] = ldus_QNAN3; + L[4] = ldus_QNAN4; } if (k & STRTOG_Neg) L[_0] |= 0x8000; diff --git a/contrib/gdtoa/strtopxL.c b/contrib/gdtoa/strtopxL.c index 95fd3d531755..68c83d2bdaea 100644 --- a/contrib/gdtoa/strtopxL.c +++ b/contrib/gdtoa/strtopxL.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -60,11 +54,7 @@ strtopxL(s, sp, V) CONST char *s; char **sp; void *V; strtopxL(CONST char *s, char **sp, void *V) #endif { -#ifdef Sudden_Underflow - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 1 }; -#else - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; -#endif + static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; ULong bits[2]; Long exp; int k; @@ -91,8 +81,9 @@ strtopxL(CONST char *s, char **sp, void *V) break; case STRTOG_NaN: - L[_0] = 0x7fff << 16; - L[_1] = L[_2] = (ULong)-1; + L[0] = ld_QNAN0; + L[1] = ld_QNAN1; + L[2] = ld_QNAN2; } if (k & STRTOG_Neg) L[_0] |= 0x80000000L; diff --git a/contrib/gdtoa/strtorQ.c b/contrib/gdtoa/strtorQ.c index 63a7b6aac305..a9a07da04eaa 100644 --- a/contrib/gdtoa/strtorQ.c +++ b/contrib/gdtoa/strtorQ.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -89,8 +83,10 @@ ULtoQ(ULong *L, ULong *bits, Long exp, int k) break; case STRTOG_NaN: - L[_0] = 0x7fffffff; - L[_1] = L[_2] = L[_3] = (ULong)-1; + L[0] = ld_QNAN0; + L[1] = ld_QNAN1; + L[2] = ld_QNAN2; + L[3] = ld_QNAN3; } if (k & STRTOG_Neg) L[_0] |= 0x80000000L; diff --git a/contrib/gdtoa/strtord.c b/contrib/gdtoa/strtord.c index 12213f93b720..709af4c713f5 100644 --- a/contrib/gdtoa/strtord.c +++ b/contrib/gdtoa/strtord.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -67,8 +61,8 @@ ULtod(ULong *L, ULong *bits, Long exp, int k) break; case STRTOG_NaN: - L[_0] = 0x7fffffff; - L[_1] = (ULong)-1; + L[0] = d_QNAN0; + L[1] = d_QNAN1; } if (k & STRTOG_Neg) L[_0] |= 0x80000000L; diff --git a/contrib/gdtoa/strtordd.c b/contrib/gdtoa/strtordd.c index 626a4d3f5792..9c2b46e65e3e 100644 --- a/contrib/gdtoa/strtordd.c +++ b/contrib/gdtoa/strtordd.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -159,8 +153,8 @@ ULtodd(ULong *L, ULong *bits, Long exp, int k) break; case STRTOG_NaN: - L[_0] = L[2+_0] = 0x7fffffff; - L[_1] = L[2+_1] = (ULong)-1; + L[0] = L[2] = d_QNAN0; + L[1] = L[3] = d_QNAN1; break; case STRTOG_NaNbits: diff --git a/contrib/gdtoa/strtorf.c b/contrib/gdtoa/strtorf.c index ecd1c0b553fa..46b0ba2e4246 100644 --- a/contrib/gdtoa/strtorf.c +++ b/contrib/gdtoa/strtorf.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -64,7 +58,7 @@ ULtof(ULong *L, ULong *bits, Long exp, int k) break; case STRTOG_NaN: - L[0] = 0x7fffffff; + L[0] = f_QNAN; } if (k & STRTOG_Neg) L[0] |= 0x80000000L; diff --git a/contrib/gdtoa/strtorx.c b/contrib/gdtoa/strtorx.c index 0a81e95f5518..23f721aa2931 100644 --- a/contrib/gdtoa/strtorx.c +++ b/contrib/gdtoa/strtorx.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -70,14 +64,18 @@ ULtox(UShort *L, ULong *bits, Long exp, int k) L[0] = L[1] = L[2] = L[3] = L[4] = 0; break; - case STRTOG_Normal: case STRTOG_Denormal: + L[_0] = 0; + goto normal_bits; + + case STRTOG_Normal: case STRTOG_NaNbits: + L[_0] = exp + 0x3fff + 63; + normal_bits: L[_4] = (UShort)bits[0]; L[_3] = (UShort)(bits[0] >> 16); L[_2] = (UShort)bits[1]; L[_1] = (UShort)(bits[1] >> 16); - L[_0] = exp + 0x3fff + 63; break; case STRTOG_Infinite: @@ -86,8 +84,11 @@ ULtox(UShort *L, ULong *bits, Long exp, int k) break; case STRTOG_NaN: - L[_0] = 0x7fff; - L[_1] = L[_2] = L[_3] = L[_4] = (UShort)-1; + L[0] = ldus_QNAN0; + L[1] = ldus_QNAN1; + L[2] = ldus_QNAN2; + L[3] = ldus_QNAN3; + L[4] = ldus_QNAN4; } if (k & STRTOG_Neg) L[_0] |= 0x8000; diff --git a/contrib/gdtoa/strtorxL.c b/contrib/gdtoa/strtorxL.c index 126cef8cfcd0..ff62a61302a5 100644 --- a/contrib/gdtoa/strtorxL.c +++ b/contrib/gdtoa/strtorxL.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" @@ -80,8 +74,9 @@ ULtoxL(ULong *L, ULong *bits, Long exp, int k) break; case STRTOG_NaN: - L[_0] = 0x7fff << 16; - L[_1] = L[_2] = (ULong)-1; + L[0] = ld_QNAN0; + L[1] = ld_QNAN1; + L[2] = ld_QNAN2; } if (k & STRTOG_Neg) L[_0] |= 0x80000000L; diff --git a/contrib/gdtoa/sum.c b/contrib/gdtoa/sum.c index 1e1a4de4cc07..dc0c88bcfab8 100644 --- a/contrib/gdtoa/sum.c +++ b/contrib/gdtoa/sum.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/test/Qtest.c b/contrib/gdtoa/test/Qtest.c index 14e5de795669..f694afb603e1 100644 --- a/contrib/gdtoa/test/Qtest.c +++ b/contrib/gdtoa/test/Qtest.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test program for g_Qfmt, strtoIQ, strtopQ, and strtorQ. * @@ -86,7 +80,7 @@ THIS SOFTWARE. int main(Void) { - char *s, *se, *se1; + char *s, *s1, *se, *se1; int i, dItry, ndig = 0, r = 1; union { long double d; ULong bits[4]; } u, v[2]; @@ -107,8 +101,17 @@ main(Void) } break; /* nan? */ case '#': - sscanf(s+1, "%lx %lx %lx %lx", &u.bits[_0], - &u.bits[_1], &u.bits[_2], &u.bits[_3]); + /* sscanf(s+1, "%lx %lx %lx %lx", &u.bits[_0], */ + /* &u.bits[_1], &u.bits[_2], &u.bits[_3]); */ + u.bits[_0] = (ULong)strtoul(s1 = s+1, &se, 16); + if (se > s1) { + u.bits[_1] = (ULong)strtoul(s1 = se, &se, 16); + if (se > s1) { + u.bits[_2] = (ULong)strtoul(s1 = se, &se, 16); + if (se > s1) + u.bits[_3] = (ULong)strtoul(s1 = se, &se, 16); + } + } printf("\nInput: %s", ibuf); printf(" --> f = #%lx %lx %lx %lx\n", u.bits[_0], u.bits[_1], u.bits[_2], u.bits[_3]); diff --git a/contrib/gdtoa/test/dItest.c b/contrib/gdtoa/test/dItest.c index d9b56d52b606..1724c7153b20 100644 --- a/contrib/gdtoa/test/dItest.c +++ b/contrib/gdtoa/test/dItest.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" #include diff --git a/contrib/gdtoa/test/ddtest.c b/contrib/gdtoa/test/ddtest.c index aa32e92b568f..6fc32511be05 100644 --- a/contrib/gdtoa/test/ddtest.c +++ b/contrib/gdtoa/test/ddtest.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test program for g_ddfmt, strtoIdd, strtopdd, and strtordd. * @@ -73,22 +67,22 @@ dprint(char *what, double d) #endif { char buf[32]; - ULong *L = (ULong*)&d; + union { double d; ULong L[2]; } u; + u.d = d; g_dfmt(buf,&d,0,sizeof(buf)); - printf("%s = %s = #%lx %lx\n", what, buf, U L[_0], U L[_1]); + printf("%s = %s = #%lx %lx\n", what, buf, U u.L[_0], U u.L[_1]); } int main(Void) { - ULong *L; char *s, *s1, *se, *se1; int dItry, i, j, r = 1, ndig = 0; - double dd[2], ddI[4]; + double ddI[4]; long LL[4]; + union { double dd[2]; ULong L[4]; } u; - L = (ULong*)&dd[0]; while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) { while(*s <= ' ') if (!*s++) @@ -106,16 +100,16 @@ main(Void) } break; /* nan? */ case '#': - LL[0] = L[_0]; - LL[1] = L[_1]; - LL[2] = L[2+_0]; - LL[3] = L[2+_1]; + LL[0] = u.L[_0]; + LL[1] = u.L[_1]; + LL[2] = u.L[2+_0]; + LL[3] = u.L[2+_1]; sscanf(s+1, "%lx %lx %lx %lx", &LL[0], &LL[1], &LL[2], &LL[3]); - L[_0] = LL[0]; - L[_1] = LL[1]; - L[2+_0] = LL[2]; - L[2+_1] = LL[3]; + u.L[_0] = LL[0]; + u.L[_1] = LL[1]; + u.L[2+_0] = LL[2]; + u.L[2+_1] = LL[3]; printf("\nInput: %s", ibuf); printf(" --> f = #%lx %lx %lx %lx\n", LL[0],LL[1],LL[2],LL[3]); @@ -126,24 +120,24 @@ main(Void) while(*s1 <= ' ' && *s1) s1++; if (!*s1) { dItry = 1; - i = strtordd(ibuf, &se, r, dd); + i = strtordd(ibuf, &se, r, u.dd); if (r == 1) { j = strtopdd(ibuf, &se1, ddI); - if (i != j || dd[0] != ddI[0] - || dd[1] != ddI[1] || se != se1) + if (i != j || u.dd[0] != ddI[0] + || u.dd[1] != ddI[1] || se != se1) printf("***strtopdd and strtordd disagree!!\n:"); } printf("strtopdd consumes %d bytes and returns %d\n", (int)(se-ibuf), i); } else { - dd[0] = strtod(s, &se); - dd[1] = strtod(se, &se); + u.dd[0] = strtod(s, &se); + u.dd[1] = strtod(se, &se); } fmt_test: - dprint("dd[0]", dd[0]); - dprint("dd[1]", dd[1]); - se = g_ddfmt(obuf, dd, ndig, sizeof(obuf)); + dprint("dd[0]", u.dd[0]); + dprint("dd[1]", u.dd[1]); + se = g_ddfmt(obuf, u.dd, ndig, sizeof(obuf)); printf("g_ddfmt(%d) gives %d bytes: \"%s\"\n\n", ndig, (int)(se-obuf), se ? obuf : ""); if (!dItry) @@ -151,7 +145,7 @@ main(Void) printf("strtoIdd returns %d,", strtoIdd(ibuf, &se, ddI,&ddI[2])); printf(" consuming %d bytes.\n", (int)(se-ibuf)); if (ddI[0] == ddI[2] && ddI[1] == ddI[3]) { - if (ddI[0] == dd[0] && ddI[1] == dd[1]) + if (ddI[0] == u.dd[0] && ddI[1] == u.dd[1]) printf("ddI[0] == ddI[1] == strtopdd\n"); else printf("ddI[0] == ddI[1] = #%lx %lx + %lx %lx\n= %.17g + %17.g\n", @@ -170,9 +164,9 @@ main(Void) U ((ULong*)ddI)[4+_0], U ((ULong*)ddI)[4+_1], U ((ULong*)ddI)[6+_0], U ((ULong*)ddI)[6+_1], ddI[2], ddI[3]); - if (ddI[0] == dd[0] && ddI[1] == dd[1]) + if (ddI[0] == u.dd[0] && ddI[1] == u.dd[1]) printf("ddI[0] == strtod\n"); - else if (ddI[2] == dd[0] && ddI[3] == dd[1]) + else if (ddI[2] == u.dd[0] && ddI[3] == u.dd[1]) printf("ddI[1] == strtod\n"); else printf("**** Both differ from strtopdd ****\n"); diff --git a/contrib/gdtoa/test/dt.c b/contrib/gdtoa/test/dt.c index 1a86ba37cfd0..ed0daeb37e43 100644 --- a/contrib/gdtoa/test/dt.c +++ b/contrib/gdtoa/test/dt.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test program for strtod and dtoa. * @@ -169,7 +163,8 @@ check(double d) double d1; s = dtoa(d, 0, 0, &decpt, &sign, &se); - sprintf(buf, "%s.%se%d", sign ? "-" : "", s, decpt); + sprintf(buf, "%s%s%se%d", sign ? "-" : "", + decpt == 9999 ? "" : ".", s, decpt); errno = 0; d1 = strtod(buf, (char **)0); if (errno) @@ -182,9 +177,10 @@ check(double d) } } + int main(Void){ char buf[2048], buf1[32]; - char *fmt, *s, *se; + char *fmt, *s, *s1, *se; double d, d1; int decpt, sign; int mode = 0, ndigits = 17; @@ -202,7 +198,13 @@ main(Void){ if (*buf == '#') { x = word0(d); y = word1(d); - sscanf(buf+1, "%lx %lx:%d %d", &x, &y, &mode, &ndigits); + /* sscanf(buf+1, "%lx %lx:%d %d", &x, &y, &mode, &ndigits); */ + x = (ULong)strtoul(s1 = buf+1, &se, 16); + if (se > s1) { + y = (ULong)strtoul(s1 = se, &se, 16); + if (se > s1) + sscanf(se, ":%d %d", &mode, &ndigits); + } word0(d) = x; word1(d) = y; fmt = "Output: d =\n%.17g = 0x%lx %lx\n"; diff --git a/contrib/gdtoa/test/dtest.c b/contrib/gdtoa/test/dtest.c index e07b1a8200b3..adcbfd11a228 100644 --- a/contrib/gdtoa/test/dtest.c +++ b/contrib/gdtoa/test/dtest.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test program for g_dfmt, strtoId, strtod, strtopd, and strtord. * @@ -68,13 +62,12 @@ THIS SOFTWARE. int main(Void) { - ULong *L; char *s, *se, *se1; - double f, f1, fI[2]; + double f1, fI[2]; int i, i1, ndig = 0, r = 1; long LL[2]; + union { double f; ULong L[2]; } u; - L = (ULong*)&f; while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) { while(*s <= ' ') if (!*s++) @@ -91,28 +84,28 @@ main(Void) } break; /* nan? */ case '#': - LL[0] = L[_0]; - LL[1] = L[_1]; + LL[0] = u.L[_0]; + LL[1] = u.L[_1]; sscanf(s+1, "%lx %lx", &LL[0], &LL[1]); - L[_0] = LL[0]; - L[_1] = LL[1]; + u.L[_0] = LL[0]; + u.L[_1] = LL[1]; printf("\nInput: %s", ibuf); - printf("--> f = #%lx %lx\n", (long)L[_0], (long)L[_1]); + printf("--> f = #%lx %lx\n", (long)u.L[_0], (long)u.L[_1]); goto fmt_test; } printf("\nInput: %s", ibuf); - i = strtord(ibuf, &se, r, &f); + i = strtord(ibuf, &se, r, &u.f); if (r == 1) { - if ((f != strtod(ibuf, &se1) || se1 != se)) + if ((u.f != strtod(ibuf, &se1) || se1 != se)) printf("***strtod and strtord disagree!!\n"); i1 = strtopd(ibuf, &se, &f1); - if (i != i1 || f != f1 || se != se1) + if (i != i1 || u.f != f1 || se != se1) printf("***strtord and strtopd disagree!!\n"); } printf("strtod consumes %d bytes and returns %d with f = %.17g = #%lx %lx\n", - (int)(se-ibuf), i, f, U L[_0], U L[_1]); + (int)(se-ibuf), i, u.f, U u.L[_0], U u.L[_1]); fmt_test: - se = g_dfmt(obuf, &f, ndig, sizeof(obuf)); + se = g_dfmt(obuf, &u.f, ndig, sizeof(obuf)); printf("g_dfmt(%d) gives %d bytes: \"%s\"\n\n", ndig, (int)(se-obuf), se ? obuf : ""); if (*s == '#') @@ -120,7 +113,7 @@ main(Void) printf("strtoId returns %d,", strtoId(ibuf, &se, fI, &fI[1])); printf(" consuming %d bytes.\n", (int)(se-ibuf)); if (fI[0] == fI[1]) { - if (fI[0] == f) + if (fI[0] == u.f) printf("fI[0] == fI[1] == strtod\n"); else printf("fI[0] == fI[1] = #%lx %lx = %.17g\n", @@ -133,9 +126,9 @@ main(Void) printf("fI[1] = #%lx %lx = %.17g\n", U ((ULong*)&fI[1])[_0], U ((ULong*)&fI[1])[_1], fI[1]); - if (fI[0] == f) + if (fI[0] == u.f) printf("fI[0] == strtod\n"); - else if (fI[1] == f) + else if (fI[1] == u.f) printf("fI[1] == strtod\n"); else printf("**** Both differ from strtod ****\n"); diff --git a/contrib/gdtoa/test/dtst.out b/contrib/gdtoa/test/dtst.out index 1ec70abc882f..7b7a09a60603 100644 --- a/contrib/gdtoa/test/dtst.out +++ b/contrib/gdtoa/test/dtst.out @@ -5,11 +5,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 1, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002 = 0x3ff3ae14 7ae147af: + nextafter(d,+Infinity) = 1.2300000000000002 = 0x3ff3ae14 7ae147af: g_fmt gives "1.2300000000000002" dtoa returns sign = 0, decpt = 1, 17 digits: 12300000000000002 - nextafter(d,-Inf) = 1.2299999999999998 = 0x3ff3ae14 7ae147ad: + nextafter(d,-Infinity) = 1.2299999999999998 = 0x3ff3ae14 7ae147ad: g_fmt gives "1.2299999999999998" dtoa returns sign = 0, decpt = 1, 17 digits: 12299999999999998 @@ -20,11 +20,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 21, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e+20 = 0x441aabdf 2145b431: + nextafter(d,+Infinity) = 1.2300000000000002e+20 = 0x441aabdf 2145b431: g_fmt gives "123000000000000020000" dtoa returns sign = 0, decpt = 21, 17 digits: 12300000000000002 - nextafter(d,-Inf) = 1.2299999999999998e+20 = 0x441aabdf 2145b42f: + nextafter(d,-Infinity) = 1.2299999999999998e+20 = 0x441aabdf 2145b42f: g_fmt gives "122999999999999980000" dtoa returns sign = 0, decpt = 21, 17 digits: 12299999999999998 @@ -35,11 +35,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -19, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e-20 = 0x3bcd0ae4 cf767532: + nextafter(d,+Infinity) = 1.2300000000000002e-20 = 0x3bcd0ae4 cf767532: g_fmt gives "1.2300000000000002e-20" dtoa returns sign = 0, decpt = -19, 17 digits: 12300000000000002 - nextafter(d,-Inf) = 1.2299999999999999e-20 = 0x3bcd0ae4 cf767530: + nextafter(d,-Infinity) = 1.2299999999999999e-20 = 0x3bcd0ae4 cf767530: g_fmt gives "1.2299999999999999e-20" dtoa returns sign = 0, decpt = -19, 17 digits: 12299999999999999 @@ -50,11 +50,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 1, 9 digits: 123456789 - nextafter(d,+Inf) = 1.2345678900000001 = 0x3ff3c0ca 4283de1c: + nextafter(d,+Infinity) = 1.2345678900000001 = 0x3ff3c0ca 4283de1c: g_fmt gives "1.2345678900000001" dtoa returns sign = 0, decpt = 1, 17 digits: 12345678900000001 - nextafter(d,-Inf) = 1.2345678899999997 = 0x3ff3c0ca 4283de1a: + nextafter(d,-Infinity) = 1.2345678899999997 = 0x3ff3c0ca 4283de1a: g_fmt gives "1.2345678899999997" dtoa returns sign = 0, decpt = 1, 17 digits: 12345678899999997 @@ -65,11 +65,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 21, 9 digits: 123456589 - nextafter(d,+Inf) = 1.2345658900000001e+20 = 0x441ac537 a660b998: + nextafter(d,+Infinity) = 1.2345658900000001e+20 = 0x441ac537 a660b998: g_fmt gives "123456589000000010000" dtoa returns sign = 0, decpt = 21, 17 digits: 12345658900000001 - nextafter(d,-Inf) = 1.2345658899999998e+20 = 0x441ac537 a660b996: + nextafter(d,-Infinity) = 1.2345658899999998e+20 = 0x441ac537 a660b996: g_fmt gives "123456588999999980000" dtoa returns sign = 0, decpt = 21, 17 digits: 12345658899999998 @@ -80,11 +80,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 31, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000001e+30 = 0x462f0cb0 4e8fb791: + nextafter(d,+Infinity) = 1.2300000000000001e+30 = 0x462f0cb0 4e8fb791: g_fmt gives "1.2300000000000001e+30" dtoa returns sign = 0, decpt = 31, 17 digits: 12300000000000001 - nextafter(d,-Inf) = 1.2299999999999998e+30 = 0x462f0cb0 4e8fb78f: + nextafter(d,-Infinity) = 1.2299999999999998e+30 = 0x462f0cb0 4e8fb78f: g_fmt gives "1.2299999999999998e+30" dtoa returns sign = 0, decpt = 31, 17 digits: 12299999999999998 @@ -95,11 +95,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -29, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e-30 = 0x39b8f286 6f5010ac: + nextafter(d,+Infinity) = 1.2300000000000002e-30 = 0x39b8f286 6f5010ac: g_fmt gives "1.2300000000000002e-30" dtoa returns sign = 0, decpt = -29, 17 digits: 12300000000000002 - nextafter(d,-Inf) = 1.2299999999999999e-30 = 0x39b8f286 6f5010aa: + nextafter(d,-Infinity) = 1.2299999999999999e-30 = 0x39b8f286 6f5010aa: g_fmt gives "1.2299999999999999e-30" dtoa returns sign = 0, decpt = -29, 17 digits: 12299999999999999 @@ -110,11 +110,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -19, 9 digits: 123456789 - nextafter(d,+Inf) = 1.2345678900000001e-20 = 0x3bcd2681 471e7adb: + nextafter(d,+Infinity) = 1.2345678900000001e-20 = 0x3bcd2681 471e7adb: g_fmt gives "1.2345678900000001e-20" dtoa returns sign = 0, decpt = -19, 17 digits: 12345678900000001 - nextafter(d,-Inf) = 1.2345678899999998e-20 = 0x3bcd2681 471e7ad9: + nextafter(d,-Infinity) = 1.2345678899999998e-20 = 0x3bcd2681 471e7ad9: g_fmt gives "1.2345678899999998e-20" dtoa returns sign = 0, decpt = -19, 17 digits: 12345678899999998 @@ -125,11 +125,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -29, 9 digits: 123456789 - nextafter(d,+Inf) = 1.2345678900000002e-30 = 0x39b90a3e 33bbd996: + nextafter(d,+Infinity) = 1.2345678900000002e-30 = 0x39b90a3e 33bbd996: g_fmt gives "1.2345678900000002e-30" dtoa returns sign = 0, decpt = -29, 17 digits: 12345678900000002 - nextafter(d,-Inf) = 1.2345678899999998e-30 = 0x39b90a3e 33bbd994: + nextafter(d,-Infinity) = 1.2345678899999998e-30 = 0x39b90a3e 33bbd994: g_fmt gives "1.2345678899999998e-30" dtoa returns sign = 0, decpt = -29, 17 digits: 12345678899999998 @@ -140,11 +140,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 1, 17 digits: 12345678901234567 - nextafter(d,+Inf) = 1.2345678901234569 = 0x3ff3c0ca 428c59fc: + nextafter(d,+Infinity) = 1.2345678901234569 = 0x3ff3c0ca 428c59fc: g_fmt gives "1.234567890123457" dtoa returns sign = 0, decpt = 1, 16 digits: 1234567890123457 - nextafter(d,-Inf) = 1.2345678901234565 = 0x3ff3c0ca 428c59fa: + nextafter(d,-Infinity) = 1.2345678901234565 = 0x3ff3c0ca 428c59fa: g_fmt gives "1.2345678901234565" dtoa returns sign = 0, decpt = 1, 17 digits: 12345678901234565 @@ -155,11 +155,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 1, 17 digits: 12345678901234567 - nextafter(d,+Inf) = 1.2345678901234569 = 0x3ff3c0ca 428c59fc: + nextafter(d,+Infinity) = 1.2345678901234569 = 0x3ff3c0ca 428c59fc: g_fmt gives "1.234567890123457" dtoa returns sign = 0, decpt = 1, 16 digits: 1234567890123457 - nextafter(d,-Inf) = 1.2345678901234565 = 0x3ff3c0ca 428c59fa: + nextafter(d,-Infinity) = 1.2345678901234565 = 0x3ff3c0ca 428c59fa: g_fmt gives "1.2345678901234565" dtoa returns sign = 0, decpt = 1, 17 digits: 12345678901234565 @@ -170,11 +170,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 307, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e+306 = 0x7f7c0676 cd1c61f6: + nextafter(d,+Infinity) = 1.2300000000000002e+306 = 0x7f7c0676 cd1c61f6: g_fmt gives "1.2300000000000002e+306" dtoa returns sign = 0, decpt = 307, 17 digits: 12300000000000002 - nextafter(d,-Inf) = 1.2299999999999999e+306 = 0x7f7c0676 cd1c61f4: + nextafter(d,-Infinity) = 1.2299999999999999e+306 = 0x7f7c0676 cd1c61f4: g_fmt gives "1.2299999999999999e+306" dtoa returns sign = 0, decpt = 307, 17 digits: 12299999999999999 @@ -185,11 +185,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -305, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e-306 = 0x6ba3b8 5da396e9: + nextafter(d,+Infinity) = 1.2300000000000002e-306 = 0x6ba3b8 5da396e9: g_fmt gives "1.2300000000000002e-306" dtoa returns sign = 0, decpt = -305, 17 digits: 12300000000000002 - nextafter(d,-Inf) = 1.2299999999999999e-306 = 0x6ba3b8 5da396e7: + nextafter(d,-Infinity) = 1.2299999999999999e-306 = 0x6ba3b8 5da396e7: g_fmt gives "1.2299999999999999e-306" dtoa returns sign = 0, decpt = -305, 17 digits: 12299999999999999 @@ -200,11 +200,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -319, 3 digits: 123 - nextafter(d,+Inf) = 1.2307175237905451e-320 = 0x0 9bb: + nextafter(d,+Infinity) = 1.2307175237905451e-320 = 0x0 9bb: g_fmt gives "1.2307e-320" dtoa returns sign = 0, decpt = -319, 5 digits: 12307 - nextafter(d,-Inf) = 1.2297293924988626e-320 = 0x0 9b9: + nextafter(d,-Infinity) = 1.2297293924988626e-320 = 0x0 9b9: g_fmt gives "1.2297e-320" dtoa returns sign = 0, decpt = -319, 5 digits: 12297 @@ -215,11 +215,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -19, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e-20 = 0x3bcd0ae4 cf767532: + nextafter(d,+Infinity) = 1.2300000000000002e-20 = 0x3bcd0ae4 cf767532: g_fmt gives "1.2300000000000002e-20" dtoa returns sign = 0, decpt = -19, 17 digits: 12300000000000002 - nextafter(d,-Inf) = 1.2299999999999999e-20 = 0x3bcd0ae4 cf767530: + nextafter(d,-Infinity) = 1.2299999999999999e-20 = 0x3bcd0ae4 cf767530: g_fmt gives "1.2299999999999999e-20" dtoa returns sign = 0, decpt = -19, 17 digits: 12299999999999999 @@ -230,11 +230,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 308, 9 digits: 123456789 - nextafter(d,+Inf) = 1.2345678900000003e+307 = 0x7fb194b1 4bdaecdd: + nextafter(d,+Infinity) = 1.2345678900000003e+307 = 0x7fb194b1 4bdaecdd: g_fmt gives "1.2345678900000003e+307" dtoa returns sign = 0, decpt = 308, 17 digits: 12345678900000003 - nextafter(d,-Inf) = 1.2345678899999998e+307 = 0x7fb194b1 4bdaecdb: + nextafter(d,-Infinity) = 1.2345678899999998e+307 = 0x7fb194b1 4bdaecdb: g_fmt gives "1.2345678899999998e+307" dtoa returns sign = 0, decpt = 308, 17 digits: 12345678899999998 @@ -245,11 +245,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -306, 9 digits: 123456589 - nextafter(d,+Inf) = 1.2345658900000001e-307 = 0x363196 bb9845fb: + nextafter(d,+Infinity) = 1.2345658900000001e-307 = 0x363196 bb9845fb: g_fmt gives "1.2345658900000001e-307" dtoa returns sign = 0, decpt = -306, 17 digits: 12345658900000001 - nextafter(d,-Inf) = 1.2345658899999997e-307 = 0x363196 bb9845f9: + nextafter(d,-Infinity) = 1.2345658899999997e-307 = 0x363196 bb9845f9: g_fmt gives "1.2345658899999997e-307" dtoa returns sign = 0, decpt = -306, 17 digits: 12345658899999997 @@ -260,11 +260,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 1, 17 digits: 12345678901234567 - nextafter(d,+Inf) = 1.2345678901234569 = 0x3ff3c0ca 428c59fc: + nextafter(d,+Infinity) = 1.2345678901234569 = 0x3ff3c0ca 428c59fc: g_fmt gives "1.234567890123457" dtoa returns sign = 0, decpt = 1, 16 digits: 1234567890123457 - nextafter(d,-Inf) = 1.2345678901234565 = 0x3ff3c0ca 428c59fa: + nextafter(d,-Infinity) = 1.2345678901234565 = 0x3ff3c0ca 428c59fa: g_fmt gives "1.2345678901234565" dtoa returns sign = 0, decpt = 1, 17 digits: 12345678901234565 @@ -275,11 +275,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 302, 17 digits: 12345678901234568 - nextafter(d,+Inf) = 1.234567890123457e+301 = 0x7e726f51 75f56414: + nextafter(d,+Infinity) = 1.234567890123457e+301 = 0x7e726f51 75f56414: g_fmt gives "1.234567890123457e+301" dtoa returns sign = 0, decpt = 302, 16 digits: 1234567890123457 - nextafter(d,-Inf) = 1.2345678901234565e+301 = 0x7e726f51 75f56412: + nextafter(d,-Infinity) = 1.2345678901234565e+301 = 0x7e726f51 75f56412: g_fmt gives "1.2345678901234565e+301" dtoa returns sign = 0, decpt = 302, 17 digits: 12345678901234565 @@ -290,11 +290,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -300, 17 digits: 12345678901234567 - nextafter(d,+Inf) = 1.2345678901234569e-301 = 0x1752a64 e34ba0d4: + nextafter(d,+Infinity) = 1.2345678901234569e-301 = 0x1752a64 e34ba0d4: g_fmt gives "1.234567890123457e-301" dtoa returns sign = 0, decpt = -300, 16 digits: 1234567890123457 - nextafter(d,-Inf) = 1.2345678901234565e-301 = 0x1752a64 e34ba0d2: + nextafter(d,-Infinity) = 1.2345678901234565e-301 = 0x1752a64 e34ba0d2: g_fmt gives "1.2345678901234565e-301" dtoa returns sign = 0, decpt = -300, 17 digits: 12345678901234565 @@ -305,11 +305,11 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -320, 4 digits: 1235 - nextafter(d,+Inf) = 1.2401047710615288e-321 = 0x0 fb: + nextafter(d,+Infinity) = 1.2401047710615288e-321 = 0x0 fb: g_fmt gives "1.24e-321" dtoa returns sign = 0, decpt = -320, 3 digits: 124 - nextafter(d,-Inf) = 1.2302234581447039e-321 = 0x0 f9: + nextafter(d,-Infinity) = 1.2302234581447039e-321 = 0x0 f9: g_fmt gives "1.23e-321" dtoa returns sign = 0, decpt = -320, 3 digits: 123 @@ -320,17 +320,15 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = 24, 1 digits: 1 - nextafter(d,+Inf) = 1.0000000000000001e+23 = 0x44b52d02 c7e14af7: + nextafter(d,+Infinity) = 1.0000000000000001e+23 = 0x44b52d02 c7e14af7: g_fmt gives "1.0000000000000001e+23" dtoa returns sign = 0, decpt = 24, 17 digits: 10000000000000001 - nextafter(d,-Inf) = 9.9999999999999975e+22 = 0x44b52d02 c7e14af5: + nextafter(d,-Infinity) = 9.9999999999999975e+22 = 0x44b52d02 c7e14af5: g_fmt gives "9.999999999999997e+22" dtoa returns sign = 0, decpt = 23, 16 digits: 9999999999999997 Input: 1e310 - -errno strtod: Result too large Output: d = Infinity = 0x7ff00000 0, se = g_fmt gives "Infinity" @@ -344,7 +342,7 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -276, 16 digits: 9025971879324148 - nextafter(d,+Inf) = 9.0259718793241499e-277 = 0x6a00000 1: + nextafter(d,+Infinity) = 9.0259718793241499e-277 = 0x6a00000 1: g_fmt gives "9.02597187932415e-277" dtoa returns sign = 0, decpt = -276, 15 digits: 902597187932415 @@ -355,7 +353,7 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -276, 16 digits: 9025971879324148 - nextafter(d,+Inf) = 9.0259718793241499e-277 = 0x6a00000 1: + nextafter(d,+Infinity) = 9.0259718793241499e-277 = 0x6a00000 1: g_fmt gives "9.02597187932415e-277" dtoa returns sign = 0, decpt = -276, 15 digits: 902597187932415 @@ -366,7 +364,7 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -276, 16 digits: 9025971879324148 - nextafter(d,+Inf) = 9.0259718793241499e-277 = 0x6a00000 1: + nextafter(d,+Infinity) = 9.0259718793241499e-277 = 0x6a00000 1: g_fmt gives "9.02597187932415e-277" dtoa returns sign = 0, decpt = -276, 15 digits: 902597187932415 @@ -377,7 +375,7 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -307, 17 digits: 22250738585072014 - nextafter(d,+Inf) = 2.2250738585072019e-308 = 0x100000 1: + nextafter(d,+Infinity) = 2.2250738585072019e-308 = 0x100000 1: g_fmt gives "2.225073858507202e-308" dtoa returns sign = 0, decpt = -307, 16 digits: 2225073858507202 @@ -388,7 +386,7 @@ Output: d = dtoa(mode = 0, ndigits = 17): dtoa returns sign = 0, decpt = -307, 17 digits: 22250738585072014 - nextafter(d,+Inf) = 2.2250738585072019e-308 = 0x100000 1: + nextafter(d,+Infinity) = 2.2250738585072019e-308 = 0x100000 1: g_fmt gives "2.225073858507202e-308" dtoa returns sign = 0, decpt = -307, 16 digits: 2225073858507202 @@ -399,11 +397,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = 1, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002 = 0x3ff3ae14 7ae147af: + nextafter(d,+Infinity) = 1.2300000000000002 = 0x3ff3ae14 7ae147af: g_fmt gives "1.2300000000000002" dtoa returns sign = 0, decpt = 1, 3 digits: 123 - nextafter(d,-Inf) = 1.2299999999999998 = 0x3ff3ae14 7ae147ad: + nextafter(d,-Infinity) = 1.2299999999999998 = 0x3ff3ae14 7ae147ad: g_fmt gives "1.2299999999999998" dtoa returns sign = 0, decpt = 1, 3 digits: 123 @@ -414,11 +412,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = 1, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002 = 0x3ff3ae14 7ae147af: + nextafter(d,+Infinity) = 1.2300000000000002 = 0x3ff3ae14 7ae147af: g_fmt gives "1.2300000000000002" dtoa returns sign = 0, decpt = 1, 3 digits: 123 - nextafter(d,-Inf) = 1.2299999999999998 = 0x3ff3ae14 7ae147ad: + nextafter(d,-Infinity) = 1.2299999999999998 = 0x3ff3ae14 7ae147ad: g_fmt gives "1.2299999999999998" dtoa returns sign = 0, decpt = 1, 3 digits: 123 @@ -429,11 +427,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = 21, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e+20 = 0x441aabdf 2145b431: + nextafter(d,+Infinity) = 1.2300000000000002e+20 = 0x441aabdf 2145b431: g_fmt gives "123000000000000020000" dtoa returns sign = 0, decpt = 21, 3 digits: 123 - nextafter(d,-Inf) = 1.2299999999999998e+20 = 0x441aabdf 2145b42f: + nextafter(d,-Infinity) = 1.2299999999999998e+20 = 0x441aabdf 2145b42f: g_fmt gives "122999999999999980000" dtoa returns sign = 0, decpt = 21, 3 digits: 123 @@ -444,11 +442,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = 21, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e+20 = 0x441aabdf 2145b431: + nextafter(d,+Infinity) = 1.2300000000000002e+20 = 0x441aabdf 2145b431: g_fmt gives "123000000000000020000" dtoa returns sign = 0, decpt = 21, 3 digits: 123 - nextafter(d,-Inf) = 1.2299999999999998e+20 = 0x441aabdf 2145b42f: + nextafter(d,-Infinity) = 1.2299999999999998e+20 = 0x441aabdf 2145b42f: g_fmt gives "122999999999999980000" dtoa returns sign = 0, decpt = 21, 3 digits: 123 @@ -459,11 +457,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = -19, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e-20 = 0x3bcd0ae4 cf767532: + nextafter(d,+Infinity) = 1.2300000000000002e-20 = 0x3bcd0ae4 cf767532: g_fmt gives "1.2300000000000002e-20" dtoa returns sign = 0, decpt = -19, 3 digits: 123 - nextafter(d,-Inf) = 1.2299999999999999e-20 = 0x3bcd0ae4 cf767530: + nextafter(d,-Infinity) = 1.2299999999999999e-20 = 0x3bcd0ae4 cf767530: g_fmt gives "1.2299999999999999e-20" dtoa returns sign = 0, decpt = -19, 3 digits: 123 @@ -474,11 +472,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = -19, 3 digits: 123 - nextafter(d,+Inf) = 1.2300000000000002e-20 = 0x3bcd0ae4 cf767532: + nextafter(d,+Infinity) = 1.2300000000000002e-20 = 0x3bcd0ae4 cf767532: g_fmt gives "1.2300000000000002e-20" dtoa returns sign = 0, decpt = -19, 3 digits: 123 - nextafter(d,-Inf) = 1.2299999999999999e-20 = 0x3bcd0ae4 cf767530: + nextafter(d,-Infinity) = 1.2299999999999999e-20 = 0x3bcd0ae4 cf767530: g_fmt gives "1.2299999999999999e-20" dtoa returns sign = 0, decpt = -19, 3 digits: 123 @@ -489,11 +487,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = 1, 6 digits: 123457 - nextafter(d,+Inf) = 1.2345678900000001 = 0x3ff3c0ca 4283de1c: + nextafter(d,+Infinity) = 1.2345678900000001 = 0x3ff3c0ca 4283de1c: g_fmt gives "1.2345678900000001" dtoa returns sign = 0, decpt = 1, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345678899999997 = 0x3ff3c0ca 4283de1a: + nextafter(d,-Infinity) = 1.2345678899999997 = 0x3ff3c0ca 4283de1a: g_fmt gives "1.2345678899999997" dtoa returns sign = 0, decpt = 1, 6 digits: 123457 @@ -504,11 +502,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = 1, 6 digits: 123457 - nextafter(d,+Inf) = 1.2345678900000001 = 0x3ff3c0ca 4283de1c: + nextafter(d,+Infinity) = 1.2345678900000001 = 0x3ff3c0ca 4283de1c: g_fmt gives "1.2345678900000001" dtoa returns sign = 0, decpt = 1, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345678899999997 = 0x3ff3c0ca 4283de1a: + nextafter(d,-Infinity) = 1.2345678899999997 = 0x3ff3c0ca 4283de1a: g_fmt gives "1.2345678899999997" dtoa returns sign = 0, decpt = 1, 6 digits: 123457 @@ -519,11 +517,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = 21, 6 digits: 123457 - nextafter(d,+Inf) = 1.2345658900000001e+20 = 0x441ac537 a660b998: + nextafter(d,+Infinity) = 1.2345658900000001e+20 = 0x441ac537 a660b998: g_fmt gives "123456589000000010000" dtoa returns sign = 0, decpt = 21, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345658899999998e+20 = 0x441ac537 a660b996: + nextafter(d,-Infinity) = 1.2345658899999998e+20 = 0x441ac537 a660b996: g_fmt gives "123456588999999980000" dtoa returns sign = 0, decpt = 21, 6 digits: 123457 @@ -534,11 +532,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = 21, 6 digits: 123457 - nextafter(d,+Inf) = 1.2345658900000001e+20 = 0x441ac537 a660b998: + nextafter(d,+Infinity) = 1.2345658900000001e+20 = 0x441ac537 a660b998: g_fmt gives "123456589000000010000" dtoa returns sign = 0, decpt = 21, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345658899999998e+20 = 0x441ac537 a660b996: + nextafter(d,-Infinity) = 1.2345658899999998e+20 = 0x441ac537 a660b996: g_fmt gives "123456588999999980000" dtoa returns sign = 0, decpt = 21, 6 digits: 123457 @@ -549,11 +547,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = -19, 6 digits: 123457 - nextafter(d,+Inf) = 1.2345678900000001e-20 = 0x3bcd2681 471e7adb: + nextafter(d,+Infinity) = 1.2345678900000001e-20 = 0x3bcd2681 471e7adb: g_fmt gives "1.2345678900000001e-20" dtoa returns sign = 0, decpt = -19, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345678899999998e-20 = 0x3bcd2681 471e7ad9: + nextafter(d,-Infinity) = 1.2345678899999998e-20 = 0x3bcd2681 471e7ad9: g_fmt gives "1.2345678899999998e-20" dtoa returns sign = 0, decpt = -19, 6 digits: 123457 @@ -564,11 +562,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = -19, 6 digits: 123457 - nextafter(d,+Inf) = 1.2345678900000001e-20 = 0x3bcd2681 471e7adb: + nextafter(d,+Infinity) = 1.2345678900000001e-20 = 0x3bcd2681 471e7adb: g_fmt gives "1.2345678900000001e-20" dtoa returns sign = 0, decpt = -19, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345678899999998e-20 = 0x3bcd2681 471e7ad9: + nextafter(d,-Infinity) = 1.2345678899999998e-20 = 0x3bcd2681 471e7ad9: g_fmt gives "1.2345678899999998e-20" dtoa returns sign = 0, decpt = -19, 6 digits: 123457 @@ -579,7 +577,7 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = 7, 6 digits: 123456 - nextafter(d,+Inf) = 1234565.0000000002 = 0x4132d685 1: + nextafter(d,+Infinity) = 1234565.0000000002 = 0x4132d685 1: g_fmt gives "1234565.0000000002" dtoa returns sign = 0, decpt = 7, 6 digits: 123457 @@ -590,7 +588,7 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = 7, 6 digits: 123456 - nextafter(d,+Inf) = 1234565.0000000002 = 0x4132d685 1: + nextafter(d,+Infinity) = 1234565.0000000002 = 0x4132d685 1: g_fmt gives "1234565.0000000002" dtoa returns sign = 0, decpt = 7, 6 digits: 123457 @@ -601,11 +599,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = 1, 6 digits: 123456 - nextafter(d,+Inf) = 1.2345650000000001 = 0x3ff3c0c7 3abc9471: + nextafter(d,+Infinity) = 1.2345650000000001 = 0x3ff3c0c7 3abc9471: g_fmt gives "1.2345650000000001" dtoa returns sign = 0, decpt = 1, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345649999999997 = 0x3ff3c0c7 3abc946f: + nextafter(d,-Infinity) = 1.2345649999999997 = 0x3ff3c0c7 3abc946f: g_fmt gives "1.2345649999999997" dtoa returns sign = 0, decpt = 1, 6 digits: 123456 @@ -616,11 +614,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = 1, 6 digits: 123456 - nextafter(d,+Inf) = 1.2345650000000001 = 0x3ff3c0c7 3abc9471: + nextafter(d,+Infinity) = 1.2345650000000001 = 0x3ff3c0c7 3abc9471: g_fmt gives "1.2345650000000001" dtoa returns sign = 0, decpt = 1, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345649999999997 = 0x3ff3c0c7 3abc946f: + nextafter(d,-Infinity) = 1.2345649999999997 = 0x3ff3c0c7 3abc946f: g_fmt gives "1.2345649999999997" dtoa returns sign = 0, decpt = 1, 6 digits: 123456 @@ -631,11 +629,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = 21, 6 digits: 123456 - nextafter(d,+Inf) = 1.2345650000000002e+20 = 0x441ac536 6299040e: + nextafter(d,+Infinity) = 1.2345650000000002e+20 = 0x441ac536 6299040e: g_fmt gives "123456500000000020000" dtoa returns sign = 0, decpt = 21, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345649999999998e+20 = 0x441ac536 6299040c: + nextafter(d,-Infinity) = 1.2345649999999998e+20 = 0x441ac536 6299040c: g_fmt gives "123456499999999980000" dtoa returns sign = 0, decpt = 21, 6 digits: 123456 @@ -646,11 +644,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = 21, 6 digits: 123456 - nextafter(d,+Inf) = 1.2345650000000002e+20 = 0x441ac536 6299040e: + nextafter(d,+Infinity) = 1.2345650000000002e+20 = 0x441ac536 6299040e: g_fmt gives "123456500000000020000" dtoa returns sign = 0, decpt = 21, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345649999999998e+20 = 0x441ac536 6299040c: + nextafter(d,-Infinity) = 1.2345649999999998e+20 = 0x441ac536 6299040c: g_fmt gives "123456499999999980000" dtoa returns sign = 0, decpt = 21, 6 digits: 123456 @@ -661,11 +659,11 @@ Output: d = dtoa(mode = 2, ndigits = 6): dtoa returns sign = 0, decpt = -19, 6 digits: 123456 - nextafter(d,+Inf) = 1.2345650000000001e-20 = 0x3bcd267c ce45a940: + nextafter(d,+Infinity) = 1.2345650000000001e-20 = 0x3bcd267c ce45a940: g_fmt gives "1.2345650000000001e-20" dtoa returns sign = 0, decpt = -19, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345649999999998e-20 = 0x3bcd267c ce45a93e: + nextafter(d,-Infinity) = 1.2345649999999998e-20 = 0x3bcd267c ce45a93e: g_fmt gives "1.2345649999999998e-20" dtoa returns sign = 0, decpt = -19, 6 digits: 123456 @@ -676,11 +674,11 @@ Output: d = dtoa(mode = 4, ndigits = 6): dtoa returns sign = 0, decpt = -19, 6 digits: 123456 - nextafter(d,+Inf) = 1.2345650000000001e-20 = 0x3bcd267c ce45a940: + nextafter(d,+Infinity) = 1.2345650000000001e-20 = 0x3bcd267c ce45a940: g_fmt gives "1.2345650000000001e-20" dtoa returns sign = 0, decpt = -19, 6 digits: 123457 - nextafter(d,-Inf) = 1.2345649999999998e-20 = 0x3bcd267c ce45a93e: + nextafter(d,-Infinity) = 1.2345649999999998e-20 = 0x3bcd267c ce45a93e: g_fmt gives "1.2345649999999998e-20" dtoa returns sign = 0, decpt = -19, 6 digits: 123456 diff --git a/contrib/gdtoa/test/ftest.c b/contrib/gdtoa/test/ftest.c index afafe858523c..9f6e144ae7b6 100644 --- a/contrib/gdtoa/test/ftest.c +++ b/contrib/gdtoa/test/ftest.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test program for g_ffmt, strtof, strtoIf, strtopf, and strtorf. * @@ -67,12 +61,11 @@ THIS SOFTWARE. int main(Void) { - ULong *L; char *s, *se, *se1; int dItry, i, i1, ndig = 0, r = 1; - float f, f1, fI[2]; + float f1, fI[2]; + union { float f; ULong L[1]; } u; - L = (ULong*)&f; while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) { while(*s <= ' ') if (!*s++) @@ -90,32 +83,33 @@ main(Void) } break; /* nan? */ case '#': - sscanf(s+1, "%lx", &L[0]); + /* sscanf(s+1, "%lx", &u.L[0]); */ + u.L[0] = (ULong)strtoul(s+1, &se, 16); printf("\nInput: %s", ibuf); - printf(" --> f = #%lx\n", L[0]); + printf(" --> f = #%lx\n", U u.L[0]); goto fmt_test; } dItry = 1; printf("\nInput: %s", ibuf); - i = strtorf(ibuf, &se, r, &f); + i = strtorf(ibuf, &se, r, &u.f); if (r == 1) { - if (f != (i1 = strtopf(ibuf, &se1, &f1), f1) + if (u.f != (i1 = strtopf(ibuf, &se1, &f1), f1) || se != se1 || i != i1) { printf("***strtopf and strtorf disagree!!\n"); - if (f != f1) + if (u.f != f1) printf("\tf1 = %g\n", (double)f1); if (i != i1) printf("\ti = %d but i1 = %d\n", i, i1); if (se != se1) printf("se - se1 = %d\n", (int)(se-se1)); } - if (f != strtof(ibuf, &se1) || se != se1) + if (u.f != strtof(ibuf, &se1) || se != se1) printf("***strtof and strtorf disagree!\n"); } printf("strtof consumes %d bytes and returns %.8g = #%lx\n", - (int)(se-ibuf), f, U *(ULong*)&f); + (int)(se-ibuf), u.f, U u.L[0]); fmt_test: - se = g_ffmt(obuf, &f, ndig, sizeof(obuf)); + se = g_ffmt(obuf, &u.f, ndig, sizeof(obuf)); printf("g_ffmt(%d) gives %d bytes: \"%s\"\n\n", ndig, (int)(se-obuf), se ? obuf : ""); if (!dItry) @@ -123,7 +117,7 @@ main(Void) printf("strtoIf returns %d,", strtoIf(ibuf, &se, fI, &fI[1])); printf(" consuming %d bytes.\n", (int)(se-ibuf)); if (fI[0] == fI[1]) { - if (fI[0] == f) + if (fI[0] == u.f) printf("fI[0] == fI[1] == strtof\n"); else printf("fI[0] == fI[1] = #%lx = %.8g\n", @@ -133,9 +127,9 @@ main(Void) printf("fI[0] = #%lx = %.8g\nfI[1] = #%lx = %.8g\n", U *(ULong*)fI, fI[0], U *(ULong*)&fI[1], fI[1]); - if (fI[0] == f) + if (fI[0] == u.f) printf("fI[0] == strtof\n"); - else if (fI[1] == f) + else if (fI[1] == u.f) printf("fI[1] == strtof\n"); else printf("**** Both differ from strtof ****\n"); diff --git a/contrib/gdtoa/test/getround.c b/contrib/gdtoa/test/getround.c index ec1ca116e934..1754fb3e72de 100644 --- a/contrib/gdtoa/test/getround.c +++ b/contrib/gdtoa/test/getround.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include #include diff --git a/contrib/gdtoa/test/makefile b/contrib/gdtoa/test/makefile index 7e48915316fd..156eae22551d 100644 --- a/contrib/gdtoa/test/makefile +++ b/contrib/gdtoa/test/makefile @@ -27,6 +27,8 @@ CC = cc CFLAGS = -g -I.. A = ../gdtoa.a +L = -lm +INFFIX = | sed 's/[Ii][Nn][Ff][intyINTY]*/Infinity/g' .c.o: $(CC) -c $(CFLAGS) $*.c @@ -35,7 +37,7 @@ all: dt dItest ddtest dtest ftest Qtest xLtest xtest ddtestsi dItestsi tests dt = dt.o $A dt: $(dt) - $(CC) -o dt $(dt) + $(CC) -o dt $(dt) $L dItest = dItest.o getround.o $A dItest: $(dItest) @@ -43,11 +45,11 @@ dItest: $(dItest) ddtest = ddtest.o getround.o $A ddtest: $(ddtest) - $(CC) -o ddtest $(ddtest) + $(CC) -o ddtest $(ddtest) $L dtest = dtest.o getround.o $A dtest: $(dtest) - $(CC) -o dtest $(dtest) + $(CC) -o dtest $(dtest) $L ftest = ftest.o getround.o $A ftest: $(ftest) @@ -77,7 +79,7 @@ strtoIdSI.o: strtoIdSI.c ../strtoId.c ddtestsi = ddtest.o strtopddSI.o strtorddSI.o strtoIddSI.o getround.o $A ddtestsi: $(ddtestsi) - $(CC) -o ddtestsi $(ddtestsi) + $(CC) -o ddtestsi $(ddtestsi) $L dItestsi = dItest.o strtodISI.o strtoIdSI.o getround.o $A dItestsi: $(dItestsi) @@ -85,7 +87,18 @@ dItestsi: $(dItestsi) strtodt = strtodt.o $A strtodt: $(strtodt) - $(CC) -o strtodt $(strtodt) + $(CC) -o strtodt $(strtodt) $L + +## On Intel (and Intel-like) systems using extended-precision registers +## for double-precision (C type double) computations that sometimes suffer +## double rounding errors, the test below involving strtodt generally shows +## five lines of unexpected results. Variant strtodtnrp uses ../strtodrnp.c +## (which does all computations in integer arithmetic) and should show no +## unexpected results. + +strtodtnrp = strtodt.o ../strtodnrp.c $A +strtodtnrp: $(strtodtnrp) + $(CC) -o strtodtnrp $(strtodtnrp) # xQtest generates cp commands that depend on sizeof(long double). # See the source for details. If you know better, create Q.out, @@ -102,21 +115,23 @@ Q.out x.out xL.out: ## The rmdir below will fail if any test results differ. -tests: Q.out x.out xL.out dt dItest ddtest dtest ftest Qtest xLtest xtest ddtestsi dItestsi strtodt +tests: Q.out x.out xL.out dt dItest ddtest dtest ftest Qtest xLtest xtest ddtestsi dItestsi strtodt strtodtnrp mkdir bad - cat testnos testnos1 | ./dt >zap 2>&1 + cat testnos testnos1 | ./dt $(INFFIX) >zap 2>&1 cmp dtst.out zap || mv zap bad/dtst.out - ./dItest zap 2>&1 + ./dItest zap 2>&1 cmp dI.out zap || mv zap bad/dI.out - ./dItestsi zap 2>&1 + ./dItestsi zap 2>&1 cmp dIsi.out zap || mv zap bad/dIsi.out - ./ddtestsi zap 2>&1 + ./ddtestsi zap 2>&1 cmp ddsi.out zap || mv zap bad/ddsi.out for i in dd d f x xL Q; do cat testnos rtestnos | \ - ./"$$i"test >zap 2>&1;\ + ./"$$i"test $(INFFIX) >zap 2>&1;\ cmp $$i.out zap || mv zap bad/$$i.out; done ./strtodt testnos3 >bad/strtodt.out && rm bad/strtodt.out || \ cat bad/strtodt.out + ./strtodtnrp testnos3 >bad/strtodtnrp.out && rm bad/strtodtnrp.out || \ + cat bad/strtodtnrp.out rmdir bad touch tests @@ -131,5 +146,5 @@ xsum.out: xsum0.out $(xs0) cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out clean: - rm -f *.[ao] dt *test *testsi strtodt xsum.out xsum1.out tests zap x.out xL.out Q.out + rm -f *.[ao] dt *test *testsi strtodt strtodtnrp xsum.out xsum1.out tests zap x.out xL.out Q.out rm -rf bad diff --git a/contrib/gdtoa/test/strtodt.c b/contrib/gdtoa/test/strtodt.c index da746606972b..94c70213c211 100644 --- a/contrib/gdtoa/test/strtodt.c +++ b/contrib/gdtoa/test/strtodt.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test strtod. */ @@ -44,6 +38,7 @@ THIS SOFTWARE. * Complain about errors. */ +#include "gdtoa.h" /* for ULong */ #include #include #include @@ -51,7 +46,7 @@ THIS SOFTWARE. static int W0, W1; typedef union { double d; - long L[2]; + ULong L[2]; } U; static int @@ -59,8 +54,7 @@ process(char *fname, FILE *f) { U a, b; char buf[2048]; - double d; - char *s; + char *s, *s1, *se; int line, n; line = n = 0; @@ -75,7 +69,9 @@ process(char *fname, FILE *f) continue; while(*s > ' ') s++; - if (sscanf(s,"\t%lx\t%lx", &a.L[0], &a.L[1]) != 2) { + /* if (sscanf(s,"\t%lx\t%lx", &a.L[0], &a.L[1]) != 2) */ + if ((a.L[0] = (ULong)strtoul(s, &s1,16), s1 <= s) + || (a.L[1] = (ULong)strtoul(s1,&se,16), se <= s1)) { printf("Badly formatted line %d of %s\n", line, fname); n++; diff --git a/contrib/gdtoa/test/x.ou0 b/contrib/gdtoa/test/x.ou0 index 83daa47f9cb1..6421bc7a148a 100644 --- a/contrib/gdtoa/test/x.ou0 +++ b/contrib/gdtoa/test/x.ou0 @@ -7,7 +7,7 @@ g_xfmt(0) gives 4 bytes: "1.23" strtoIx returns 33, consuming 4 bytes. fI[0] = #3fff 9d70 a3d7 a3d 70a3 -fI[1] = #3fff 9d70 a3d7 a3d 70a3 +fI[1] = #3fff 9d70 a3d7 a3d 70a4 fI[1] == strtox @@ -29,7 +29,7 @@ g_xfmt(0) gives 8 bytes: "1.23e-20" strtoIx returns 17, consuming 8 bytes. fI[0] = #3fbc e857 267b b3a9 84f2 -fI[1] = #3fbc e857 267b b3a9 84f2 +fI[1] = #3fbc e857 267b b3a9 84f3 fI[0] == strtox @@ -41,7 +41,7 @@ g_xfmt(0) gives 10 bytes: "1.23456789" strtoIx returns 33, consuming 10 bytes. fI[0] = #3fff 9e06 5214 1ef0 dbf5 -fI[1] = #3fff 9e06 5214 1ef0 dbf5 +fI[1] = #3fff 9e06 5214 1ef0 dbf6 fI[1] == strtox @@ -63,7 +63,7 @@ g_xfmt(0) gives 8 bytes: "1.23e+30" strtoIx returns 17, consuming 8 bytes. fI[0] = #4062 f865 8274 7dbc 824a -fI[1] = #4062 f865 8274 7dbc 824a +fI[1] = #4062 f865 8274 7dbc 824b fI[0] == strtox @@ -75,7 +75,7 @@ g_xfmt(0) gives 8 bytes: "1.23e-30" strtoIx returns 17, consuming 8 bytes. fI[0] = #3f9b c794 337a 8085 54eb -fI[1] = #3f9b c794 337a 8085 54eb +fI[1] = #3f9b c794 337a 8085 54ec fI[0] == strtox @@ -87,7 +87,7 @@ g_xfmt(0) gives 14 bytes: "1.23456789e-20" strtoIx returns 17, consuming 14 bytes. fI[0] = #3fbc e934 a38 f3d6 d352 -fI[1] = #3fbc e934 a38 f3d6 d352 +fI[1] = #3fbc e934 a38 f3d6 d353 fI[0] == strtox @@ -99,7 +99,7 @@ g_xfmt(0) gives 14 bytes: "1.23456789e-30" strtoIx returns 17, consuming 14 bytes. fI[0] = #3f9b c851 f19d decc a8fc -fI[1] = #3f9b c851 f19d decc a8fc +fI[1] = #3f9b c851 f19d decc a8fd fI[0] == strtox @@ -111,7 +111,7 @@ g_xfmt(0) gives 20 bytes: "1.234567890123456789" strtoIx returns 17, consuming 20 bytes. fI[0] = #3fff 9e06 5214 62cf db8d -fI[1] = #3fff 9e06 5214 62cf db8d +fI[1] = #3fff 9e06 5214 62cf db8e fI[0] == strtox @@ -123,7 +123,7 @@ g_xfmt(0) gives 20 bytes: "1.234567890123456789" strtoIx returns 17, consuming 40 bytes. fI[0] = #3fff 9e06 5214 62cf db8d -fI[1] = #3fff 9e06 5214 62cf db8d +fI[1] = #3fff 9e06 5214 62cf db8e fI[0] == strtox @@ -135,7 +135,7 @@ g_xfmt(0) gives 9 bytes: "1.23e+306" strtoIx returns 17, consuming 8 bytes. fI[0] = #43f7 e033 b668 e30f a6d5 -fI[1] = #43f7 e033 b668 e30f a6d5 +fI[1] = #43f7 e033 b668 e30f a6d6 fI[0] == strtox @@ -147,7 +147,7 @@ g_xfmt(0) gives 9 bytes: "1.23e-306" strtoIx returns 33, consuming 9 bytes. fI[0] = #3c06 dd1d c2ed 1cb7 3f24 -fI[1] = #3c06 dd1d c2ed 1cb7 3f24 +fI[1] = #3c06 dd1d c2ed 1cb7 3f25 fI[1] == strtox @@ -159,7 +159,7 @@ g_xfmt(0) gives 9 bytes: "1.23e-320" strtoIx returns 33, consuming 9 bytes. fI[0] = #3bd8 9b98 c371 844c 3f19 -fI[1] = #3bd8 9b98 c371 844c 3f19 +fI[1] = #3bd8 9b98 c371 844c 3f1a fI[1] == strtox @@ -171,7 +171,7 @@ g_xfmt(0) gives 8 bytes: "1.23e-20" strtoIx returns 17, consuming 8 bytes. fI[0] = #3fbc e857 267b b3a9 84f2 -fI[1] = #3fbc e857 267b b3a9 84f2 +fI[1] = #3fbc e857 267b b3a9 84f3 fI[0] == strtox @@ -183,7 +183,7 @@ g_xfmt(0) gives 15 bytes: "1.23456789e+307" strtoIx returns 17, consuming 14 bytes. fI[0] = #43fb 8ca5 8a5e d766 de75 -fI[1] = #43fb 8ca5 8a5e d766 de75 +fI[1] = #43fb 8ca5 8a5e d766 de76 fI[0] == strtox @@ -195,7 +195,7 @@ g_xfmt(0) gives 15 bytes: "1.23456589e-307" strtoIx returns 17, consuming 15 bytes. fI[0] = #3c03 b18c b5dc c22f d369 -fI[1] = #3c03 b18c b5dc c22f d369 +fI[1] = #3c03 b18c b5dc c22f d36a fI[0] == strtox @@ -207,7 +207,7 @@ g_xfmt(0) gives 20 bytes: "1.234567890123456789" strtoIx returns 17, consuming 20 bytes. fI[0] = #3fff 9e06 5214 62cf db8d -fI[1] = #3fff 9e06 5214 62cf db8d +fI[1] = #3fff 9e06 5214 62cf db8e fI[0] == strtox @@ -219,7 +219,7 @@ g_xfmt(0) gives 25 bytes: "1.234567890123456789e+301" strtoIx returns 33, consuming 24 bytes. fI[0] = #43e7 937a 8baf ab20 980b -fI[1] = #43e7 937a 8baf ab20 980b +fI[1] = #43e7 937a 8baf ab20 980c fI[1] == strtox @@ -231,7 +231,7 @@ g_xfmt(0) gives 25 bytes: "1.234567890123456789e-301" strtoIx returns 33, consuming 25 bytes. fI[0] = #3c17 a953 271a 5d06 9ad8 -fI[1] = #3c17 a953 271a 5d06 9ad8 +fI[1] = #3c17 a953 271a 5d06 9ad9 fI[1] == strtox @@ -243,7 +243,7 @@ g_xfmt(0) gives 25 bytes: "1.234567890123456789e-321" strtoIx returns 33, consuming 25 bytes. fI[0] = #3bd4 f9e1 1b4c ea6d cce8 -fI[1] = #3bd4 f9e1 1b4c ea6d cce8 +fI[1] = #3bd4 f9e1 1b4c ea6d cce9 fI[1] == strtox @@ -265,7 +265,7 @@ g_xfmt(0) gives 6 bytes: "1e+310" strtoIx returns 33, consuming 5 bytes. fI[0] = #4404 de81 e40a 34b cf4f -fI[1] = #4404 de81 e40a 34b cf4f +fI[1] = #4404 de81 e40a 34b cf50 fI[1] == strtox @@ -277,7 +277,7 @@ g_xfmt(0) gives 23 bytes: "9.0259718793241475e-277" strtoIx returns 33, consuming 23 bytes. fI[0] = #3c69 ffff ffff ffff fcf6 -fI[1] = #3c69 ffff ffff ffff fcf6 +fI[1] = #3c69 ffff ffff ffff fcf7 fI[1] == strtox @@ -289,7 +289,7 @@ g_xfmt(0) gives 26 bytes: "9.0259718793241478803e-277" strtoIx returns 17, consuming 37 bytes. fI[0] = #3c6a 8000 0 0 0 -fI[1] = #3c6a 8000 0 0 0 +fI[1] = #3c6a 8000 0 0 1 fI[0] == strtox @@ -301,7 +301,7 @@ g_xfmt(0) gives 26 bytes: "9.0259718793241478803e-277" strtoIx returns 33, consuming 37 bytes. fI[0] = #3c69 ffff ffff ffff ffff -fI[1] = #3c6a 8000 0 ffff ffff +fI[1] = #3c6a 8000 0 0 0 fI[1] == strtox @@ -313,7 +313,7 @@ g_xfmt(0) gives 23 bytes: "2.2250738585072014e-308" strtoIx returns 17, consuming 23 bytes. fI[0] = #3c01 8000 0 0 46 -fI[1] = #3c01 8000 0 0 46 +fI[1] = #3c01 8000 0 0 47 fI[0] == strtox @@ -325,7 +325,7 @@ g_xfmt(0) gives 23 bytes: "2.2250738585072013e-308" strtoIx returns 17, consuming 23 bytes. fI[0] = #3c00 ffff ffff ffff fd4f -fI[1] = #3c00 ffff ffff ffff fd4f +fI[1] = #3c00 ffff ffff ffff fd50 fI[0] == strtox Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) @@ -338,7 +338,7 @@ g_xfmt(0) gives 21 bytes: "1.0999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 8ccc cccc cccc cccc -fI[1] = #3fff 8ccc cccc cccc cccc +fI[1] = #3fff 8ccc cccc cccc cccd fI[0] == strtox @@ -350,7 +350,7 @@ g_xfmt(0) gives 22 bytes: "-1.0999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 8ccc cccc cccc cccd -fI[1] = #bfff 8ccc cccc cccc cccd +fI[1] = #bfff 8ccc cccc cccc cccc fI[1] == strtox @@ -362,7 +362,7 @@ g_xfmt(0) gives 21 bytes: "1.1999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 9999 9999 9999 9999 -fI[1] = #3fff 9999 9999 9999 9999 +fI[1] = #3fff 9999 9999 9999 999a fI[0] == strtox @@ -374,7 +374,7 @@ g_xfmt(0) gives 22 bytes: "-1.1999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 9999 9999 9999 999a -fI[1] = #bfff 9999 9999 9999 999a +fI[1] = #bfff 9999 9999 9999 9999 fI[1] == strtox @@ -386,7 +386,7 @@ g_xfmt(0) gives 3 bytes: "1.3" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff a666 6666 6666 6666 -fI[1] = #3fff a666 6666 6666 6666 +fI[1] = #3fff a666 6666 6666 6667 fI[0] == strtox @@ -398,7 +398,7 @@ g_xfmt(0) gives 4 bytes: "-1.3" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff a666 6666 6666 6667 -fI[1] = #bfff a666 6666 6666 6667 +fI[1] = #bfff a666 6666 6666 6666 fI[1] == strtox @@ -410,7 +410,7 @@ g_xfmt(0) gives 3 bytes: "1.4" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff b333 3333 3333 3333 -fI[1] = #3fff b333 3333 3333 3333 +fI[1] = #3fff b333 3333 3333 3334 fI[0] == strtox @@ -422,7 +422,7 @@ g_xfmt(0) gives 4 bytes: "-1.4" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff b333 3333 3333 3334 -fI[1] = #bfff b333 3333 3333 3334 +fI[1] = #bfff b333 3333 3333 3333 fI[1] == strtox @@ -454,7 +454,7 @@ g_xfmt(0) gives 21 bytes: "1.5999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff cccc cccc cccc cccc -fI[1] = #3fff cccc cccc cccc cccc +fI[1] = #3fff cccc cccc cccc cccd fI[0] == strtox @@ -466,7 +466,7 @@ g_xfmt(0) gives 22 bytes: "-1.5999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff cccc cccc cccc cccd -fI[1] = #bfff cccc cccc cccc cccd +fI[1] = #bfff cccc cccc cccc cccc fI[1] == strtox @@ -478,7 +478,7 @@ g_xfmt(0) gives 21 bytes: "1.6999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff d999 9999 9999 9999 -fI[1] = #3fff d999 9999 9999 9999 +fI[1] = #3fff d999 9999 9999 999a fI[0] == strtox @@ -490,7 +490,7 @@ g_xfmt(0) gives 22 bytes: "-1.6999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff d999 9999 9999 999a -fI[1] = #bfff d999 9999 9999 999a +fI[1] = #bfff d999 9999 9999 9999 fI[1] == strtox @@ -502,7 +502,7 @@ g_xfmt(0) gives 3 bytes: "1.8" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff e666 6666 6666 6666 -fI[1] = #3fff e666 6666 6666 6666 +fI[1] = #3fff e666 6666 6666 6667 fI[0] == strtox @@ -514,7 +514,7 @@ g_xfmt(0) gives 4 bytes: "-1.8" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff e666 6666 6666 6667 -fI[1] = #bfff e666 6666 6666 6667 +fI[1] = #bfff e666 6666 6666 6666 fI[1] == strtox @@ -526,7 +526,7 @@ g_xfmt(0) gives 3 bytes: "1.9" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff f333 3333 3333 3333 -fI[1] = #3fff f333 3333 3333 3333 +fI[1] = #3fff f333 3333 3333 3334 fI[0] == strtox @@ -538,7 +538,7 @@ g_xfmt(0) gives 4 bytes: "-1.9" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff f333 3333 3333 3334 -fI[1] = #bfff f333 3333 3333 3334 +fI[1] = #bfff f333 3333 3333 3333 fI[1] == strtox Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) @@ -551,7 +551,7 @@ g_xfmt(0) gives 3 bytes: "1.1" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 8ccc cccc cccc cccc -fI[1] = #3fff 8ccc cccc cccc cccc +fI[1] = #3fff 8ccc cccc cccc cccd fI[1] == strtox @@ -563,7 +563,7 @@ g_xfmt(0) gives 4 bytes: "-1.1" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 8ccc cccc cccc cccd -fI[1] = #bfff 8ccc cccc cccc cccd +fI[1] = #bfff 8ccc cccc cccc cccc fI[0] == strtox @@ -575,7 +575,7 @@ g_xfmt(0) gives 3 bytes: "1.2" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 9999 9999 9999 9999 -fI[1] = #3fff 9999 9999 9999 9999 +fI[1] = #3fff 9999 9999 9999 999a fI[1] == strtox @@ -587,7 +587,7 @@ g_xfmt(0) gives 4 bytes: "-1.2" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 9999 9999 9999 999a -fI[1] = #bfff 9999 9999 9999 999a +fI[1] = #bfff 9999 9999 9999 9999 fI[0] == strtox @@ -599,7 +599,7 @@ g_xfmt(0) gives 3 bytes: "1.3" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff a666 6666 6666 6666 -fI[1] = #3fff a666 6666 6666 6666 +fI[1] = #3fff a666 6666 6666 6667 fI[0] == strtox @@ -611,7 +611,7 @@ g_xfmt(0) gives 4 bytes: "-1.3" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff a666 6666 6666 6667 -fI[1] = #bfff a666 6666 6666 6667 +fI[1] = #bfff a666 6666 6666 6666 fI[1] == strtox @@ -623,7 +623,7 @@ g_xfmt(0) gives 3 bytes: "1.4" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff b333 3333 3333 3333 -fI[1] = #3fff b333 3333 3333 3333 +fI[1] = #3fff b333 3333 3333 3334 fI[0] == strtox @@ -635,7 +635,7 @@ g_xfmt(0) gives 4 bytes: "-1.4" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff b333 3333 3333 3334 -fI[1] = #bfff b333 3333 3333 3334 +fI[1] = #bfff b333 3333 3333 3333 fI[1] == strtox @@ -667,7 +667,7 @@ g_xfmt(0) gives 3 bytes: "1.6" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff cccc cccc cccc cccc -fI[1] = #3fff cccc cccc cccc cccc +fI[1] = #3fff cccc cccc cccc cccd fI[1] == strtox @@ -679,7 +679,7 @@ g_xfmt(0) gives 4 bytes: "-1.6" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff cccc cccc cccc cccd -fI[1] = #bfff cccc cccc cccc cccd +fI[1] = #bfff cccc cccc cccc cccc fI[0] == strtox @@ -691,7 +691,7 @@ g_xfmt(0) gives 3 bytes: "1.7" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff d999 9999 9999 9999 -fI[1] = #3fff d999 9999 9999 9999 +fI[1] = #3fff d999 9999 9999 999a fI[1] == strtox @@ -703,7 +703,7 @@ g_xfmt(0) gives 4 bytes: "-1.7" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff d999 9999 9999 999a -fI[1] = #bfff d999 9999 9999 999a +fI[1] = #bfff d999 9999 9999 9999 fI[0] == strtox @@ -715,7 +715,7 @@ g_xfmt(0) gives 3 bytes: "1.8" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff e666 6666 6666 6666 -fI[1] = #3fff e666 6666 6666 6666 +fI[1] = #3fff e666 6666 6666 6667 fI[0] == strtox @@ -727,7 +727,7 @@ g_xfmt(0) gives 4 bytes: "-1.8" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff e666 6666 6666 6667 -fI[1] = #bfff e666 6666 6666 6667 +fI[1] = #bfff e666 6666 6666 6666 fI[1] == strtox @@ -739,7 +739,7 @@ g_xfmt(0) gives 3 bytes: "1.9" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff f333 3333 3333 3333 -fI[1] = #3fff f333 3333 3333 3333 +fI[1] = #3fff f333 3333 3333 3334 fI[0] == strtox @@ -751,7 +751,7 @@ g_xfmt(0) gives 4 bytes: "-1.9" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff f333 3333 3333 3334 -fI[1] = #bfff f333 3333 3333 3334 +fI[1] = #bfff f333 3333 3333 3333 fI[1] == strtox Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) @@ -764,7 +764,7 @@ g_xfmt(0) gives 3 bytes: "1.1" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 8ccc cccc cccc cccc -fI[1] = #3fff 8ccc cccc cccc cccc +fI[1] = #3fff 8ccc cccc cccc cccd fI[1] == strtox @@ -776,7 +776,7 @@ g_xfmt(0) gives 22 bytes: "-1.0999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 8ccc cccc cccc cccd -fI[1] = #bfff 8ccc cccc cccc cccd +fI[1] = #bfff 8ccc cccc cccc cccc fI[1] == strtox @@ -788,7 +788,7 @@ g_xfmt(0) gives 3 bytes: "1.2" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 9999 9999 9999 9999 -fI[1] = #3fff 9999 9999 9999 9999 +fI[1] = #3fff 9999 9999 9999 999a fI[1] == strtox @@ -800,7 +800,7 @@ g_xfmt(0) gives 22 bytes: "-1.1999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 9999 9999 9999 999a -fI[1] = #bfff 9999 9999 9999 999a +fI[1] = #bfff 9999 9999 9999 9999 fI[1] == strtox @@ -812,7 +812,7 @@ g_xfmt(0) gives 21 bytes: "1.3000000000000000001" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff a666 6666 6666 6666 -fI[1] = #3fff a666 6666 6666 6666 +fI[1] = #3fff a666 6666 6666 6667 fI[1] == strtox @@ -824,7 +824,7 @@ g_xfmt(0) gives 4 bytes: "-1.3" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff a666 6666 6666 6667 -fI[1] = #bfff a666 6666 6666 6667 +fI[1] = #bfff a666 6666 6666 6666 fI[1] == strtox @@ -836,7 +836,7 @@ g_xfmt(0) gives 21 bytes: "1.4000000000000000001" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff b333 3333 3333 3333 -fI[1] = #3fff b333 3333 3333 3333 +fI[1] = #3fff b333 3333 3333 3334 fI[1] == strtox @@ -848,7 +848,7 @@ g_xfmt(0) gives 4 bytes: "-1.4" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff b333 3333 3333 3334 -fI[1] = #bfff b333 3333 3333 3334 +fI[1] = #bfff b333 3333 3333 3333 fI[1] == strtox @@ -880,7 +880,7 @@ g_xfmt(0) gives 3 bytes: "1.6" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff cccc cccc cccc cccc -fI[1] = #3fff cccc cccc cccc cccc +fI[1] = #3fff cccc cccc cccc cccd fI[1] == strtox @@ -892,7 +892,7 @@ g_xfmt(0) gives 22 bytes: "-1.5999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff cccc cccc cccc cccd -fI[1] = #bfff cccc cccc cccc cccd +fI[1] = #bfff cccc cccc cccc cccc fI[1] == strtox @@ -904,7 +904,7 @@ g_xfmt(0) gives 3 bytes: "1.7" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff d999 9999 9999 9999 -fI[1] = #3fff d999 9999 9999 9999 +fI[1] = #3fff d999 9999 9999 999a fI[1] == strtox @@ -916,7 +916,7 @@ g_xfmt(0) gives 22 bytes: "-1.6999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff d999 9999 9999 999a -fI[1] = #bfff d999 9999 9999 999a +fI[1] = #bfff d999 9999 9999 9999 fI[1] == strtox @@ -928,7 +928,7 @@ g_xfmt(0) gives 21 bytes: "1.8000000000000000001" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff e666 6666 6666 6666 -fI[1] = #3fff e666 6666 6666 6666 +fI[1] = #3fff e666 6666 6666 6667 fI[1] == strtox @@ -940,7 +940,7 @@ g_xfmt(0) gives 4 bytes: "-1.8" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff e666 6666 6666 6667 -fI[1] = #bfff e666 6666 6666 6667 +fI[1] = #bfff e666 6666 6666 6666 fI[1] == strtox @@ -952,7 +952,7 @@ g_xfmt(0) gives 21 bytes: "1.9000000000000000001" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff f333 3333 3333 3333 -fI[1] = #3fff f333 3333 3333 3333 +fI[1] = #3fff f333 3333 3333 3334 fI[1] == strtox @@ -964,7 +964,7 @@ g_xfmt(0) gives 4 bytes: "-1.9" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff f333 3333 3333 3334 -fI[1] = #bfff f333 3333 3333 3334 +fI[1] = #bfff f333 3333 3333 3333 fI[1] == strtox Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) @@ -977,7 +977,7 @@ g_xfmt(0) gives 21 bytes: "1.0999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 8ccc cccc cccc cccc -fI[1] = #3fff 8ccc cccc cccc cccc +fI[1] = #3fff 8ccc cccc cccc cccd fI[0] == strtox @@ -989,7 +989,7 @@ g_xfmt(0) gives 4 bytes: "-1.1" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 8ccc cccc cccc cccd -fI[1] = #bfff 8ccc cccc cccc cccd +fI[1] = #bfff 8ccc cccc cccc cccc fI[0] == strtox @@ -1001,7 +1001,7 @@ g_xfmt(0) gives 21 bytes: "1.1999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 9999 9999 9999 9999 -fI[1] = #3fff 9999 9999 9999 9999 +fI[1] = #3fff 9999 9999 9999 999a fI[0] == strtox @@ -1013,7 +1013,7 @@ g_xfmt(0) gives 4 bytes: "-1.2" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 9999 9999 9999 999a -fI[1] = #bfff 9999 9999 9999 999a +fI[1] = #bfff 9999 9999 9999 9999 fI[0] == strtox @@ -1025,7 +1025,7 @@ g_xfmt(0) gives 3 bytes: "1.3" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff a666 6666 6666 6666 -fI[1] = #3fff a666 6666 6666 6666 +fI[1] = #3fff a666 6666 6666 6667 fI[0] == strtox @@ -1037,7 +1037,7 @@ g_xfmt(0) gives 22 bytes: "-1.3000000000000000001" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff a666 6666 6666 6667 -fI[1] = #bfff a666 6666 6666 6667 +fI[1] = #bfff a666 6666 6666 6666 fI[0] == strtox @@ -1049,7 +1049,7 @@ g_xfmt(0) gives 3 bytes: "1.4" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff b333 3333 3333 3333 -fI[1] = #3fff b333 3333 3333 3333 +fI[1] = #3fff b333 3333 3333 3334 fI[0] == strtox @@ -1061,7 +1061,7 @@ g_xfmt(0) gives 22 bytes: "-1.4000000000000000001" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff b333 3333 3333 3334 -fI[1] = #bfff b333 3333 3333 3334 +fI[1] = #bfff b333 3333 3333 3333 fI[0] == strtox @@ -1093,7 +1093,7 @@ g_xfmt(0) gives 21 bytes: "1.5999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff cccc cccc cccc cccc -fI[1] = #3fff cccc cccc cccc cccc +fI[1] = #3fff cccc cccc cccc cccd fI[0] == strtox @@ -1105,7 +1105,7 @@ g_xfmt(0) gives 4 bytes: "-1.6" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff cccc cccc cccc cccd -fI[1] = #bfff cccc cccc cccc cccd +fI[1] = #bfff cccc cccc cccc cccc fI[0] == strtox @@ -1117,7 +1117,7 @@ g_xfmt(0) gives 21 bytes: "1.6999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff d999 9999 9999 9999 -fI[1] = #3fff d999 9999 9999 9999 +fI[1] = #3fff d999 9999 9999 999a fI[0] == strtox @@ -1129,7 +1129,7 @@ g_xfmt(0) gives 4 bytes: "-1.7" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff d999 9999 9999 999a -fI[1] = #bfff d999 9999 9999 999a +fI[1] = #bfff d999 9999 9999 9999 fI[0] == strtox @@ -1141,7 +1141,7 @@ g_xfmt(0) gives 3 bytes: "1.8" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff e666 6666 6666 6666 -fI[1] = #3fff e666 6666 6666 6666 +fI[1] = #3fff e666 6666 6666 6667 fI[0] == strtox @@ -1153,7 +1153,7 @@ g_xfmt(0) gives 22 bytes: "-1.8000000000000000001" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff e666 6666 6666 6667 -fI[1] = #bfff e666 6666 6666 6667 +fI[1] = #bfff e666 6666 6666 6666 fI[0] == strtox @@ -1165,7 +1165,7 @@ g_xfmt(0) gives 3 bytes: "1.9" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff f333 3333 3333 3333 -fI[1] = #3fff f333 3333 3333 3333 +fI[1] = #3fff f333 3333 3333 3334 fI[0] == strtox @@ -1177,6 +1177,6 @@ g_xfmt(0) gives 22 bytes: "-1.9000000000000000001" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff f333 3333 3333 3334 -fI[1] = #bfff f333 3333 3333 3334 +fI[1] = #bfff f333 3333 3333 3333 fI[0] == strtox diff --git a/contrib/gdtoa/test/x.ou1 b/contrib/gdtoa/test/x.ou1 index 3ebe74a59e98..437783f7196a 100644 --- a/contrib/gdtoa/test/x.ou1 +++ b/contrib/gdtoa/test/x.ou1 @@ -9,7 +9,7 @@ g_xfmt(0) gives 4 bytes: "1.23" strtoIx returns 33, consuming 4 bytes. fI[0] = #3fff 9d70 a3d7 a3d 70a3 = 1.22999999999999999991 -fI[1] = #3fff 9d70 a3d7 a3d 70a3 +fI[1] = #3fff 9d70 a3d7 a3d 70a4 = 1.23000000000000000002 fI[1] == strtox @@ -35,7 +35,7 @@ g_xfmt(0) gives 8 bytes: "1.23e-20" strtoIx returns 17, consuming 8 bytes. fI[0] = #3fbc e857 267b b3a9 84f2 = 1.22999999999999999997e-20 -fI[1] = #3fbc e857 267b b3a9 84f2 +fI[1] = #3fbc e857 267b b3a9 84f3 = 1.23000000000000000004e-20 fI[0] == strtox @@ -50,7 +50,7 @@ g_xfmt(0) gives 10 bytes: "1.23456789" strtoIx returns 33, consuming 10 bytes. fI[0] = #3fff 9e06 5214 1ef0 dbf5 = 1.23456788999999999992 -fI[1] = #3fff 9e06 5214 1ef0 dbf5 +fI[1] = #3fff 9e06 5214 1ef0 dbf6 = 1.23456789000000000003 fI[1] == strtox @@ -76,7 +76,7 @@ g_xfmt(0) gives 8 bytes: "1.23e+30" strtoIx returns 17, consuming 8 bytes. fI[0] = #4062 f865 8274 7dbc 824a = 1.22999999999999999999e+30 -fI[1] = #4062 f865 8274 7dbc 824a +fI[1] = #4062 f865 8274 7dbc 824b = 1.23000000000000000006e+30 fI[0] == strtox @@ -91,7 +91,7 @@ g_xfmt(0) gives 8 bytes: "1.23e-30" strtoIx returns 17, consuming 8 bytes. fI[0] = #3f9b c794 337a 8085 54eb = 1.22999999999999999999e-30 -fI[1] = #3f9b c794 337a 8085 54eb +fI[1] = #3f9b c794 337a 8085 54ec = 1.23000000000000000007e-30 fI[0] == strtox @@ -106,7 +106,7 @@ g_xfmt(0) gives 14 bytes: "1.23456789e-20" strtoIx returns 17, consuming 14 bytes. fI[0] = #3fbc e934 a38 f3d6 d352 = 1.23456788999999999998e-20 -fI[1] = #3fbc e934 a38 f3d6 d352 +fI[1] = #3fbc e934 a38 f3d6 d353 = 1.23456789000000000005e-20 fI[0] == strtox @@ -121,7 +121,7 @@ g_xfmt(0) gives 14 bytes: "1.23456789e-30" strtoIx returns 17, consuming 14 bytes. fI[0] = #3f9b c851 f19d decc a8fc = 1.23456788999999999999e-30 -fI[1] = #3f9b c851 f19d decc a8fc +fI[1] = #3f9b c851 f19d decc a8fd = 1.23456789000000000007e-30 fI[0] == strtox @@ -136,7 +136,7 @@ g_xfmt(0) gives 20 bytes: "1.234567890123456789" strtoIx returns 17, consuming 20 bytes. fI[0] = #3fff 9e06 5214 62cf db8d = 1.23456789012345678899 -fI[1] = #3fff 9e06 5214 62cf db8d +fI[1] = #3fff 9e06 5214 62cf db8e = 1.23456789012345678909 fI[0] == strtox @@ -151,7 +151,7 @@ g_xfmt(0) gives 20 bytes: "1.234567890123456789" strtoIx returns 17, consuming 40 bytes. fI[0] = #3fff 9e06 5214 62cf db8d = 1.23456789012345678899 -fI[1] = #3fff 9e06 5214 62cf db8d +fI[1] = #3fff 9e06 5214 62cf db8e = 1.23456789012345678909 fI[0] == strtox @@ -166,7 +166,7 @@ g_xfmt(0) gives 9 bytes: "1.23e+306" strtoIx returns 17, consuming 8 bytes. fI[0] = #43f7 e033 b668 e30f a6d5 = 1.22999999999999999997e+306 -fI[1] = #43f7 e033 b668 e30f a6d5 +fI[1] = #43f7 e033 b668 e30f a6d6 = 1.23000000000000000005e+306 fI[0] == strtox @@ -181,7 +181,7 @@ g_xfmt(0) gives 9 bytes: "1.23e-306" strtoIx returns 33, consuming 9 bytes. fI[0] = #3c06 dd1d c2ed 1cb7 3f24 = 1.22999999999999999995e-306 -fI[1] = #3c06 dd1d c2ed 1cb7 3f24 +fI[1] = #3c06 dd1d c2ed 1cb7 3f25 = 1.23000000000000000002e-306 fI[1] == strtox @@ -196,7 +196,7 @@ g_xfmt(0) gives 9 bytes: "1.23e-320" strtoIx returns 33, consuming 9 bytes. fI[0] = #3bd8 9b98 c371 844c 3f19 = 1.22999999999999999991e-320 -fI[1] = #3bd8 9b98 c371 844c 3f19 +fI[1] = #3bd8 9b98 c371 844c 3f1a = 1.23000000000000000002e-320 fI[1] == strtox @@ -211,7 +211,7 @@ g_xfmt(0) gives 8 bytes: "1.23e-20" strtoIx returns 17, consuming 8 bytes. fI[0] = #3fbc e857 267b b3a9 84f2 = 1.22999999999999999997e-20 -fI[1] = #3fbc e857 267b b3a9 84f2 +fI[1] = #3fbc e857 267b b3a9 84f3 = 1.23000000000000000004e-20 fI[0] == strtox @@ -226,7 +226,7 @@ g_xfmt(0) gives 15 bytes: "1.23456789e+307" strtoIx returns 17, consuming 14 bytes. fI[0] = #43fb 8ca5 8a5e d766 de75 = 1.23456788999999999998e+307 -fI[1] = #43fb 8ca5 8a5e d766 de75 +fI[1] = #43fb 8ca5 8a5e d766 de76 = 1.23456789000000000011e+307 fI[0] == strtox @@ -241,7 +241,7 @@ g_xfmt(0) gives 15 bytes: "1.23456589e-307" strtoIx returns 17, consuming 15 bytes. fI[0] = #3c03 b18c b5dc c22f d369 = 1.23456588999999999999e-307 -fI[1] = #3c03 b18c b5dc c22f d369 +fI[1] = #3c03 b18c b5dc c22f d36a = 1.23456589000000000009e-307 fI[0] == strtox @@ -256,7 +256,7 @@ g_xfmt(0) gives 20 bytes: "1.234567890123456789" strtoIx returns 17, consuming 20 bytes. fI[0] = #3fff 9e06 5214 62cf db8d = 1.23456789012345678899 -fI[1] = #3fff 9e06 5214 62cf db8d +fI[1] = #3fff 9e06 5214 62cf db8e = 1.23456789012345678909 fI[0] == strtox @@ -271,7 +271,7 @@ g_xfmt(0) gives 25 bytes: "1.234567890123456789e+301" strtoIx returns 33, consuming 24 bytes. fI[0] = #43e7 937a 8baf ab20 980b = 1.23456789012345678889e+301 -fI[1] = #43e7 937a 8baf ab20 980b +fI[1] = #43e7 937a 8baf ab20 980c = 1.234567890123456789e+301 fI[1] == strtox @@ -286,7 +286,7 @@ g_xfmt(0) gives 25 bytes: "1.234567890123456789e-301" strtoIx returns 33, consuming 25 bytes. fI[0] = #3c17 a953 271a 5d06 9ad8 = 1.23456789012345678892e-301 -fI[1] = #3c17 a953 271a 5d06 9ad8 +fI[1] = #3c17 a953 271a 5d06 9ad9 = 1.23456789012345678902e-301 fI[1] == strtox @@ -301,7 +301,7 @@ g_xfmt(0) gives 25 bytes: "1.234567890123456789e-321" strtoIx returns 33, consuming 25 bytes. fI[0] = #3bd4 f9e1 1b4c ea6d cce8 = 1.23456789012345678893e-321 -fI[1] = #3bd4 f9e1 1b4c ea6d cce8 +fI[1] = #3bd4 f9e1 1b4c ea6d cce9 = 1.234567890123456789e-321 fI[1] == strtox @@ -327,7 +327,7 @@ g_xfmt(0) gives 6 bytes: "1e+310" strtoIx returns 33, consuming 5 bytes. fI[0] = #4404 de81 e40a 34b cf4f = 9.9999999999999999994e+309 -fI[1] = #4404 de81 e40a 34b cf4f +fI[1] = #4404 de81 e40a 34b cf50 = 1e+310 fI[1] == strtox @@ -342,7 +342,7 @@ g_xfmt(0) gives 23 bytes: "9.0259718793241475e-277" strtoIx returns 33, consuming 23 bytes. fI[0] = #3c69 ffff ffff ffff fcf6 = 9.02597187932414749967e-277 -fI[1] = #3c69 ffff ffff ffff fcf6 +fI[1] = #3c69 ffff ffff ffff fcf7 = 9.02597187932414750016e-277 fI[1] == strtox @@ -357,7 +357,7 @@ g_xfmt(0) gives 26 bytes: "9.0259718793241478803e-277" strtoIx returns 17, consuming 37 bytes. fI[0] = #3c6a 8000 0 0 0 = 9.02597187932414788035e-277 -fI[1] = #3c6a 8000 0 0 0 +fI[1] = #3c6a 8000 0 0 1 = 9.02597187932414788132e-277 fI[0] == strtox @@ -372,7 +372,7 @@ g_xfmt(0) gives 26 bytes: "9.0259718793241478803e-277" strtoIx returns 33, consuming 37 bytes. fI[0] = #3c69 ffff ffff ffff ffff = 9.02597187932414787986e-277 -fI[1] = #3c6a 8000 0 ffff ffff +fI[1] = #3c6a 8000 0 0 0 = 9.02597187932414788035e-277 fI[1] == strtox @@ -387,7 +387,7 @@ g_xfmt(0) gives 23 bytes: "2.2250738585072014e-308" strtoIx returns 17, consuming 23 bytes. fI[0] = #3c01 8000 0 0 46 = 2.22507385850720139998e-308 -fI[1] = #3c01 8000 0 0 46 +fI[1] = #3c01 8000 0 0 47 = 2.22507385850720140022e-308 fI[0] == strtox @@ -402,7 +402,7 @@ g_xfmt(0) gives 23 bytes: "2.2250738585072013e-308" strtoIx returns 17, consuming 23 bytes. fI[0] = #3c00 ffff ffff ffff fd4f = 2.22507385850720129998e-308 -fI[1] = #3c00 ffff ffff ffff fd4f +fI[1] = #3c00 ffff ffff ffff fd50 = 2.2250738585072013001e-308 fI[0] == strtox @@ -418,7 +418,7 @@ g_xfmt(0) gives 21 bytes: "1.0999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 8ccc cccc cccc cccc = 1.09999999999999999991 -fI[1] = #3fff 8ccc cccc cccc cccc +fI[1] = #3fff 8ccc cccc cccc cccd = 1.10000000000000000002 fI[0] == strtox @@ -433,7 +433,7 @@ g_xfmt(0) gives 22 bytes: "-1.0999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 8ccc cccc cccc cccd = -1.10000000000000000002 -fI[1] = #bfff 8ccc cccc cccc cccd +fI[1] = #bfff 8ccc cccc cccc cccc = -1.09999999999999999991 fI[1] == strtox @@ -448,7 +448,7 @@ g_xfmt(0) gives 21 bytes: "1.1999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 9999 9999 9999 9999 = 1.19999999999999999993 -fI[1] = #3fff 9999 9999 9999 9999 +fI[1] = #3fff 9999 9999 9999 999a = 1.20000000000000000004 fI[0] == strtox @@ -463,7 +463,7 @@ g_xfmt(0) gives 22 bytes: "-1.1999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 9999 9999 9999 999a = -1.20000000000000000004 -fI[1] = #bfff 9999 9999 9999 999a +fI[1] = #bfff 9999 9999 9999 9999 = -1.19999999999999999993 fI[1] == strtox @@ -478,7 +478,7 @@ g_xfmt(0) gives 3 bytes: "1.3" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff a666 6666 6666 6666 = 1.29999999999999999996 -fI[1] = #3fff a666 6666 6666 6666 +fI[1] = #3fff a666 6666 6666 6667 = 1.30000000000000000007 fI[0] == strtox @@ -493,7 +493,7 @@ g_xfmt(0) gives 4 bytes: "-1.3" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff a666 6666 6666 6667 = -1.30000000000000000007 -fI[1] = #bfff a666 6666 6666 6667 +fI[1] = #bfff a666 6666 6666 6666 = -1.29999999999999999996 fI[1] == strtox @@ -508,7 +508,7 @@ g_xfmt(0) gives 3 bytes: "1.4" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff b333 3333 3333 3333 = 1.39999999999999999998 -fI[1] = #3fff b333 3333 3333 3333 +fI[1] = #3fff b333 3333 3333 3334 = 1.40000000000000000009 fI[0] == strtox @@ -523,7 +523,7 @@ g_xfmt(0) gives 4 bytes: "-1.4" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff b333 3333 3333 3334 = -1.40000000000000000009 -fI[1] = #bfff b333 3333 3333 3334 +fI[1] = #bfff b333 3333 3333 3333 = -1.39999999999999999998 fI[1] == strtox @@ -560,7 +560,7 @@ g_xfmt(0) gives 21 bytes: "1.5999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff cccc cccc cccc cccc = 1.59999999999999999991 -fI[1] = #3fff cccc cccc cccc cccc +fI[1] = #3fff cccc cccc cccc cccd = 1.60000000000000000002 fI[0] == strtox @@ -575,7 +575,7 @@ g_xfmt(0) gives 22 bytes: "-1.5999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff cccc cccc cccc cccd = -1.60000000000000000002 -fI[1] = #bfff cccc cccc cccc cccd +fI[1] = #bfff cccc cccc cccc cccc = -1.59999999999999999991 fI[1] == strtox @@ -590,7 +590,7 @@ g_xfmt(0) gives 21 bytes: "1.6999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff d999 9999 9999 9999 = 1.69999999999999999993 -fI[1] = #3fff d999 9999 9999 9999 +fI[1] = #3fff d999 9999 9999 999a = 1.70000000000000000004 fI[0] == strtox @@ -605,7 +605,7 @@ g_xfmt(0) gives 22 bytes: "-1.6999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff d999 9999 9999 999a = -1.70000000000000000004 -fI[1] = #bfff d999 9999 9999 999a +fI[1] = #bfff d999 9999 9999 9999 = -1.69999999999999999993 fI[1] == strtox @@ -620,7 +620,7 @@ g_xfmt(0) gives 3 bytes: "1.8" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff e666 6666 6666 6666 = 1.79999999999999999996 -fI[1] = #3fff e666 6666 6666 6666 +fI[1] = #3fff e666 6666 6666 6667 = 1.80000000000000000007 fI[0] == strtox @@ -635,7 +635,7 @@ g_xfmt(0) gives 4 bytes: "-1.8" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff e666 6666 6666 6667 = -1.80000000000000000007 -fI[1] = #bfff e666 6666 6666 6667 +fI[1] = #bfff e666 6666 6666 6666 = -1.79999999999999999996 fI[1] == strtox @@ -650,7 +650,7 @@ g_xfmt(0) gives 3 bytes: "1.9" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff f333 3333 3333 3333 = 1.89999999999999999998 -fI[1] = #3fff f333 3333 3333 3333 +fI[1] = #3fff f333 3333 3333 3334 = 1.90000000000000000009 fI[0] == strtox @@ -665,7 +665,7 @@ g_xfmt(0) gives 4 bytes: "-1.9" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff f333 3333 3333 3334 = -1.90000000000000000009 -fI[1] = #bfff f333 3333 3333 3334 +fI[1] = #bfff f333 3333 3333 3333 = -1.89999999999999999998 fI[1] == strtox @@ -681,7 +681,7 @@ g_xfmt(0) gives 3 bytes: "1.1" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 8ccc cccc cccc cccc = 1.09999999999999999991 -fI[1] = #3fff 8ccc cccc cccc cccc +fI[1] = #3fff 8ccc cccc cccc cccd = 1.10000000000000000002 fI[1] == strtox @@ -696,7 +696,7 @@ g_xfmt(0) gives 4 bytes: "-1.1" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 8ccc cccc cccc cccd = -1.10000000000000000002 -fI[1] = #bfff 8ccc cccc cccc cccd +fI[1] = #bfff 8ccc cccc cccc cccc = -1.09999999999999999991 fI[0] == strtox @@ -711,7 +711,7 @@ g_xfmt(0) gives 3 bytes: "1.2" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 9999 9999 9999 9999 = 1.19999999999999999993 -fI[1] = #3fff 9999 9999 9999 9999 +fI[1] = #3fff 9999 9999 9999 999a = 1.20000000000000000004 fI[1] == strtox @@ -726,7 +726,7 @@ g_xfmt(0) gives 4 bytes: "-1.2" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 9999 9999 9999 999a = -1.20000000000000000004 -fI[1] = #bfff 9999 9999 9999 999a +fI[1] = #bfff 9999 9999 9999 9999 = -1.19999999999999999993 fI[0] == strtox @@ -741,7 +741,7 @@ g_xfmt(0) gives 3 bytes: "1.3" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff a666 6666 6666 6666 = 1.29999999999999999996 -fI[1] = #3fff a666 6666 6666 6666 +fI[1] = #3fff a666 6666 6666 6667 = 1.30000000000000000007 fI[0] == strtox @@ -756,7 +756,7 @@ g_xfmt(0) gives 4 bytes: "-1.3" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff a666 6666 6666 6667 = -1.30000000000000000007 -fI[1] = #bfff a666 6666 6666 6667 +fI[1] = #bfff a666 6666 6666 6666 = -1.29999999999999999996 fI[1] == strtox @@ -771,7 +771,7 @@ g_xfmt(0) gives 3 bytes: "1.4" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff b333 3333 3333 3333 = 1.39999999999999999998 -fI[1] = #3fff b333 3333 3333 3333 +fI[1] = #3fff b333 3333 3333 3334 = 1.40000000000000000009 fI[0] == strtox @@ -786,7 +786,7 @@ g_xfmt(0) gives 4 bytes: "-1.4" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff b333 3333 3333 3334 = -1.40000000000000000009 -fI[1] = #bfff b333 3333 3333 3334 +fI[1] = #bfff b333 3333 3333 3333 = -1.39999999999999999998 fI[1] == strtox @@ -823,7 +823,7 @@ g_xfmt(0) gives 3 bytes: "1.6" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff cccc cccc cccc cccc = 1.59999999999999999991 -fI[1] = #3fff cccc cccc cccc cccc +fI[1] = #3fff cccc cccc cccc cccd = 1.60000000000000000002 fI[1] == strtox @@ -838,7 +838,7 @@ g_xfmt(0) gives 4 bytes: "-1.6" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff cccc cccc cccc cccd = -1.60000000000000000002 -fI[1] = #bfff cccc cccc cccc cccd +fI[1] = #bfff cccc cccc cccc cccc = -1.59999999999999999991 fI[0] == strtox @@ -853,7 +853,7 @@ g_xfmt(0) gives 3 bytes: "1.7" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff d999 9999 9999 9999 = 1.69999999999999999993 -fI[1] = #3fff d999 9999 9999 9999 +fI[1] = #3fff d999 9999 9999 999a = 1.70000000000000000004 fI[1] == strtox @@ -868,7 +868,7 @@ g_xfmt(0) gives 4 bytes: "-1.7" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff d999 9999 9999 999a = -1.70000000000000000004 -fI[1] = #bfff d999 9999 9999 999a +fI[1] = #bfff d999 9999 9999 9999 = -1.69999999999999999993 fI[0] == strtox @@ -883,7 +883,7 @@ g_xfmt(0) gives 3 bytes: "1.8" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff e666 6666 6666 6666 = 1.79999999999999999996 -fI[1] = #3fff e666 6666 6666 6666 +fI[1] = #3fff e666 6666 6666 6667 = 1.80000000000000000007 fI[0] == strtox @@ -898,7 +898,7 @@ g_xfmt(0) gives 4 bytes: "-1.8" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff e666 6666 6666 6667 = -1.80000000000000000007 -fI[1] = #bfff e666 6666 6666 6667 +fI[1] = #bfff e666 6666 6666 6666 = -1.79999999999999999996 fI[1] == strtox @@ -913,7 +913,7 @@ g_xfmt(0) gives 3 bytes: "1.9" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff f333 3333 3333 3333 = 1.89999999999999999998 -fI[1] = #3fff f333 3333 3333 3333 +fI[1] = #3fff f333 3333 3333 3334 = 1.90000000000000000009 fI[0] == strtox @@ -928,7 +928,7 @@ g_xfmt(0) gives 4 bytes: "-1.9" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff f333 3333 3333 3334 = -1.90000000000000000009 -fI[1] = #bfff f333 3333 3333 3334 +fI[1] = #bfff f333 3333 3333 3333 = -1.89999999999999999998 fI[1] == strtox @@ -944,7 +944,7 @@ g_xfmt(0) gives 3 bytes: "1.1" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 8ccc cccc cccc cccc = 1.09999999999999999991 -fI[1] = #3fff 8ccc cccc cccc cccc +fI[1] = #3fff 8ccc cccc cccc cccd = 1.10000000000000000002 fI[1] == strtox @@ -959,7 +959,7 @@ g_xfmt(0) gives 22 bytes: "-1.0999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 8ccc cccc cccc cccd = -1.10000000000000000002 -fI[1] = #bfff 8ccc cccc cccc cccd +fI[1] = #bfff 8ccc cccc cccc cccc = -1.09999999999999999991 fI[1] == strtox @@ -974,7 +974,7 @@ g_xfmt(0) gives 3 bytes: "1.2" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 9999 9999 9999 9999 = 1.19999999999999999993 -fI[1] = #3fff 9999 9999 9999 9999 +fI[1] = #3fff 9999 9999 9999 999a = 1.20000000000000000004 fI[1] == strtox @@ -989,7 +989,7 @@ g_xfmt(0) gives 22 bytes: "-1.1999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 9999 9999 9999 999a = -1.20000000000000000004 -fI[1] = #bfff 9999 9999 9999 999a +fI[1] = #bfff 9999 9999 9999 9999 = -1.19999999999999999993 fI[1] == strtox @@ -1004,7 +1004,7 @@ g_xfmt(0) gives 21 bytes: "1.3000000000000000001" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff a666 6666 6666 6666 = 1.29999999999999999996 -fI[1] = #3fff a666 6666 6666 6666 +fI[1] = #3fff a666 6666 6666 6667 = 1.30000000000000000007 fI[1] == strtox @@ -1019,7 +1019,7 @@ g_xfmt(0) gives 4 bytes: "-1.3" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff a666 6666 6666 6667 = -1.30000000000000000007 -fI[1] = #bfff a666 6666 6666 6667 +fI[1] = #bfff a666 6666 6666 6666 = -1.29999999999999999996 fI[1] == strtox @@ -1034,7 +1034,7 @@ g_xfmt(0) gives 21 bytes: "1.4000000000000000001" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff b333 3333 3333 3333 = 1.39999999999999999998 -fI[1] = #3fff b333 3333 3333 3333 +fI[1] = #3fff b333 3333 3333 3334 = 1.40000000000000000009 fI[1] == strtox @@ -1049,7 +1049,7 @@ g_xfmt(0) gives 4 bytes: "-1.4" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff b333 3333 3333 3334 = -1.40000000000000000009 -fI[1] = #bfff b333 3333 3333 3334 +fI[1] = #bfff b333 3333 3333 3333 = -1.39999999999999999998 fI[1] == strtox @@ -1086,7 +1086,7 @@ g_xfmt(0) gives 3 bytes: "1.6" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff cccc cccc cccc cccc = 1.59999999999999999991 -fI[1] = #3fff cccc cccc cccc cccc +fI[1] = #3fff cccc cccc cccc cccd = 1.60000000000000000002 fI[1] == strtox @@ -1101,7 +1101,7 @@ g_xfmt(0) gives 22 bytes: "-1.5999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff cccc cccc cccc cccd = -1.60000000000000000002 -fI[1] = #bfff cccc cccc cccc cccd +fI[1] = #bfff cccc cccc cccc cccc = -1.59999999999999999991 fI[1] == strtox @@ -1116,7 +1116,7 @@ g_xfmt(0) gives 3 bytes: "1.7" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff d999 9999 9999 9999 = 1.69999999999999999993 -fI[1] = #3fff d999 9999 9999 9999 +fI[1] = #3fff d999 9999 9999 999a = 1.70000000000000000004 fI[1] == strtox @@ -1131,7 +1131,7 @@ g_xfmt(0) gives 22 bytes: "-1.6999999999999999999" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff d999 9999 9999 999a = -1.70000000000000000004 -fI[1] = #bfff d999 9999 9999 999a +fI[1] = #bfff d999 9999 9999 9999 = -1.69999999999999999993 fI[1] == strtox @@ -1146,7 +1146,7 @@ g_xfmt(0) gives 21 bytes: "1.8000000000000000001" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff e666 6666 6666 6666 = 1.79999999999999999996 -fI[1] = #3fff e666 6666 6666 6666 +fI[1] = #3fff e666 6666 6666 6667 = 1.80000000000000000007 fI[1] == strtox @@ -1161,7 +1161,7 @@ g_xfmt(0) gives 4 bytes: "-1.8" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff e666 6666 6666 6667 = -1.80000000000000000007 -fI[1] = #bfff e666 6666 6666 6667 +fI[1] = #bfff e666 6666 6666 6666 = -1.79999999999999999996 fI[1] == strtox @@ -1176,7 +1176,7 @@ g_xfmt(0) gives 21 bytes: "1.9000000000000000001" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff f333 3333 3333 3333 = 1.89999999999999999998 -fI[1] = #3fff f333 3333 3333 3333 +fI[1] = #3fff f333 3333 3333 3334 = 1.90000000000000000009 fI[1] == strtox @@ -1191,7 +1191,7 @@ g_xfmt(0) gives 4 bytes: "-1.9" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff f333 3333 3333 3334 = -1.90000000000000000009 -fI[1] = #bfff f333 3333 3333 3334 +fI[1] = #bfff f333 3333 3333 3333 = -1.89999999999999999998 fI[1] == strtox @@ -1207,7 +1207,7 @@ g_xfmt(0) gives 21 bytes: "1.0999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 8ccc cccc cccc cccc = 1.09999999999999999991 -fI[1] = #3fff 8ccc cccc cccc cccc +fI[1] = #3fff 8ccc cccc cccc cccd = 1.10000000000000000002 fI[0] == strtox @@ -1222,7 +1222,7 @@ g_xfmt(0) gives 4 bytes: "-1.1" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 8ccc cccc cccc cccd = -1.10000000000000000002 -fI[1] = #bfff 8ccc cccc cccc cccd +fI[1] = #bfff 8ccc cccc cccc cccc = -1.09999999999999999991 fI[0] == strtox @@ -1237,7 +1237,7 @@ g_xfmt(0) gives 21 bytes: "1.1999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff 9999 9999 9999 9999 = 1.19999999999999999993 -fI[1] = #3fff 9999 9999 9999 9999 +fI[1] = #3fff 9999 9999 9999 999a = 1.20000000000000000004 fI[0] == strtox @@ -1252,7 +1252,7 @@ g_xfmt(0) gives 4 bytes: "-1.2" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff 9999 9999 9999 999a = -1.20000000000000000004 -fI[1] = #bfff 9999 9999 9999 999a +fI[1] = #bfff 9999 9999 9999 9999 = -1.19999999999999999993 fI[0] == strtox @@ -1267,7 +1267,7 @@ g_xfmt(0) gives 3 bytes: "1.3" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff a666 6666 6666 6666 = 1.29999999999999999996 -fI[1] = #3fff a666 6666 6666 6666 +fI[1] = #3fff a666 6666 6666 6667 = 1.30000000000000000007 fI[0] == strtox @@ -1282,7 +1282,7 @@ g_xfmt(0) gives 22 bytes: "-1.3000000000000000001" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff a666 6666 6666 6667 = -1.30000000000000000007 -fI[1] = #bfff a666 6666 6666 6667 +fI[1] = #bfff a666 6666 6666 6666 = -1.29999999999999999996 fI[0] == strtox @@ -1297,7 +1297,7 @@ g_xfmt(0) gives 3 bytes: "1.4" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff b333 3333 3333 3333 = 1.39999999999999999998 -fI[1] = #3fff b333 3333 3333 3333 +fI[1] = #3fff b333 3333 3333 3334 = 1.40000000000000000009 fI[0] == strtox @@ -1312,7 +1312,7 @@ g_xfmt(0) gives 22 bytes: "-1.4000000000000000001" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff b333 3333 3333 3334 = -1.40000000000000000009 -fI[1] = #bfff b333 3333 3333 3334 +fI[1] = #bfff b333 3333 3333 3333 = -1.39999999999999999998 fI[0] == strtox @@ -1349,7 +1349,7 @@ g_xfmt(0) gives 21 bytes: "1.5999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff cccc cccc cccc cccc = 1.59999999999999999991 -fI[1] = #3fff cccc cccc cccc cccc +fI[1] = #3fff cccc cccc cccc cccd = 1.60000000000000000002 fI[0] == strtox @@ -1364,7 +1364,7 @@ g_xfmt(0) gives 4 bytes: "-1.6" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff cccc cccc cccc cccd = -1.60000000000000000002 -fI[1] = #bfff cccc cccc cccc cccd +fI[1] = #bfff cccc cccc cccc cccc = -1.59999999999999999991 fI[0] == strtox @@ -1379,7 +1379,7 @@ g_xfmt(0) gives 21 bytes: "1.6999999999999999999" strtoIx returns 33, consuming 3 bytes. fI[0] = #3fff d999 9999 9999 9999 = 1.69999999999999999993 -fI[1] = #3fff d999 9999 9999 9999 +fI[1] = #3fff d999 9999 9999 999a = 1.70000000000000000004 fI[0] == strtox @@ -1394,7 +1394,7 @@ g_xfmt(0) gives 4 bytes: "-1.7" strtoIx returns 41, consuming 4 bytes. fI[0] = #bfff d999 9999 9999 999a = -1.70000000000000000004 -fI[1] = #bfff d999 9999 9999 999a +fI[1] = #bfff d999 9999 9999 9999 = -1.69999999999999999993 fI[0] == strtox @@ -1409,7 +1409,7 @@ g_xfmt(0) gives 3 bytes: "1.8" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff e666 6666 6666 6666 = 1.79999999999999999996 -fI[1] = #3fff e666 6666 6666 6666 +fI[1] = #3fff e666 6666 6666 6667 = 1.80000000000000000007 fI[0] == strtox @@ -1424,7 +1424,7 @@ g_xfmt(0) gives 22 bytes: "-1.8000000000000000001" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff e666 6666 6666 6667 = -1.80000000000000000007 -fI[1] = #bfff e666 6666 6666 6667 +fI[1] = #bfff e666 6666 6666 6666 = -1.79999999999999999996 fI[0] == strtox @@ -1439,7 +1439,7 @@ g_xfmt(0) gives 3 bytes: "1.9" strtoIx returns 17, consuming 3 bytes. fI[0] = #3fff f333 3333 3333 3333 = 1.89999999999999999998 -fI[1] = #3fff f333 3333 3333 3333 +fI[1] = #3fff f333 3333 3333 3334 = 1.90000000000000000009 fI[0] == strtox @@ -1454,7 +1454,7 @@ g_xfmt(0) gives 22 bytes: "-1.9000000000000000001" strtoIx returns 25, consuming 4 bytes. fI[0] = #bfff f333 3333 3333 3334 = -1.90000000000000000009 -fI[1] = #bfff f333 3333 3333 3334 +fI[1] = #bfff f333 3333 3333 3333 = -1.89999999999999999998 fI[0] == strtox diff --git a/contrib/gdtoa/test/xL.ou1 b/contrib/gdtoa/test/xL.ou1 index 054690ec521c..c22d0f418918 100644 --- a/contrib/gdtoa/test/xL.ou1 +++ b/contrib/gdtoa/test/xL.ou1 @@ -1,14 +1,18 @@ ***** This file is not right. It needs to be generated on a ***** system with a Motorla 68881 or the equivalent. + Input: 1.23 strtoxL consumes 4 bytes and returns 33 with bits = #3fff0000 9d70a3d7 a3d70a4 +printf("%.21Lg") gives 7.73283722915781506499e-4933 g_xLfmt(0) gives 4 bytes: "1.23" strtoIxL returns 33, consuming 4 bytes. fI[0] = #3fff0000 9d70a3d7 a3d70a3 += 7.73283722915781506134e-4933 fI[1] = #3fff0000 9d70a3d7 a3d70a4 += 7.73283722915781506499e-4933 fI[1] == strtoxL @@ -16,6 +20,7 @@ Input: 1.23e+20 strtoxL consumes 8 bytes and returns 1 with bits = #40410000 d55ef90a 2da18000 +printf("%.21Lg") gives 2.24239113715721119512e-4932 g_xLfmt(0) gives 8 bytes: "1.23e+20" strtoIxL returns 1, consuming 8 bytes. @@ -26,11 +31,14 @@ Input: 1.23e-20 strtoxL consumes 8 bytes and returns 17 with bits = #3fbc0000 e857267b b3a984f2 +printf("%.21Lg") gives 2.74065070995958800375e-4932 g_xLfmt(0) gives 8 bytes: "1.23e-20" strtoIxL returns 17, consuming 8 bytes. fI[0] = #3fbc0000 e857267b b3a984f2 += 2.74065070995958800375e-4932 fI[1] = #3fbc0000 e857267b b3a984f3 += 2.74065070995958800411e-4932 fI[0] == strtoxL @@ -38,11 +46,14 @@ Input: 1.23456789 strtoxL consumes 10 bytes and returns 33 with bits = #3fff0000 9e065214 1ef0dbf6 +printf("%.21Lg") gives 7.88641440242171807354e-4933 g_xLfmt(0) gives 10 bytes: "1.23456789" strtoIxL returns 33, consuming 10 bytes. fI[0] = #3fff0000 9e065214 1ef0dbf5 += 7.8864144024217180699e-4933 fI[1] = #3fff0000 9e065214 1ef0dbf6 += 7.88641440242171807354e-4933 fI[1] == strtoxL @@ -50,6 +61,7 @@ Input: 1.23456589e+20 strtoxL consumes 14 bytes and returns 1 with bits = #40410000 d629bd33 5ccba00 +printf("%.21Lg") gives 2.26319561227049478508e-4932 g_xLfmt(0) gives 14 bytes: "1.23456589e+20" strtoIxL returns 1, consuming 14 bytes. @@ -60,11 +72,14 @@ Input: 1.23e+30 strtoxL consumes 8 bytes and returns 17 with bits = #40620000 f8658274 7dbc824a +printf("%.21Lg") gives 3.16238691003557160385e-4932 g_xLfmt(0) gives 8 bytes: "1.23e+30" strtoIxL returns 17, consuming 8 bytes. fI[0] = #40620000 f8658274 7dbc824a += 3.16238691003557160385e-4932 fI[1] = #40620000 f8658274 7dbc824b += 3.16238691003557160421e-4932 fI[0] == strtoxL @@ -72,11 +87,14 @@ Input: 1.23e-30 strtoxL consumes 8 bytes and returns 17 with bits = #3f9b0000 c794337a 808554eb +printf("%.21Lg") gives 1.88012249978407873966e-4932 g_xLfmt(0) gives 8 bytes: "1.23e-30" strtoIxL returns 17, consuming 8 bytes. fI[0] = #3f9b0000 c794337a 808554eb += 1.88012249978407873966e-4932 fI[1] = #3f9b0000 c794337a 808554ec += 1.88012249978407874003e-4932 fI[0] == strtoxL @@ -84,11 +102,14 @@ Input: 1.23456789e-20 strtoxL consumes 14 bytes and returns 17 with bits = #3fbc0000 e9340a38 f3d6d352 +printf("%.21Lg") gives 2.76331470044569174626e-4932 g_xLfmt(0) gives 14 bytes: "1.23456789e-20" strtoIxL returns 17, consuming 14 bytes. fI[0] = #3fbc0000 e9340a38 f3d6d352 += 2.76331470044569174626e-4932 fI[1] = #3fbc0000 e9340a38 f3d6d353 += 2.76331470044569174663e-4932 fI[0] == strtoxL @@ -96,11 +117,14 @@ Input: 1.23456789e-30 strtoxL consumes 14 bytes and returns 17 with bits = #3f9b0000 c851f19d decca8fc +printf("%.21Lg") gives 1.89959071937101288293e-4932 g_xLfmt(0) gives 14 bytes: "1.23456789e-30" strtoIxL returns 17, consuming 14 bytes. fI[0] = #3f9b0000 c851f19d decca8fc += 1.89959071937101288293e-4932 fI[1] = #3f9b0000 c851f19d decca8fd += 1.89959071937101288329e-4932 fI[0] == strtoxL @@ -108,11 +132,14 @@ Input: 1.234567890123456789 strtoxL consumes 20 bytes and returns 17 with bits = #3fff0000 9e065214 62cfdb8d +printf("%.21Lg") gives 7.88641440657246265535e-4933 g_xLfmt(0) gives 20 bytes: "1.234567890123456789" strtoIxL returns 17, consuming 20 bytes. fI[0] = #3fff0000 9e065214 62cfdb8d += 7.88641440657246265535e-4933 fI[1] = #3fff0000 9e065214 62cfdb8e += 7.886414406572462659e-4933 fI[0] == strtoxL @@ -120,11 +147,14 @@ Input: 1.23456789012345678901234567890123456789 strtoxL consumes 40 bytes and returns 17 with bits = #3fff0000 9e065214 62cfdb8d +printf("%.21Lg") gives 7.88641440657246265535e-4933 g_xLfmt(0) gives 20 bytes: "1.234567890123456789" strtoIxL returns 17, consuming 40 bytes. fI[0] = #3fff0000 9e065214 62cfdb8d += 7.88641440657246265535e-4933 fI[1] = #3fff0000 9e065214 62cfdb8e += 7.886414406572462659e-4933 fI[0] == strtoxL @@ -132,11 +162,14 @@ Input: 1.23e306 strtoxL consumes 8 bytes and returns 17 with bits = #43f70000 e033b668 e30fa6d5 +printf("%.21Lg") gives 2.52688323155200052759e-4932 g_xLfmt(0) gives 9 bytes: "1.23e+306" strtoIxL returns 17, consuming 8 bytes. fI[0] = #43f70000 e033b668 e30fa6d5 += 2.52688323155200052759e-4932 fI[1] = #43f70000 e033b668 e30fa6d6 += 2.52688323155200052796e-4932 fI[0] == strtoxL @@ -144,11 +177,14 @@ Input: 1.23e-306 strtoxL consumes 9 bytes and returns 33 with bits = #3c060000 dd1dc2ed 1cb73f25 +printf("%.21Lg") gives 2.44583168427704605801e-4932 g_xLfmt(0) gives 9 bytes: "1.23e-306" strtoIxL returns 33, consuming 9 bytes. fI[0] = #3c060000 dd1dc2ed 1cb73f24 += 2.44583168427704605765e-4932 fI[1] = #3c060000 dd1dc2ed 1cb73f25 += 2.44583168427704605801e-4932 fI[1] == strtoxL @@ -156,11 +192,14 @@ Input: 1.23e-320 strtoxL consumes 9 bytes and returns 33 with bits = #3bd80000 9b98c371 844c3f1a +printf("%.21Lg") gives 7.24867657578821329238e-4933 g_xLfmt(0) gives 9 bytes: "1.23e-320" strtoIxL returns 33, consuming 9 bytes. fI[0] = #3bd80000 9b98c371 844c3f19 += 7.24867657578821328874e-4933 fI[1] = #3bd80000 9b98c371 844c3f1a += 7.24867657578821329238e-4933 fI[1] == strtoxL @@ -168,11 +207,14 @@ Input: 1.23e-20 strtoxL consumes 8 bytes and returns 17 with bits = #3fbc0000 e857267b b3a984f2 +printf("%.21Lg") gives 2.74065070995958800375e-4932 g_xLfmt(0) gives 8 bytes: "1.23e-20" strtoIxL returns 17, consuming 8 bytes. fI[0] = #3fbc0000 e857267b b3a984f2 += 2.74065070995958800375e-4932 fI[1] = #3fbc0000 e857267b b3a984f3 += 2.74065070995958800411e-4932 fI[0] == strtoxL @@ -180,11 +222,14 @@ Input: 1.23456789e307 strtoxL consumes 14 bytes and returns 17 with bits = #43fb0000 8ca58a5e d766de75 +printf("%.21Lg") gives 3.32182163192682931854e-4933 g_xLfmt(0) gives 15 bytes: "1.23456789e+307" strtoIxL returns 17, consuming 14 bytes. fI[0] = #43fb0000 8ca58a5e d766de75 += 3.32182163192682931854e-4933 fI[1] = #43fb0000 8ca58a5e d766de76 += 3.32182163192682932219e-4933 fI[0] == strtoxL @@ -192,11 +237,14 @@ Input: 1.23456589e-307 strtoxL consumes 15 bytes and returns 17 with bits = #3c030000 b18cb5dc c22fd369 +printf("%.21Lg") gives 1.30149245314004923345e-4932 g_xLfmt(0) gives 15 bytes: "1.23456589e-307" strtoIxL returns 17, consuming 15 bytes. fI[0] = #3c030000 b18cb5dc c22fd369 += 1.30149245314004923345e-4932 fI[1] = #3c030000 b18cb5dc c22fd36a += 1.30149245314004923382e-4932 fI[0] == strtoxL @@ -204,11 +252,14 @@ Input: 1.234567890123456789 strtoxL consumes 20 bytes and returns 17 with bits = #3fff0000 9e065214 62cfdb8d +printf("%.21Lg") gives 7.88641440657246265535e-4933 g_xLfmt(0) gives 20 bytes: "1.234567890123456789" strtoIxL returns 17, consuming 20 bytes. fI[0] = #3fff0000 9e065214 62cfdb8d += 7.88641440657246265535e-4933 fI[1] = #3fff0000 9e065214 62cfdb8e += 7.886414406572462659e-4933 fI[0] == strtoxL @@ -216,11 +267,14 @@ Input: 1.234567890123456789e301 strtoxL consumes 24 bytes and returns 33 with bits = #43e70000 937a8baf ab20980c +printf("%.21Lg") gives 5.11635766619117643114e-4933 g_xLfmt(0) gives 25 bytes: "1.234567890123456789e+301" strtoIxL returns 33, consuming 24 bytes. fI[0] = #43e70000 937a8baf ab20980b += 5.1163576661911764275e-4933 fI[1] = #43e70000 937a8baf ab20980c += 5.11635766619117643114e-4933 fI[1] == strtoxL @@ -228,11 +282,14 @@ Input: 1.234567890123456789e-301 strtoxL consumes 25 bytes and returns 33 with bits = #3c170000 a953271a 5d069ad9 +printf("%.21Lg") gives 1.08545540462853463561e-4932 g_xLfmt(0) gives 25 bytes: "1.234567890123456789e-301" strtoIxL returns 33, consuming 25 bytes. fI[0] = #3c170000 a953271a 5d069ad8 += 1.08545540462853463524e-4932 fI[1] = #3c170000 a953271a 5d069ad9 += 1.08545540462853463561e-4932 fI[1] == strtoxL @@ -240,11 +297,14 @@ Input: 1.234567890123456789e-321 strtoxL consumes 25 bytes and returns 33 with bits = #3bd40000 f9e11b4c ea6dcce9 +printf("%.21Lg") gives 3.20133479952876185942e-4932 g_xLfmt(0) gives 25 bytes: "1.234567890123456789e-321" strtoIxL returns 33, consuming 25 bytes. fI[0] = #3bd40000 f9e11b4c ea6dcce8 += 3.20133479952876185905e-4932 fI[1] = #3bd40000 f9e11b4c ea6dcce9 += 3.20133479952876185942e-4932 fI[1] == strtoxL @@ -252,6 +312,7 @@ Input: 1e23 strtoxL consumes 4 bytes and returns 1 with bits = #404b0000 a968163f a57b400 +printf("%.21Lg") gives 1.08760331670538037378e-4932 g_xLfmt(0) gives 5 bytes: "1e+23" strtoIxL returns 1, consuming 4 bytes. @@ -262,11 +323,14 @@ Input: 1e310 strtoxL consumes 5 bytes and returns 33 with bits = #44040000 de81e40a 34bcf50 +printf("%.21Lg") gives 2.48237171106260601618e-4932 g_xLfmt(0) gives 6 bytes: "1e+310" strtoIxL returns 33, consuming 5 bytes. fI[0] = #44040000 de81e40a 34bcf4f += 2.48237171106260601582e-4932 fI[1] = #44040000 de81e40a 34bcf50 += 2.48237171106260601618e-4932 fI[1] == strtoxL @@ -274,11 +338,14 @@ Input: 9.0259718793241475e-277 strtoxL consumes 23 bytes and returns 33 with bits = #3c690000 ffffffff fffffcf7 +printf("%.21Lg") gives 3.36210314311209322303e-4932 g_xLfmt(0) gives 23 bytes: "9.0259718793241475e-277" strtoIxL returns 33, consuming 23 bytes. fI[0] = #3c690000 ffffffff fffffcf6 += 3.36210314311209322267e-4932 fI[1] = #3c690000 ffffffff fffffcf7 += 3.36210314311209322303e-4932 fI[1] == strtoxL @@ -286,11 +353,14 @@ Input: 9.025971879324147880346310405869e-277 strtoxL consumes 37 bytes and returns 17 with bits = #3c6a0000 80000000 0 +printf("%.21Lg") gives 3.36210314311209350626e-4932 g_xLfmt(0) gives 26 bytes: "9.0259718793241478803e-277" strtoIxL returns 17, consuming 37 bytes. fI[0] = #3c6a0000 80000000 0 += 3.36210314311209350626e-4932 fI[1] = #3c6a0000 80000000 1 += 3.64519953188247460253e-4951 fI[0] == strtoxL @@ -298,11 +368,14 @@ Input: 9.025971879324147880346310405868e-277 strtoxL consumes 37 bytes and returns 33 with bits = #3c6a0000 80000000 0 +printf("%.21Lg") gives 3.36210314311209350626e-4932 g_xLfmt(0) gives 26 bytes: "9.0259718793241478803e-277" strtoIxL returns 33, consuming 37 bytes. fI[0] = #3c690000 ffffffff ffffffff += 3.3621031431120935059e-4932 fI[1] = #3c6a0000 80000000 0 += 3.36210314311209350626e-4932 fI[1] == strtoxL @@ -310,11 +383,14 @@ Input: 2.2250738585072014e-308 strtoxL consumes 23 bytes and returns 17 with bits = #3c010000 80000000 46 +printf("%.21Lg") gives 2.55163967231773222177e-4949 g_xLfmt(0) gives 23 bytes: "2.2250738585072014e-308" strtoIxL returns 17, consuming 23 bytes. fI[0] = #3c010000 80000000 46 += 2.55163967231773222177e-4949 fI[1] = #3c010000 80000000 47 += 2.5880916676365569678e-4949 fI[0] == strtoxL @@ -322,11 +398,14 @@ Input: 2.2250738585072013e-308 strtoxL consumes 23 bytes and returns 17 with bits = #3c000000 ffffffff fffffd4f +printf("%.21Lg") gives 3.36210314311209325511e-4932 g_xLfmt(0) gives 23 bytes: "2.2250738585072013e-308" strtoIxL returns 17, consuming 23 bytes. fI[0] = #3c000000 ffffffff fffffd4f += 3.36210314311209325511e-4932 fI[1] = #3c000000 ffffffff fffffd50 += 3.36210314311209325547e-4932 fI[0] == strtoxL Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) @@ -335,11 +414,14 @@ Input: 1.1 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 8ccccccc cccccccc +printf("%.21Lg") gives 3.36210314311209350335e-4933 g_xLfmt(0) gives 21 bytes: "1.0999999999999999999" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 8ccccccc cccccccc += 3.36210314311209350335e-4933 fI[1] = #3fff0000 8ccccccc cccccccd += 3.36210314311209350699e-4933 fI[0] == strtoxL @@ -347,11 +429,14 @@ Input: -1.1 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 8ccccccc cccccccc +printf("%.21Lg") gives 3.36210314311209350335e-4933 g_xLfmt(0) gives 22 bytes: "-1.0999999999999999999" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 8ccccccc cccccccd += 3.36210314311209350699e-4933 fI[1] = #bfff0000 8ccccccc cccccccc += 3.36210314311209350335e-4933 fI[1] == strtoxL @@ -359,11 +444,14 @@ Input: 1.2 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 99999999 99999999 +printf("%.21Lg") gives 6.72420628622418701034e-4933 g_xLfmt(0) gives 21 bytes: "1.1999999999999999999" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 99999999 99999999 += 6.72420628622418701034e-4933 fI[1] = #3fff0000 99999999 9999999a += 6.72420628622418701398e-4933 fI[0] == strtoxL @@ -371,11 +459,14 @@ Input: -1.2 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 99999999 99999999 +printf("%.21Lg") gives 6.72420628622418701034e-4933 g_xLfmt(0) gives 22 bytes: "-1.1999999999999999999" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 99999999 9999999a += 6.72420628622418701398e-4933 fI[1] = #bfff0000 99999999 99999999 += 6.72420628622418701034e-4933 fI[1] == strtoxL @@ -383,11 +474,14 @@ Input: 1.3 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 a6666666 66666666 +printf("%.21Lg") gives 1.00863094293362805173e-4932 g_xLfmt(0) gives 3 bytes: "1.3" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 a6666666 66666666 += 1.00863094293362805173e-4932 fI[1] = #3fff0000 a6666666 66666667 += 1.0086309429336280521e-4932 fI[0] == strtoxL @@ -395,11 +489,14 @@ Input: -1.3 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 a6666666 66666666 +printf("%.21Lg") gives 1.00863094293362805173e-4932 g_xLfmt(0) gives 4 bytes: "-1.3" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 a6666666 66666667 += 1.0086309429336280521e-4932 fI[1] = #bfff0000 a6666666 66666666 += 1.00863094293362805173e-4932 fI[1] == strtoxL @@ -407,11 +504,14 @@ Input: 1.4 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 b3333333 33333333 +printf("%.21Lg") gives 1.34484125724483740243e-4932 g_xLfmt(0) gives 3 bytes: "1.4" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 b3333333 33333333 += 1.34484125724483740243e-4932 fI[1] = #3fff0000 b3333333 33333334 += 1.3448412572448374028e-4932 fI[0] == strtoxL @@ -419,11 +519,14 @@ Input: -1.4 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 b3333333 33333333 +printf("%.21Lg") gives 1.34484125724483740243e-4932 g_xLfmt(0) gives 4 bytes: "-1.4" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 b3333333 33333334 += 1.3448412572448374028e-4932 fI[1] = #bfff0000 b3333333 33333333 += 1.34484125724483740243e-4932 fI[1] == strtoxL @@ -431,6 +534,7 @@ Input: 1.5 strtoxL consumes 3 bytes and returns 1 with bits = #3fff0000 c0000000 0 +printf("%.21Lg") gives 1.68105157155604675313e-4932 g_xLfmt(0) gives 3 bytes: "1.5" strtoIxL returns 1, consuming 3 bytes. @@ -441,6 +545,7 @@ Input: -1.5 strtoxL consumes 4 bytes and returns 9 with bits = #bfff0000 c0000000 0 +printf("%.21Lg") gives 1.68105157155604675313e-4932 g_xLfmt(0) gives 4 bytes: "-1.5" strtoIxL returns 9, consuming 4 bytes. @@ -451,11 +556,14 @@ Input: 1.6 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 cccccccc cccccccc +printf("%.21Lg") gives 2.01726188586725610347e-4932 g_xLfmt(0) gives 21 bytes: "1.5999999999999999999" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 cccccccc cccccccc += 2.01726188586725610347e-4932 fI[1] = #3fff0000 cccccccc cccccccd += 2.01726188586725610383e-4932 fI[0] == strtoxL @@ -463,11 +571,14 @@ Input: -1.6 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 cccccccc cccccccc +printf("%.21Lg") gives 2.01726188586725610347e-4932 g_xLfmt(0) gives 22 bytes: "-1.5999999999999999999" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 cccccccc cccccccd += 2.01726188586725610383e-4932 fI[1] = #bfff0000 cccccccc cccccccc += 2.01726188586725610347e-4932 fI[1] == strtoxL @@ -475,11 +586,14 @@ Input: 1.7 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 d9999999 99999999 +printf("%.21Lg") gives 2.35347220017846545417e-4932 g_xLfmt(0) gives 21 bytes: "1.6999999999999999999" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 d9999999 99999999 += 2.35347220017846545417e-4932 fI[1] = #3fff0000 d9999999 9999999a += 2.35347220017846545453e-4932 fI[0] == strtoxL @@ -487,11 +601,14 @@ Input: -1.7 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 d9999999 99999999 +printf("%.21Lg") gives 2.35347220017846545417e-4932 g_xLfmt(0) gives 22 bytes: "-1.6999999999999999999" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 d9999999 9999999a += 2.35347220017846545453e-4932 fI[1] = #bfff0000 d9999999 99999999 += 2.35347220017846545417e-4932 fI[1] == strtoxL @@ -499,11 +616,14 @@ Input: 1.8 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 e6666666 66666666 +printf("%.21Lg") gives 2.68968251448967480486e-4932 g_xLfmt(0) gives 3 bytes: "1.8" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 e6666666 66666666 += 2.68968251448967480486e-4932 fI[1] = #3fff0000 e6666666 66666667 += 2.68968251448967480523e-4932 fI[0] == strtoxL @@ -511,11 +631,14 @@ Input: -1.8 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 e6666666 66666666 +printf("%.21Lg") gives 2.68968251448967480486e-4932 g_xLfmt(0) gives 4 bytes: "-1.8" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 e6666666 66666667 += 2.68968251448967480523e-4932 fI[1] = #bfff0000 e6666666 66666666 += 2.68968251448967480486e-4932 fI[1] == strtoxL @@ -523,11 +646,14 @@ Input: 1.9 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 f3333333 33333333 +printf("%.21Lg") gives 3.02589282880088415556e-4932 g_xLfmt(0) gives 3 bytes: "1.9" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 f3333333 33333333 += 3.02589282880088415556e-4932 fI[1] = #3fff0000 f3333333 33333334 += 3.02589282880088415593e-4932 fI[0] == strtoxL @@ -535,11 +661,14 @@ Input: -1.9 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 f3333333 33333333 +printf("%.21Lg") gives 3.02589282880088415556e-4932 g_xLfmt(0) gives 4 bytes: "-1.9" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 f3333333 33333334 += 3.02589282880088415593e-4932 fI[1] = #bfff0000 f3333333 33333333 += 3.02589282880088415556e-4932 fI[1] == strtoxL Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) @@ -548,11 +677,14 @@ Input: 1.1 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 8ccccccc cccccccd +printf("%.21Lg") gives 3.36210314311209350699e-4933 g_xLfmt(0) gives 3 bytes: "1.1" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 8ccccccc cccccccc += 3.36210314311209350335e-4933 fI[1] = #3fff0000 8ccccccc cccccccd += 3.36210314311209350699e-4933 fI[1] == strtoxL @@ -560,11 +692,14 @@ Input: -1.1 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 8ccccccc cccccccd +printf("%.21Lg") gives 3.36210314311209350699e-4933 g_xLfmt(0) gives 4 bytes: "-1.1" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 8ccccccc cccccccd += 3.36210314311209350699e-4933 fI[1] = #bfff0000 8ccccccc cccccccc += 3.36210314311209350335e-4933 fI[0] == strtoxL @@ -572,11 +707,14 @@ Input: 1.2 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 99999999 9999999a +printf("%.21Lg") gives 6.72420628622418701398e-4933 g_xLfmt(0) gives 3 bytes: "1.2" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 99999999 99999999 += 6.72420628622418701034e-4933 fI[1] = #3fff0000 99999999 9999999a += 6.72420628622418701398e-4933 fI[1] == strtoxL @@ -584,11 +722,14 @@ Input: -1.2 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 99999999 9999999a +printf("%.21Lg") gives 6.72420628622418701398e-4933 g_xLfmt(0) gives 4 bytes: "-1.2" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 99999999 9999999a += 6.72420628622418701398e-4933 fI[1] = #bfff0000 99999999 99999999 += 6.72420628622418701034e-4933 fI[0] == strtoxL @@ -596,11 +737,14 @@ Input: 1.3 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 a6666666 66666666 +printf("%.21Lg") gives 1.00863094293362805173e-4932 g_xLfmt(0) gives 3 bytes: "1.3" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 a6666666 66666666 += 1.00863094293362805173e-4932 fI[1] = #3fff0000 a6666666 66666667 += 1.0086309429336280521e-4932 fI[0] == strtoxL @@ -608,11 +752,14 @@ Input: -1.3 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 a6666666 66666666 +printf("%.21Lg") gives 1.00863094293362805173e-4932 g_xLfmt(0) gives 4 bytes: "-1.3" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 a6666666 66666667 += 1.0086309429336280521e-4932 fI[1] = #bfff0000 a6666666 66666666 += 1.00863094293362805173e-4932 fI[1] == strtoxL @@ -620,11 +767,14 @@ Input: 1.4 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 b3333333 33333333 +printf("%.21Lg") gives 1.34484125724483740243e-4932 g_xLfmt(0) gives 3 bytes: "1.4" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 b3333333 33333333 += 1.34484125724483740243e-4932 fI[1] = #3fff0000 b3333333 33333334 += 1.3448412572448374028e-4932 fI[0] == strtoxL @@ -632,11 +782,14 @@ Input: -1.4 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 b3333333 33333333 +printf("%.21Lg") gives 1.34484125724483740243e-4932 g_xLfmt(0) gives 4 bytes: "-1.4" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 b3333333 33333334 += 1.3448412572448374028e-4932 fI[1] = #bfff0000 b3333333 33333333 += 1.34484125724483740243e-4932 fI[1] == strtoxL @@ -644,6 +797,7 @@ Input: 1.5 strtoxL consumes 3 bytes and returns 1 with bits = #3fff0000 c0000000 0 +printf("%.21Lg") gives 1.68105157155604675313e-4932 g_xLfmt(0) gives 3 bytes: "1.5" strtoIxL returns 1, consuming 3 bytes. @@ -654,6 +808,7 @@ Input: -1.5 strtoxL consumes 4 bytes and returns 9 with bits = #bfff0000 c0000000 0 +printf("%.21Lg") gives 1.68105157155604675313e-4932 g_xLfmt(0) gives 4 bytes: "-1.5" strtoIxL returns 9, consuming 4 bytes. @@ -664,11 +819,14 @@ Input: 1.6 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 cccccccc cccccccd +printf("%.21Lg") gives 2.01726188586725610383e-4932 g_xLfmt(0) gives 3 bytes: "1.6" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 cccccccc cccccccc += 2.01726188586725610347e-4932 fI[1] = #3fff0000 cccccccc cccccccd += 2.01726188586725610383e-4932 fI[1] == strtoxL @@ -676,11 +834,14 @@ Input: -1.6 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 cccccccc cccccccd +printf("%.21Lg") gives 2.01726188586725610383e-4932 g_xLfmt(0) gives 4 bytes: "-1.6" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 cccccccc cccccccd += 2.01726188586725610383e-4932 fI[1] = #bfff0000 cccccccc cccccccc += 2.01726188586725610347e-4932 fI[0] == strtoxL @@ -688,11 +849,14 @@ Input: 1.7 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 d9999999 9999999a +printf("%.21Lg") gives 2.35347220017846545453e-4932 g_xLfmt(0) gives 3 bytes: "1.7" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 d9999999 99999999 += 2.35347220017846545417e-4932 fI[1] = #3fff0000 d9999999 9999999a += 2.35347220017846545453e-4932 fI[1] == strtoxL @@ -700,11 +864,14 @@ Input: -1.7 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 d9999999 9999999a +printf("%.21Lg") gives 2.35347220017846545453e-4932 g_xLfmt(0) gives 4 bytes: "-1.7" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 d9999999 9999999a += 2.35347220017846545453e-4932 fI[1] = #bfff0000 d9999999 99999999 += 2.35347220017846545417e-4932 fI[0] == strtoxL @@ -712,11 +879,14 @@ Input: 1.8 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 e6666666 66666666 +printf("%.21Lg") gives 2.68968251448967480486e-4932 g_xLfmt(0) gives 3 bytes: "1.8" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 e6666666 66666666 += 2.68968251448967480486e-4932 fI[1] = #3fff0000 e6666666 66666667 += 2.68968251448967480523e-4932 fI[0] == strtoxL @@ -724,11 +894,14 @@ Input: -1.8 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 e6666666 66666666 +printf("%.21Lg") gives 2.68968251448967480486e-4932 g_xLfmt(0) gives 4 bytes: "-1.8" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 e6666666 66666667 += 2.68968251448967480523e-4932 fI[1] = #bfff0000 e6666666 66666666 += 2.68968251448967480486e-4932 fI[1] == strtoxL @@ -736,11 +909,14 @@ Input: 1.9 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 f3333333 33333333 +printf("%.21Lg") gives 3.02589282880088415556e-4932 g_xLfmt(0) gives 3 bytes: "1.9" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 f3333333 33333333 += 3.02589282880088415556e-4932 fI[1] = #3fff0000 f3333333 33333334 += 3.02589282880088415593e-4932 fI[0] == strtoxL @@ -748,11 +924,14 @@ Input: -1.9 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 f3333333 33333333 +printf("%.21Lg") gives 3.02589282880088415556e-4932 g_xLfmt(0) gives 4 bytes: "-1.9" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 f3333333 33333334 += 3.02589282880088415593e-4932 fI[1] = #bfff0000 f3333333 33333333 += 3.02589282880088415556e-4932 fI[1] == strtoxL Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) @@ -761,11 +940,14 @@ Input: 1.1 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 8ccccccc cccccccd +printf("%.21Lg") gives 3.36210314311209350699e-4933 g_xLfmt(0) gives 3 bytes: "1.1" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 8ccccccc cccccccc += 3.36210314311209350335e-4933 fI[1] = #3fff0000 8ccccccc cccccccd += 3.36210314311209350699e-4933 fI[1] == strtoxL @@ -773,11 +955,14 @@ Input: -1.1 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 8ccccccc cccccccc +printf("%.21Lg") gives 3.36210314311209350335e-4933 g_xLfmt(0) gives 22 bytes: "-1.0999999999999999999" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 8ccccccc cccccccd += 3.36210314311209350699e-4933 fI[1] = #bfff0000 8ccccccc cccccccc += 3.36210314311209350335e-4933 fI[1] == strtoxL @@ -785,11 +970,14 @@ Input: 1.2 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 99999999 9999999a +printf("%.21Lg") gives 6.72420628622418701398e-4933 g_xLfmt(0) gives 3 bytes: "1.2" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 99999999 99999999 += 6.72420628622418701034e-4933 fI[1] = #3fff0000 99999999 9999999a += 6.72420628622418701398e-4933 fI[1] == strtoxL @@ -797,11 +985,14 @@ Input: -1.2 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 99999999 99999999 +printf("%.21Lg") gives 6.72420628622418701034e-4933 g_xLfmt(0) gives 22 bytes: "-1.1999999999999999999" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 99999999 9999999a += 6.72420628622418701398e-4933 fI[1] = #bfff0000 99999999 99999999 += 6.72420628622418701034e-4933 fI[1] == strtoxL @@ -809,11 +1000,14 @@ Input: 1.3 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 a6666666 66666667 +printf("%.21Lg") gives 1.0086309429336280521e-4932 g_xLfmt(0) gives 21 bytes: "1.3000000000000000001" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 a6666666 66666666 += 1.00863094293362805173e-4932 fI[1] = #3fff0000 a6666666 66666667 += 1.0086309429336280521e-4932 fI[1] == strtoxL @@ -821,11 +1015,14 @@ Input: -1.3 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 a6666666 66666666 +printf("%.21Lg") gives 1.00863094293362805173e-4932 g_xLfmt(0) gives 4 bytes: "-1.3" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 a6666666 66666667 += 1.0086309429336280521e-4932 fI[1] = #bfff0000 a6666666 66666666 += 1.00863094293362805173e-4932 fI[1] == strtoxL @@ -833,11 +1030,14 @@ Input: 1.4 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 b3333333 33333334 +printf("%.21Lg") gives 1.3448412572448374028e-4932 g_xLfmt(0) gives 21 bytes: "1.4000000000000000001" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 b3333333 33333333 += 1.34484125724483740243e-4932 fI[1] = #3fff0000 b3333333 33333334 += 1.3448412572448374028e-4932 fI[1] == strtoxL @@ -845,11 +1045,14 @@ Input: -1.4 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 b3333333 33333333 +printf("%.21Lg") gives 1.34484125724483740243e-4932 g_xLfmt(0) gives 4 bytes: "-1.4" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 b3333333 33333334 += 1.3448412572448374028e-4932 fI[1] = #bfff0000 b3333333 33333333 += 1.34484125724483740243e-4932 fI[1] == strtoxL @@ -857,6 +1060,7 @@ Input: 1.5 strtoxL consumes 3 bytes and returns 1 with bits = #3fff0000 c0000000 0 +printf("%.21Lg") gives 1.68105157155604675313e-4932 g_xLfmt(0) gives 3 bytes: "1.5" strtoIxL returns 1, consuming 3 bytes. @@ -867,6 +1071,7 @@ Input: -1.5 strtoxL consumes 4 bytes and returns 9 with bits = #bfff0000 c0000000 0 +printf("%.21Lg") gives 1.68105157155604675313e-4932 g_xLfmt(0) gives 4 bytes: "-1.5" strtoIxL returns 9, consuming 4 bytes. @@ -877,11 +1082,14 @@ Input: 1.6 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 cccccccc cccccccd +printf("%.21Lg") gives 2.01726188586725610383e-4932 g_xLfmt(0) gives 3 bytes: "1.6" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 cccccccc cccccccc += 2.01726188586725610347e-4932 fI[1] = #3fff0000 cccccccc cccccccd += 2.01726188586725610383e-4932 fI[1] == strtoxL @@ -889,11 +1097,14 @@ Input: -1.6 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 cccccccc cccccccc +printf("%.21Lg") gives 2.01726188586725610347e-4932 g_xLfmt(0) gives 22 bytes: "-1.5999999999999999999" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 cccccccc cccccccd += 2.01726188586725610383e-4932 fI[1] = #bfff0000 cccccccc cccccccc += 2.01726188586725610347e-4932 fI[1] == strtoxL @@ -901,11 +1112,14 @@ Input: 1.7 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 d9999999 9999999a +printf("%.21Lg") gives 2.35347220017846545453e-4932 g_xLfmt(0) gives 3 bytes: "1.7" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 d9999999 99999999 += 2.35347220017846545417e-4932 fI[1] = #3fff0000 d9999999 9999999a += 2.35347220017846545453e-4932 fI[1] == strtoxL @@ -913,11 +1127,14 @@ Input: -1.7 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 d9999999 99999999 +printf("%.21Lg") gives 2.35347220017846545417e-4932 g_xLfmt(0) gives 22 bytes: "-1.6999999999999999999" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 d9999999 9999999a += 2.35347220017846545453e-4932 fI[1] = #bfff0000 d9999999 99999999 += 2.35347220017846545417e-4932 fI[1] == strtoxL @@ -925,11 +1142,14 @@ Input: 1.8 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 e6666666 66666667 +printf("%.21Lg") gives 2.68968251448967480523e-4932 g_xLfmt(0) gives 21 bytes: "1.8000000000000000001" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 e6666666 66666666 += 2.68968251448967480486e-4932 fI[1] = #3fff0000 e6666666 66666667 += 2.68968251448967480523e-4932 fI[1] == strtoxL @@ -937,11 +1157,14 @@ Input: -1.8 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 e6666666 66666666 +printf("%.21Lg") gives 2.68968251448967480486e-4932 g_xLfmt(0) gives 4 bytes: "-1.8" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 e6666666 66666667 += 2.68968251448967480523e-4932 fI[1] = #bfff0000 e6666666 66666666 += 2.68968251448967480486e-4932 fI[1] == strtoxL @@ -949,11 +1172,14 @@ Input: 1.9 strtoxL consumes 3 bytes and returns 33 with bits = #3fff0000 f3333333 33333334 +printf("%.21Lg") gives 3.02589282880088415593e-4932 g_xLfmt(0) gives 21 bytes: "1.9000000000000000001" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 f3333333 33333333 += 3.02589282880088415556e-4932 fI[1] = #3fff0000 f3333333 33333334 += 3.02589282880088415593e-4932 fI[1] == strtoxL @@ -961,11 +1187,14 @@ Input: -1.9 strtoxL consumes 4 bytes and returns 25 with bits = #bfff0000 f3333333 33333333 +printf("%.21Lg") gives 3.02589282880088415556e-4932 g_xLfmt(0) gives 4 bytes: "-1.9" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 f3333333 33333334 += 3.02589282880088415593e-4932 fI[1] = #bfff0000 f3333333 33333333 += 3.02589282880088415556e-4932 fI[1] == strtoxL Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) @@ -974,11 +1203,14 @@ Input: 1.1 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 8ccccccc cccccccc +printf("%.21Lg") gives 3.36210314311209350335e-4933 g_xLfmt(0) gives 21 bytes: "1.0999999999999999999" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 8ccccccc cccccccc += 3.36210314311209350335e-4933 fI[1] = #3fff0000 8ccccccc cccccccd += 3.36210314311209350699e-4933 fI[0] == strtoxL @@ -986,11 +1218,14 @@ Input: -1.1 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 8ccccccc cccccccd +printf("%.21Lg") gives 3.36210314311209350699e-4933 g_xLfmt(0) gives 4 bytes: "-1.1" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 8ccccccc cccccccd += 3.36210314311209350699e-4933 fI[1] = #bfff0000 8ccccccc cccccccc += 3.36210314311209350335e-4933 fI[0] == strtoxL @@ -998,11 +1233,14 @@ Input: 1.2 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 99999999 99999999 +printf("%.21Lg") gives 6.72420628622418701034e-4933 g_xLfmt(0) gives 21 bytes: "1.1999999999999999999" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 99999999 99999999 += 6.72420628622418701034e-4933 fI[1] = #3fff0000 99999999 9999999a += 6.72420628622418701398e-4933 fI[0] == strtoxL @@ -1010,11 +1248,14 @@ Input: -1.2 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 99999999 9999999a +printf("%.21Lg") gives 6.72420628622418701398e-4933 g_xLfmt(0) gives 4 bytes: "-1.2" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 99999999 9999999a += 6.72420628622418701398e-4933 fI[1] = #bfff0000 99999999 99999999 += 6.72420628622418701034e-4933 fI[0] == strtoxL @@ -1022,11 +1263,14 @@ Input: 1.3 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 a6666666 66666666 +printf("%.21Lg") gives 1.00863094293362805173e-4932 g_xLfmt(0) gives 3 bytes: "1.3" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 a6666666 66666666 += 1.00863094293362805173e-4932 fI[1] = #3fff0000 a6666666 66666667 += 1.0086309429336280521e-4932 fI[0] == strtoxL @@ -1034,11 +1278,14 @@ Input: -1.3 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 a6666666 66666667 +printf("%.21Lg") gives 1.0086309429336280521e-4932 g_xLfmt(0) gives 22 bytes: "-1.3000000000000000001" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 a6666666 66666667 += 1.0086309429336280521e-4932 fI[1] = #bfff0000 a6666666 66666666 += 1.00863094293362805173e-4932 fI[0] == strtoxL @@ -1046,11 +1293,14 @@ Input: 1.4 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 b3333333 33333333 +printf("%.21Lg") gives 1.34484125724483740243e-4932 g_xLfmt(0) gives 3 bytes: "1.4" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 b3333333 33333333 += 1.34484125724483740243e-4932 fI[1] = #3fff0000 b3333333 33333334 += 1.3448412572448374028e-4932 fI[0] == strtoxL @@ -1058,11 +1308,14 @@ Input: -1.4 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 b3333333 33333334 +printf("%.21Lg") gives 1.3448412572448374028e-4932 g_xLfmt(0) gives 22 bytes: "-1.4000000000000000001" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 b3333333 33333334 += 1.3448412572448374028e-4932 fI[1] = #bfff0000 b3333333 33333333 += 1.34484125724483740243e-4932 fI[0] == strtoxL @@ -1070,6 +1323,7 @@ Input: 1.5 strtoxL consumes 3 bytes and returns 1 with bits = #3fff0000 c0000000 0 +printf("%.21Lg") gives 1.68105157155604675313e-4932 g_xLfmt(0) gives 3 bytes: "1.5" strtoIxL returns 1, consuming 3 bytes. @@ -1080,6 +1334,7 @@ Input: -1.5 strtoxL consumes 4 bytes and returns 9 with bits = #bfff0000 c0000000 0 +printf("%.21Lg") gives 1.68105157155604675313e-4932 g_xLfmt(0) gives 4 bytes: "-1.5" strtoIxL returns 9, consuming 4 bytes. @@ -1090,11 +1345,14 @@ Input: 1.6 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 cccccccc cccccccc +printf("%.21Lg") gives 2.01726188586725610347e-4932 g_xLfmt(0) gives 21 bytes: "1.5999999999999999999" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 cccccccc cccccccc += 2.01726188586725610347e-4932 fI[1] = #3fff0000 cccccccc cccccccd += 2.01726188586725610383e-4932 fI[0] == strtoxL @@ -1102,11 +1360,14 @@ Input: -1.6 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 cccccccc cccccccd +printf("%.21Lg") gives 2.01726188586725610383e-4932 g_xLfmt(0) gives 4 bytes: "-1.6" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 cccccccc cccccccd += 2.01726188586725610383e-4932 fI[1] = #bfff0000 cccccccc cccccccc += 2.01726188586725610347e-4932 fI[0] == strtoxL @@ -1114,11 +1375,14 @@ Input: 1.7 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 d9999999 99999999 +printf("%.21Lg") gives 2.35347220017846545417e-4932 g_xLfmt(0) gives 21 bytes: "1.6999999999999999999" strtoIxL returns 33, consuming 3 bytes. fI[0] = #3fff0000 d9999999 99999999 += 2.35347220017846545417e-4932 fI[1] = #3fff0000 d9999999 9999999a += 2.35347220017846545453e-4932 fI[0] == strtoxL @@ -1126,11 +1390,14 @@ Input: -1.7 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 d9999999 9999999a +printf("%.21Lg") gives 2.35347220017846545453e-4932 g_xLfmt(0) gives 4 bytes: "-1.7" strtoIxL returns 41, consuming 4 bytes. fI[0] = #bfff0000 d9999999 9999999a += 2.35347220017846545453e-4932 fI[1] = #bfff0000 d9999999 99999999 += 2.35347220017846545417e-4932 fI[0] == strtoxL @@ -1138,11 +1405,14 @@ Input: 1.8 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 e6666666 66666666 +printf("%.21Lg") gives 2.68968251448967480486e-4932 g_xLfmt(0) gives 3 bytes: "1.8" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 e6666666 66666666 += 2.68968251448967480486e-4932 fI[1] = #3fff0000 e6666666 66666667 += 2.68968251448967480523e-4932 fI[0] == strtoxL @@ -1150,11 +1420,14 @@ Input: -1.8 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 e6666666 66666667 +printf("%.21Lg") gives 2.68968251448967480523e-4932 g_xLfmt(0) gives 22 bytes: "-1.8000000000000000001" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 e6666666 66666667 += 2.68968251448967480523e-4932 fI[1] = #bfff0000 e6666666 66666666 += 2.68968251448967480486e-4932 fI[0] == strtoxL @@ -1162,11 +1435,14 @@ Input: 1.9 strtoxL consumes 3 bytes and returns 17 with bits = #3fff0000 f3333333 33333333 +printf("%.21Lg") gives 3.02589282880088415556e-4932 g_xLfmt(0) gives 3 bytes: "1.9" strtoIxL returns 17, consuming 3 bytes. fI[0] = #3fff0000 f3333333 33333333 += 3.02589282880088415556e-4932 fI[1] = #3fff0000 f3333333 33333334 += 3.02589282880088415593e-4932 fI[0] == strtoxL @@ -1174,10 +1450,13 @@ Input: -1.9 strtoxL consumes 4 bytes and returns 41 with bits = #bfff0000 f3333333 33333334 +printf("%.21Lg") gives 3.02589282880088415593e-4932 g_xLfmt(0) gives 22 bytes: "-1.9000000000000000001" strtoIxL returns 25, consuming 4 bytes. fI[0] = #bfff0000 f3333333 33333334 += 3.02589282880088415593e-4932 fI[1] = #bfff0000 f3333333 33333333 += 3.02589282880088415556e-4932 fI[0] == strtoxL diff --git a/contrib/gdtoa/test/xLtest.c b/contrib/gdtoa/test/xLtest.c index c923e19dcfbc..aba0cf538041 100644 --- a/contrib/gdtoa/test/xLtest.c +++ b/contrib/gdtoa/test/xLtest.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test program for g_xLfmt, strtoIxL, strtopxL, and strtorxL. * @@ -85,7 +79,7 @@ THIS SOFTWARE. int main(Void) { - char *s, *se, *se1; + char *s, *s1, *se, *se1; int dItry, i, ndig = 0, r = 1; union { long double d; ULong bits[3]; } u, v[2]; @@ -106,8 +100,14 @@ main(Void) } break; /* nan? */ case '#': - sscanf(s+1, "%lx %lx %lx", &u.bits[_0], - &u.bits[_1], &u.bits[_2]); + /* sscanf(s+1, "%lx %lx %lx", &u.bits[_0], */ + /* &u.bits[_1], &u.bits[_2]); */ + u.bits[_0] = (ULong)strtoul(s1 = s+1, &se, 16); + if (se > s1) { + u.bits[_1] = (ULong)strtoul(s1=se, &se, 16); + if (se > s1) + u.bits[_2] = (ULong)strtoul(s1=se, &se, 16); + } printf("\nInput: %s", ibuf); printf(" --> f = #%lx %lx %lx\n", u.bits[_0], u.bits[_1], u.bits[_2]); diff --git a/contrib/gdtoa/test/xsum0.out b/contrib/gdtoa/test/xsum0.out index ee59cdacd29d..67bbe69e2327 100644 --- a/contrib/gdtoa/test/xsum0.out +++ b/contrib/gdtoa/test/xsum0.out @@ -1,20 +1,20 @@ README e6ebdc91 2429 -Qtest.c 140625e2 4778 -dItest.c 8689031 2401 -ddtest.c ea24d330 4943 -dtest.c 900d971 4071 -dt.c addb61c 6198 -ftest.c f609ce43 3958 -getround.c f471599 2041 +Qtest.c e8353ffc 5046 +dItest.c e33800ce 2371 +ddtest.c f9d06e7b 4984 +dtest.c ee533ac3 4078 +dt.c 7eeda57 6384 +ftest.c ec8a6654 3999 +getround.c f810968 2011 strtoIdSI.c 7bfb88b 49 strtoIddSI.c 72e8852 50 strtodISI.c ed08b740 49 -strtodt.c 17aca428 3213 +strtodt.c aaf94bc 3330 strtopddSI.c 13e7138d 50 strtorddSI.c f7e4b1d5 50 -xLtest.c faca328f 4646 +xLtest.c f3f96ad1 4833 xQtest.c efdea3a2 1549 -xtest.c 1f19b87 4858 +xtest.c ee81e661 4830 rtestnos f94bcdf6 336 testnos e89999d6 485 testnos1 7e16229 294 @@ -23,13 +23,13 @@ dI.out d522eef 4369 dIsi.out 1dd6d02f 4350 ddsi.out 1f94bbe2 10251 dd.out e262456e 40923 -dtst.out ee75f6b9 23308 +dtst.out e284ac98 23711 d.out f271efc9 28131 f.out 4b0bd51 21207 -x.ou0 1cfc5d22 25378 +x.ou0 1402f834 25372 xL.ou0 faa3a741 26363 -x.ou1 1a7e9dd4 34587 -xL.ou1 418057a 26476 +x.ou1 f1af5a00 34581 +xL.ou1 e349e5c 37165 Q.ou0 e4592b85 28742 Q.ou1 ea0b344d 39572 -makefile ebbea1e1 4191 +makefile b77232c 4939 diff --git a/contrib/gdtoa/test/xtest.c b/contrib/gdtoa/test/xtest.c index bd2b00804245..86d7fba01ce7 100644 --- a/contrib/gdtoa/test/xtest.c +++ b/contrib/gdtoa/test/xtest.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ /* Test program for g_xfmt, strtoIx, strtopx, and strtorx. * @@ -108,12 +102,12 @@ main(Void) } break; /* nan? */ case '#': - sscanf(s+1, "%hx %hx %hx %hx hx", &u.bits[_0], + sscanf(s+1, "%hx %hx %hx %hx %hx", &u.bits[_0], &u.bits[_1], &u.bits[_2], &u.bits[_3], &u.bits[_4]); printf("\nInput: %s", ibuf); printf(" --> f = #%x %x %x %x %x\n", u.bits[_0], - u.bits[_1], u.bits[_2], u.bits[_3], u.bits[4]); + u.bits[_1], u.bits[_2], u.bits[_3], u.bits[_4]); goto fmt_test; } dItry = 1; @@ -159,8 +153,8 @@ main(Void) printf("= %.21Lg\n", v[0].d); printf("fI[1] = #%x %x %x %x %x\n", v[1].bits[_0], v[1].bits[_1], - v[1].bits[_2], v[0].bits[_3], - v[0].bits[_4]); + v[1].bits[_2], v[1].bits[_3], + v[1].bits[_4]); if (sizeof(long double) == 12) printf("= %.21Lg\n", v[1].d); if (!memcmp(v[0].bits, u.bits, 10)) diff --git a/contrib/gdtoa/ulp.c b/contrib/gdtoa/ulp.c index 536994a3dec6..7810a5c8e642 100644 --- a/contrib/gdtoa/ulp.c +++ b/contrib/gdtoa/ulp.c @@ -26,14 +26,8 @@ THIS SOFTWARE. ****************************************************************/ -/* Please send bug reports to - David M. Gay - Bell Laboratories, Room 2C-463 - 600 Mountain Avenue - Murray Hill, NJ 07974-0636 - U.S.A. - dmg@bell-labs.com - */ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" diff --git a/contrib/gdtoa/xsum0.out b/contrib/gdtoa/xsum0.out index b61d0f0bb64d..701b55d31d52 100644 --- a/contrib/gdtoa/xsum0.out +++ b/contrib/gdtoa/xsum0.out @@ -1,46 +1,48 @@ -README c9c34c1 13153 -arithchk.c e37b8a75 4070 -dmisc.c e8d262b6 4712 -dtoa.c f3c132b3 16905 -g_Qfmt.c e5847e9 2870 -g__fmt.c ee5f9be0 2439 -g_ddfmt.c fcf94527 3790 -g_dfmt.c f30e55a9 2533 -g_ffmt.c 7c4ea96 2459 -g_xLfmt.c 36ee116 2716 -g_xfmt.c c20a5e4 2795 -gdtoa.c 364a0d2 17017 -gdtoa.h 1eb440de 4810 -gdtoaimp.h 6a955ba 19106 -gethex.c 1c586a03 5075 -gmisc.c e1a268ea 2114 -hd_init.c cf9a94e 1827 -hexnan.c f53be1da 2988 -makefile e84d078f 2802 -misc.c ea539bdb 14168 -smisc.c f659f036 3685 -strtoIQ.c 13ac9f44 1969 -strtoId.c d05a7a6 1961 -strtoIdd.c fa36260d 2135 -strtoIf.c eb75ac99 1905 -strtoIg.c ec59c2fa 3484 -strtoIx.c 8f8c9d 1990 -strtoIxL.c 1313ff7f 1961 -strtod.c fd6556c8 19985 -strtodI.c e58338e0 4062 -strtodg.c e04b9254 19458 -strtof.c 1e7a787a 2202 -strtopQ.c e232c542 2685 -strtopd.c e865dc64 1701 -strtopdd.c 1c240126 4540 -strtopf.c 1c762782 2196 -strtopx.c 17c3fafb 2665 -strtopxL.c ed474cdb 2505 -strtorQ.c 126cc92b 2898 -strtord.c 1fce44b9 2528 -strtordd.c c32bca0 4979 -strtorf.c fe6a2687 2430 -strtorx.c 18389f0c 2888 -strtorxL.c f63fc249 2730 -sum.c dc07b9b 2524 -ulp.c f6db0b4d 1894 +README f2477cff 14190 +arithchk.c ebbe5bc7 4075 +dmisc.c c8daa18 4682 +dtoa.c 6a7b6fe 16876 +g_Qfmt.c f791d807 2839 +g__fmt.c 14dca85 2504 +g_ddfmt.c 10eae12a 3695 +g_dfmt.c f36c1014 2503 +g_ffmt.c fb83cfb5 2429 +g_xLfmt.c f216a096 2686 +g_xfmt.c ed824bf3 2775 +gdtoa.c e29409a6 16988 +gdtoa.h f208c204 4780 +gdtoaimp.h e3c2a970 19441 +gethex.c dba1616 5201 +gmisc.c 1859d016 2084 +hd_init.c efdbe921 1797 +hexnan.c f7ea38f9 2958 +makefile f890b12 2932 +misc.c 1757f7fc 14252 +qnan.c efd33d64 3417 +smisc.c e282e715 3655 +strtoIQ.c 1809dfcf 1939 +strtoId.c f41ddac2 1931 +strtoIdd.c f13e3bc3 2105 +strtoIf.c f12c6af4 1875 +strtoIg.c ef30d392 3454 +strtoIx.c e50f716d 1960 +strtoIxL.c ea0b821b 1931 +strtod.c eec1df60 20532 +strtodI.c 1c2440ce 3915 +strtodg.c f6c3dd52 19911 +strtodnrp.c af895e9 2538 +strtof.c 1c5192d3 2073 +strtopQ.c f116d4f0 2563 +strtopd.c f7681c7a 1671 +strtopdd.c 9864fba 4497 +strtopf.c eb15b627 2067 +strtopx.c 1cafe482 2618 +strtopxL.c 1e4b77e9 2373 +strtorQ.c 9360a0b 2885 +strtord.c af5c50e 2491 +strtordd.c 1b266865 4936 +strtorf.c f0d86e2b 2396 +strtorx.c f19a56af 2947 +strtorxL.c 167fe87c 2704 +sum.c f525bad9 2494 +ulp.c 1e2e148f 1864