diff --git a/bin/Makefile.incl b/bin/Makefile.incl index fa7e194..47986f7 100644 --- a/bin/Makefile.incl +++ b/bin/Makefile.incl @@ -2,7 +2,7 @@ CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -Wno-unused-command-line-argument -INCLUDES = -I../../include +INCLUDES = -I../../include_old #LIBRARIES = ../../lib/libc_old/math/*.o ../../lib/libc_old/quad/*.o ../../lib/libc_old/stdio/*.o ../../lib/libc_old/stdlib/*.o ../../lib/libc_old/sys/*.o ../../lib/libc_old/string/*.o ../../lib/libc_old/locale/*.o ../../lib/libc_old/gen/*.o ../../lib/libc_old/generic/*.o ../../lib/libc_old/*/*.o diff --git a/contrib/gdtoa/README b/contrib/gdtoa/README index 6bece75..0c034f1 100644 --- a/contrib/gdtoa/README +++ b/contrib/gdtoa/README @@ -56,7 +56,9 @@ whose sum is the desired value For decimal -> binary conversions, there are three families of -helper routines: one for round-nearest: +helper routines: one for round-nearest (or the current rounding +mode on IEEE-arithmetic systems that provide the C99 fegetround() +function, if compiled with -DHonor_FLT_ROUNDS): strtof strtod @@ -144,18 +146,33 @@ 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: @@ -176,6 +193,9 @@ conversion are easily done with the help of gdtoa(), such as %e or %f style and conversions with direction of rounding specified (so that, if desired, the decimal value is either >= or <= the binary value). +On IEEE-arithmetic systems that provide the C99 fegetround() function, +if compiled with -DHonor_FLT_ROUNDS, these routines honor the current +rounding mode. For an example of more general conversions based on dtoa(), see netlib's "printf.c from ampl/solvers". @@ -213,7 +233,7 @@ 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 +337,28 @@ the decimal-point character to be taken from the current locale; otherwise it is '.'. -Please send comments to +Source files dtoa.c and strtod.c in this directory are derived from +netlib's "dtoa.c from fp" and are meant to function equivalently. +When compiled with Honor_FLT_ROUNDS #defined (on systems that provide +FLT_ROUNDS and fegetround() as specified in the C99 standard), they +honor the current rounding mode. Because FLT_ROUNDS is buggy on some +(Linux) systems -- not reflecting calls on fesetround(), as the C99 +standard says it should -- when Honor_FLT_ROUNDS is #defined, the +current rounding mode is obtained from fegetround() rather than from +FLT_ROUNDS, unless Trust_FLT_ROUNDS is also #defined. - David M. Gay - dmg@acm.org +Compile with -DUSE_LOCALE to use the current locale; otherwise +decimal points are assumed to be '.'. With -DUSE_LOCALE, unless +you also compile with -DNO_LOCALE_CACHE, the details about the +current "decimal point" character string are cached and assumed not +to change during the program's execution. + +On machines with a 64-bit long double and perhaps a 113-bit "quad" +type, you can invoke "make Printf" to add Printf (and variants, such +as Fprintf) to gdtoa.a. These are analogs, declared in stdio1.h, of +printf and fprintf, etc. in which %La, %Le, %Lf, and %Lg are for long +double and (if appropriate) %Lqa, %Lqe, %Lqf, and %Lqg are for quad +precision printing. + +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 59eaad7..3211aed 100644 --- a/contrib/gdtoa/arithchk.c +++ b/contrib/gdtoa/arithchk.c @@ -136,6 +136,7 @@ return b == 0.; } + int main() { Akind *a = 0; diff --git a/contrib/gdtoa/dmisc.c b/contrib/gdtoa/dmisc.c index 14b5d7e..ce170c7 100644 --- a/contrib/gdtoa/dmisc.c +++ b/contrib/gdtoa/dmisc.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 20e2405..6e5de30 100644 --- a/contrib/gdtoa/dtoa.c +++ b/contrib/gdtoa/dtoa.c @@ -26,21 +26,15 @@ ****************************************************************/ -/* 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 @@ -72,7 +66,6 @@ */ #ifdef Honor_FLT_ROUNDS -#define Rounding rounding #undef Check_FLT_ROUNDS #define Check_FLT_ROUNDS #else @@ -82,10 +75,10 @@ char * dtoa #ifdef KR_headers - (d, mode, ndigits, decpt, sign, rve) - double d; int mode, ndigits, *decpt, *sign; char **rve; + (d0, mode, ndigits, decpt, sign, rve) + double d0; int mode, ndigits, *decpt, *sign; char **rve; #else - (double d, int mode, int ndigits, int *decpt, int *sign, char **rve) + (double d0, int mode, int ndigits, int *decpt, int *sign, char **rve) #endif { /* Arguments ndigits, decpt, sign are similar to those @@ -131,14 +124,25 @@ ULong x; #endif Bigint *b, *b1, *delta, *mlo, *mhi, *S; - double d2, ds, eps; + U d, d2, eps; + double ds; char *s, *s0; -#ifdef Honor_FLT_ROUNDS - int rounding; -#endif #ifdef SET_INEXACT int inexact, oldinexact; #endif +#ifdef Honor_FLT_ROUNDS /*{*/ + int Rounding; +#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ + Rounding = Flt_Rounds; +#else /*}{*/ + Rounding = 1; + switch(fegetround()) { + case FE_TOWARDZERO: Rounding = 0; break; + case FE_UPWARD: Rounding = 2; break; + case FE_DOWNWARD: Rounding = 3; + } +#endif /*}}*/ +#endif /*}*/ #ifndef MULTIPLE_THREADS if (dtoa_result) { @@ -146,35 +150,35 @@ dtoa_result = 0; } #endif - - if (word0(d) & Sign_bit) { + d.d = d0; + if (word0(&d) & Sign_bit) { /* set sign for everything, including 0's and NaNs */ *sign = 1; - word0(d) &= ~Sign_bit; /* clear sign bit */ + word0(&d) &= ~Sign_bit; /* clear sign bit */ } else *sign = 0; #if defined(IEEE_Arith) + defined(VAX) #ifdef IEEE_Arith - if ((word0(d) & Exp_mask) == Exp_mask) + if ((word0(&d) & Exp_mask) == Exp_mask) #else - if (word0(d) == 0x8000) + if (word0(&d) == 0x8000) #endif { /* Infinity or NaN */ *decpt = 9999; #ifdef IEEE_Arith - if (!word1(d) && !(word0(d) & 0xfffff)) + if (!word1(&d) && !(word0(&d) & 0xfffff)) return nrv_alloc("Infinity", rve, 8); #endif return nrv_alloc("NaN", rve, 3); } #endif #ifdef IBM - dval(d) += 0; /* normalize */ + dval(&d) += 0; /* normalize */ #endif - if (!dval(d)) { + if (!dval(&d)) { *decpt = 1; return nrv_alloc("0", rve, 1); } @@ -184,35 +188,35 @@ inexact = 1; #endif #ifdef Honor_FLT_ROUNDS - if ((rounding = Flt_Rounds) >= 2) { + if (Rounding >= 2) { if (*sign) - rounding = rounding == 2 ? 0 : 2; + Rounding = Rounding == 2 ? 0 : 2; else - if (rounding != 2) - rounding = 0; + if (Rounding != 2) + Rounding = 0; } #endif - b = d2b(dval(d), &be, &bbits); + b = d2b(dval(&d), &be, &bbits); #ifdef Sudden_Underflow - i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); + i = (int)(word0(&d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); #else - if (( i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)) )!=0) { + if (( i = (int)(word0(&d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)) )!=0) { #endif - dval(d2) = dval(d); - word0(d2) &= Frac_mask1; - word0(d2) |= Exp_11; + dval(&d2) = dval(&d); + word0(&d2) &= Frac_mask1; + word0(&d2) |= Exp_11; #ifdef IBM - if (( j = 11 - hi0bits(word0(d2) & Frac_mask) )!=0) - dval(d2) /= 1 << j; + if (( j = 11 - hi0bits(word0(&d2) & Frac_mask) )!=0) + dval(&d2) /= 1 << j; #endif /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 * log10(x) = log(x) / log(10) * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) - * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) + * log10(&d) = (i-Bias)*log(2)/log(10) + log10(&d2) * - * This suggests computing an approximation k to log10(d) by + * This suggests computing an approximation k to log10(&d) by * * k = (i - Bias)*0.301029995663981 * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); @@ -241,21 +245,21 @@ /* d is denormalized */ i = bbits + be + (Bias + (P-1) - 1); - x = i > 32 ? word0(d) << 64 - i | word1(d) >> i - 32 - : word1(d) << 32 - i; - dval(d2) = x; - word0(d2) -= 31*Exp_msk1; /* adjust exponent */ + x = i > 32 ? word0(&d) << (64 - i) | word1(&d) >> (i - 32) + : word1(&d) << (32 - i); + dval(&d2) = x; + word0(&d2) -= 31*Exp_msk1; /* adjust exponent */ i -= (Bias + (P-1) - 1) + 1; denorm = 1; } #endif - ds = (dval(d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; + ds = (dval(&d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; k = (int)ds; if (ds < 0. && ds != k) k--; /* want k = floor(ds) */ k_check = 1; if (k >= 0 && k <= Ten_pmax) { - if (dval(d) < tens[k]) + if (dval(&d) < tens[k]) k--; k_check = 0; } @@ -294,10 +298,11 @@ try_quick = 0; } leftright = 1; + ilim = ilim1 = -1; /* Values for cases 0 and 1; done here to */ + /* silence erroneous "gcc -Wall" warning. */ switch(mode) { case 0: case 1: - ilim = ilim1 = -1; i = 18; ndigits = 0; break; @@ -322,7 +327,7 @@ s = s0 = rv_alloc(i); #ifdef Honor_FLT_ROUNDS - if (mode > 1 && rounding != 1) + if (mode > 1 && Rounding != 1) leftright = 0; #endif @@ -331,7 +336,7 @@ /* Try to get by with floating-point arithmetic. */ i = 0; - dval(d2) = dval(d); + dval(&d2) = dval(&d); k0 = k; ilim0 = ilim; ieps = 2; /* conservative */ @@ -341,7 +346,7 @@ if (j & Bletch) { /* prevent overflows */ j &= Bletch - 1; - dval(d) /= bigtens[n_bigtens-1]; + dval(&d) /= bigtens[n_bigtens-1]; ieps++; } for(; j; j >>= 1, i++) @@ -349,32 +354,32 @@ ieps++; ds *= bigtens[i]; } - dval(d) /= ds; + dval(&d) /= ds; } else if (( j1 = -k )!=0) { - dval(d) *= tens[j1 & 0xf]; + dval(&d) *= tens[j1 & 0xf]; for(j = j1 >> 4; j; j >>= 1, i++) if (j & 1) { ieps++; - dval(d) *= bigtens[i]; + dval(&d) *= bigtens[i]; } } - if (k_check && dval(d) < 1. && ilim > 0) { + if (k_check && dval(&d) < 1. && ilim > 0) { if (ilim1 <= 0) goto fast_failed; ilim = ilim1; k--; - dval(d) *= 10.; + dval(&d) *= 10.; ieps++; } - dval(eps) = ieps*dval(d) + 7.; - word0(eps) -= (P-1)*Exp_msk1; + dval(&eps) = ieps*dval(&d) + 7.; + word0(&eps) -= (P-1)*Exp_msk1; if (ilim == 0) { S = mhi = 0; - dval(d) -= 5.; - if (dval(d) > dval(eps)) + dval(&d) -= 5.; + if (dval(&d) > dval(&eps)) goto one_digit; - if (dval(d) < -dval(eps)) + if (dval(&d) < -dval(&eps)) goto no_digits; goto fast_failed; } @@ -383,34 +388,34 @@ /* Use Steele & White method of only * generating digits needed. */ - dval(eps) = 0.5/tens[ilim-1] - dval(eps); + dval(&eps) = 0.5/tens[ilim-1] - dval(&eps); for(i = 0;;) { - L = dval(d); - dval(d) -= L; + L = dval(&d); + dval(&d) -= L; *s++ = '0' + (int)L; - if (dval(d) < dval(eps)) + if (dval(&d) < dval(&eps)) goto ret1; - if (1. - dval(d) < dval(eps)) + if (1. - dval(&d) < dval(&eps)) goto bump_up; if (++i >= ilim) break; - dval(eps) *= 10.; - dval(d) *= 10.; + dval(&eps) *= 10.; + dval(&d) *= 10.; } } else { #endif /* Generate ilim digits, then fix them up. */ - dval(eps) *= tens[ilim-1]; - for(i = 1;; i++, dval(d) *= 10.) { - L = (Long)(dval(d)); - if (!(dval(d) -= L)) + dval(&eps) *= tens[ilim-1]; + for(i = 1;; i++, dval(&d) *= 10.) { + L = (Long)(dval(&d)); + if (!(dval(&d) -= L)) ilim = i; *s++ = '0' + (int)L; if (i == ilim) { - if (dval(d) > 0.5 + dval(eps)) + if (dval(&d) > 0.5 + dval(&eps)) goto bump_up; - else if (dval(d) < 0.5 - dval(eps)) { + else if (dval(&d) < 0.5 - dval(&eps)) { while(*--s == '0'); s++; goto ret1; @@ -423,7 +428,7 @@ #endif fast_failed: s = s0; - dval(d) = dval(d2); + dval(&d) = dval(&d2); k = k0; ilim = ilim0; } @@ -435,22 +440,22 @@ ds = tens[k]; if (ndigits < 0 && ilim <= 0) { S = mhi = 0; - if (ilim < 0 || dval(d) <= 5*ds) + if (ilim < 0 || dval(&d) <= 5*ds) goto no_digits; goto one_digit; } - for(i = 1;; i++, dval(d) *= 10.) { - L = (Long)(dval(d) / ds); - dval(d) -= L*ds; + for(i = 1;; i++, dval(&d) *= 10.) { + L = (Long)(dval(&d) / ds); + dval(&d) -= L*ds; #ifdef Check_FLT_ROUNDS /* If FLT_ROUNDS == 2, L will usually be high by 1 */ - if (dval(d) < 0) { + if (dval(&d) < 0) { L--; - dval(d) += ds; + dval(&d) += ds; } #endif *s++ = '0' + (int)L; - if (!dval(d)) { + if (!dval(&d)) { #ifdef SET_INEXACT inexact = 0; #endif @@ -459,13 +464,18 @@ if (i == ilim) { #ifdef Honor_FLT_ROUNDS if (mode > 1) - switch(rounding) { + switch(Rounding) { case 0: goto ret1; case 2: goto bump_up; } #endif - dval(d) += dval(d); - if (dval(d) > ds || dval(d) == ds && L & 1) { + dval(&d) += dval(&d); +#ifdef ROUND_BIASED + if (dval(&d) >= ds) +#else + if (dval(&d) > ds || (dval(&d) == ds && L & 1)) +#endif + { bump_up: while(*--s == '9') if (s == s0) { @@ -527,12 +537,12 @@ spec_case = 0; if ((mode < 2 || leftright) #ifdef Honor_FLT_ROUNDS - && rounding == 1 + && Rounding == 1 #endif ) { - if (!word1(d) && !(word0(d) & Bndry_mask) + if (!word1(&d) && !(word0(&d) & Bndry_mask) #ifndef Sudden_Underflow - && word0(d) & (Exp_mask & ~Exp_msk1) + && word0(&d) & (Exp_mask & ~Exp_msk1) #endif ) { /* The special case */ @@ -618,9 +628,9 @@ j1 = delta->sign ? 1 : cmp(b, delta); Bfree(delta); #ifndef ROUND_BIASED - if (j1 == 0 && mode != 1 && !(word1(d) & 1) + if (j1 == 0 && mode != 1 && !(word1(&d) & 1) #ifdef Honor_FLT_ROUNDS - && rounding >= 1 + && Rounding >= 1 #endif ) { if (dig == '9') @@ -635,11 +645,11 @@ goto ret; } #endif - if (j < 0 || j == 0 && mode != 1 + if (j < 0 || (j == 0 && mode != 1 #ifndef ROUND_BIASED - && !(word1(d) & 1) + && !(word1(&d) & 1) #endif - ) { + )) { if (!b->x[0] && b->wds <= 1) { #ifdef SET_INEXACT inexact = 0; @@ -648,7 +658,7 @@ } #ifdef Honor_FLT_ROUNDS if (mode > 1) - switch(rounding) { + switch(Rounding) { case 0: goto accept_dig; case 2: goto keep_dig; } @@ -656,7 +666,11 @@ if (j1 > 0) { b = lshift(b, 1); j1 = cmp(b, S); - if ((j1 > 0 || j1 == 0 && dig & 1) +#ifdef ROUND_BIASED + if (j1 >= 0 /*)*/ +#else + if ((j1 > 0 || (j1 == 0 && dig & 1)) +#endif && dig++ == '9') goto round_9_up; } @@ -666,7 +680,7 @@ } if (j1 > 0) { #ifdef Honor_FLT_ROUNDS - if (!rounding) + if (!Rounding) goto accept_dig; #endif if (dig == '9') { /* possible if i == 1 */ @@ -709,14 +723,19 @@ /* Round off last digit */ #ifdef Honor_FLT_ROUNDS - switch(rounding) { + switch(Rounding) { case 0: goto trimzeros; case 2: goto roundoff; } #endif b = lshift(b, 1); j = cmp(b, S); - if (j > 0 || j == 0 && dig & 1) { +#ifdef ROUND_BIASED + if (j >= 0) +#else + if (j > 0 || (j == 0 && dig & 1)) +#endif + { roundoff: while(*--s == '9') if (s == s0) { @@ -727,7 +746,9 @@ ++*s++; } else { +#ifdef Honor_FLT_ROUNDS trimzeros: +#endif while(*--s == '0'); s++; } @@ -742,9 +763,9 @@ #ifdef SET_INEXACT if (inexact) { if (!oldinexact) { - word0(d) = Exp_1 + (70 << Exp_shift); - word1(d) = 0; - dval(d) += 1.; + word0(&d) = Exp_1 + (70 << Exp_shift); + word1(&d) = 0; + dval(&d) += 1.; } } else if (!oldinexact) diff --git a/contrib/gdtoa/g_Qfmt.c b/contrib/gdtoa/g_Qfmt.c index 896b9d4..15d1bdd 100644 --- a/contrib/gdtoa/g_Qfmt.c +++ b/contrib/gdtoa/g_Qfmt.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -57,15 +51,20 @@ char* #ifdef KR_headers -g_Qfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize; +g_Qfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; #else -g_Qfmt(char *buf, void *V, int ndig, unsigned bufsize) +g_Qfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 }; + static FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 }; char *b, *s, *se; ULong bits[4], *L, sign; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -83,7 +82,7 @@ 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) @@ -115,6 +114,6 @@ return 0; mode = 0; } - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } diff --git a/contrib/gdtoa/g__fmt.c b/contrib/gdtoa/g__fmt.c index 6274681..6c4b3d2 100644 --- a/contrib/gdtoa/g__fmt.c +++ b/contrib/gdtoa/g__fmt.c @@ -26,10 +26,8 @@ ****************************************************************/ -/* 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" @@ -39,24 +37,51 @@ char * #ifdef KR_headers -g__fmt(b, s, se, decpt, sign) char *b; char *s; char *se; int decpt; ULong sign; +g__fmt(b, s, se, decpt, sign, blen) char *b; char *s; char *se; int decpt; ULong sign; size_t blen; #else -g__fmt(char *b, char *s, char *se, int decpt, ULong sign) +g__fmt(char *b, char *s, char *se, int decpt, ULong sign, size_t blen) #endif { int i, j, k; - char *s0 = s; + char *be, *s0; + size_t len; #ifdef USE_LOCALE - char decimalpoint = *localeconv()->decimal_point; +#ifdef NO_LOCALE_CACHE + char *decimalpoint = localeconv()->decimal_point; + size_t dlen = strlen(decimalpoint); #else -#define decimalpoint '.' + char *decimalpoint; + static char *decimalpoint_cache; + static size_t dlen; + if (!(s0 = decimalpoint_cache)) { + s0 = localeconv()->decimal_point; + dlen = strlen(s0); + if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { + strcpy(decimalpoint_cache, s0); + s0 = decimalpoint_cache; + } + } + decimalpoint = s0; #endif +#else +#define dlen 0 +#endif + s0 = s; + len = (se-s) + dlen + 6; /* 6 = sign + e+dd + trailing null */ + if (blen < len) + goto ret0; + be = b + blen - 1; if (sign) *b++ = '-'; if (decpt <= -4 || decpt > se - s + 5) { *b++ = *s++; if (*s) { - *b++ = decimalpoint; +#ifdef USE_LOCALE + while((*b = *decimalpoint++)) + ++b; +#else + *b++ = '.'; +#endif while((*b = *s++) !=0) b++; } @@ -71,6 +96,8 @@ for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10){} for(;;) { i = decpt / k; + if (b >= be) + goto ret0; *b++ = i + '0'; if (--j <= 0) break; @@ -80,22 +107,41 @@ *b = 0; } else if (decpt <= 0) { - *b++ = decimalpoint; +#ifdef USE_LOCALE + while((*b = *decimalpoint++)) + ++b; +#else + *b++ = '.'; +#endif + if (be < b - decpt + (se - s)) + goto ret0; for(; decpt < 0; decpt++) *b++ = '0'; - while((*b = *s++) !=0) + while((*b = *s++) != 0) b++; } else { - while((*b = *s++) !=0) { + while((*b = *s++) != 0) { b++; - if (--decpt == 0 && *s) - *b++ = decimalpoint; + if (--decpt == 0 && *s) { +#ifdef USE_LOCALE + while(*b = *decimalpoint++) + ++b; +#else + *b++ = '.'; +#endif + } + } + if (b + decpt > be) { + ret0: + b = 0; + goto ret; } for(; decpt > 0; decpt--) *b++ = '0'; *b = 0; } + ret: freedtoa(s0); return b; } diff --git a/contrib/gdtoa/g_ddfmt.c b/contrib/gdtoa/g_ddfmt.c index 7d214ba..1256655 100644 --- a/contrib/gdtoa/g_ddfmt.c +++ b/contrib/gdtoa/g_ddfmt.c @@ -26,23 +26,16 @@ ****************************************************************/ -/* 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 char * #ifdef KR_headers -g_ddfmt(buf, dd, ndig, bufsize) char *buf; double *dd; int ndig; unsigned bufsize; +g_ddfmt(buf, dd0, ndig, bufsize) char *buf; double *dd0; int ndig; size_t bufsize; #else -g_ddfmt(char *buf, double *dd, int ndig, unsigned bufsize) +g_ddfmt(char *buf, double *dd0, int ndig, size_t bufsize) #endif { FPI fpi; @@ -50,12 +43,28 @@ ULong *L, bits0[4], *bits, *zx; int bx, by, decpt, ex, ey, i, j, mode; Bigint *x, *y, *z; - double ddx[2]; + U *dd, ddx[2]; +#ifdef Honor_FLT_ROUNDS /*{{*/ + int Rounding; +#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ + Rounding = Flt_Rounds; +#else /*}{*/ + Rounding = 1; + switch(fegetround()) { + case FE_TOWARDZERO: Rounding = 0; break; + case FE_UPWARD: Rounding = 2; break; + case FE_DOWNWARD: Rounding = 3; + } +#endif /*}}*/ +#else /*}{*/ +#define Rounding FPI_Round_near +#endif /*}}*/ if (bufsize < 10 || bufsize < ndig + 8) return 0; - L = (ULong*)dd; + dd = (U*)dd0; + L = dd->L; if ((L[_0] & 0x7ff00000L) == 0x7ff00000L) { /* Infinity or NaN */ if (L[_0] & 0xfffff || L[_1]) { @@ -80,7 +89,7 @@ goto nanret; goto infret; } - if (dd[0] + dd[1] == 0.) { + if (dval(&dd[0]) + dval(&dd[1]) == 0.) { b = buf; #ifndef IGNORE_ZERO_SIGN if (L[_0] & L[2+_0] & 0x80000000L) @@ -91,16 +100,16 @@ return b; } if ((L[_0] & 0x7ff00000L) < (L[2+_0] & 0x7ff00000L)) { - ddx[1] = dd[0]; - ddx[0] = dd[1]; + dval(&ddx[1]) = dval(&dd[0]); + dval(&ddx[0]) = dval(&dd[1]); dd = ddx; - L = (ULong*)dd; + L = dd->L; } - z = d2b(dd[0], &ex, &bx); - if (dd[1] == 0.) + z = d2b(dval(&dd[0]), &ex, &bx); + if (dval(&dd[1]) == 0.) goto no_y; x = z; - y = d2b(dd[1], &ey, &by); + y = d2b(dval(&dd[1]), &ey, &by); if ( (i = ex - ey) !=0) { if (i > 0) { x = lshift(x, i); @@ -151,11 +160,11 @@ } fpi.emin = 1-1023-53+1; fpi.emax = 2046-1023-106+1; - fpi.rounding = FPI_Round_near; + fpi.rounding = Rounding; fpi.sudden_underflow = 0; i = STRTOG_Normal; s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - b = g__fmt(buf, s, se, decpt, z->sign); + b = g__fmt(buf, s, se, decpt, z->sign, bufsize); Bfree(z); return b; } diff --git a/contrib/gdtoa/g_dfmt.c b/contrib/gdtoa/g_dfmt.c index 1ade834..8367868 100644 --- a/contrib/gdtoa/g_dfmt.c +++ b/contrib/gdtoa/g_dfmt.c @@ -26,28 +26,27 @@ ****************************************************************/ -/* 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" char* #ifdef KR_headers -g_dfmt(buf, d, ndig, bufsize) char *buf; double *d; int ndig; unsigned bufsize; +g_dfmt(buf, d, ndig, bufsize) char *buf; double *d; int ndig; size_t bufsize; #else -g_dfmt(char *buf, double *d, int ndig, unsigned bufsize) +g_dfmt(char *buf, double *d, int ndig, size_t bufsize) #endif { - static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 }; + static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 }; char *b, *s, *se; ULong bits[2], *L, sign; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -58,6 +57,8 @@ sign = L[_0] & 0x80000000L; if ((L[_0] & 0x7ff00000) == 0x7ff00000) { /* Infinity or NaN */ + if (bufsize < 10) + return 0; if (L[_0] & 0xfffff || L[_1]) { return strcp(buf, "NaN"); } @@ -84,12 +85,11 @@ ex = 1; ex -= 0x3ff + 52; mode = 2; - if (ndig <= 0) { - if (bufsize < 25) - return 0; + if (ndig <= 0) mode = 0; - } i = STRTOG_Normal; - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + if (sign) + i = STRTOG_Normal | STRTOG_Neg; + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } diff --git a/contrib/gdtoa/g_ffmt.c b/contrib/gdtoa/g_ffmt.c index 851394a..1c27c60 100644 --- a/contrib/gdtoa/g_ffmt.c +++ b/contrib/gdtoa/g_ffmt.c @@ -26,28 +26,27 @@ ****************************************************************/ -/* 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" char* #ifdef KR_headers -g_ffmt(buf, f, ndig, bufsize) char *buf; float *f; int ndig; unsigned bufsize; +g_ffmt(buf, f, ndig, bufsize) char *buf; float *f; int ndig; size_t bufsize; #else -g_ffmt(char *buf, float *f, int ndig, unsigned bufsize) +g_ffmt(char *buf, float *f, int ndig, size_t bufsize) #endif { - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, 0 }; + static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, 0 }; char *b, *s, *se; ULong bits[1], *L, sign; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -89,6 +88,6 @@ mode = 0; } i = STRTOG_Normal; - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } diff --git a/contrib/gdtoa/g_xLfmt.c b/contrib/gdtoa/g_xLfmt.c index fc17643..6fa1de2 100644 --- a/contrib/gdtoa/g_xLfmt.c +++ b/contrib/gdtoa/g_xLfmt.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -55,15 +49,20 @@ char* #ifdef KR_headers -g_xLfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize; +g_xLfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; #else -g_xLfmt(char *buf, void *V, int ndig, unsigned bufsize) +g_xLfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; + static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; char *b, *s, *se; ULong bits[2], *L, sign; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -109,6 +108,6 @@ return 0; mode = 0; } - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } diff --git a/contrib/gdtoa/g_xfmt.c b/contrib/gdtoa/g_xfmt.c index 1e2a381..495c7b4 100644 --- a/contrib/gdtoa/g_xfmt.c +++ b/contrib/gdtoa/g_xfmt.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -59,16 +53,21 @@ char* #ifdef KR_headers -g_xfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize; +g_xfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize; #else -g_xfmt(char *buf, void *V, int ndig, unsigned bufsize) +g_xfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; + static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; char *b, *s, *se; ULong bits[2], sign; UShort *L; int decpt, ex, i, mode; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif if (ndig < 0) ndig = 0; @@ -96,6 +95,7 @@ } else if (bits[0] | bits[1]) { i = STRTOG_Denormal; + ex = 1; } else { b = buf; @@ -114,6 +114,6 @@ return 0; mode = 0; } - s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se); - return g__fmt(buf, s, se, decpt, sign); + s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); + return g__fmt(buf, s, se, decpt, sign, bufsize); } diff --git a/contrib/gdtoa/gdtoa.c b/contrib/gdtoa/gdtoa.c index 706c055..e15bb2a 100644 --- a/contrib/gdtoa/gdtoa.c +++ b/contrib/gdtoa/gdtoa.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 @@ /* 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 @@ -129,6 +123,7 @@ the returned string. If not null, *rve is set to point to the end of the return value. If d is +-Infinity or NaN, then *decpt is set to 9999. + be = exponent: value = (integer represented by bits) * (2 to the power of be). mode: 0 ==> shortest string that yields d when read in @@ -163,8 +158,9 @@ int rdir, s2, s5, spec_case, try_quick; Long L; Bigint *b, *b1, *delta, *mlo, *mhi, *mhi1, *S; - double d, d2, ds, eps; + double d2, ds; char *s, *s0; + U d, eps; #ifndef MULTIPLE_THREADS if (dtoa_result) { @@ -203,21 +199,21 @@ return nrv_alloc("0", rve, 1); } - dval(d) = b2d(b, &i); + dval(&d) = b2d(b, &i); i = be + bbits - 1; - word0(d) &= Frac_mask1; - word0(d) |= Exp_11; + word0(&d) &= Frac_mask1; + word0(&d) |= Exp_11; #ifdef IBM - if ( (j = 11 - hi0bits(word0(d) & Frac_mask)) !=0) - dval(d) /= 1 << j; + if ( (j = 11 - hi0bits(word0(&d) & Frac_mask)) !=0) + dval(&d) /= 1 << j; #endif /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 * log10(x) = log(x) / log(10) * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) - * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) + * log10(&d) = (i-Bias)*log(2)/log(10) + log10(d2) * - * This suggests computing an approximation k to log10(d) by + * This suggests computing an approximation k to log10(&d) by * * k = (i - Bias)*0.301029995663981 * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); @@ -237,7 +233,7 @@ i <<= 2; i += j; #endif - ds = (dval(d)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; + ds = (dval(&d)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; /* correct assumption about exponent range */ if ((j = i) < 0) @@ -252,13 +248,13 @@ #ifdef IBM j = be + bbits - 1; if ( (j1 = j & 3) !=0) - dval(d) *= 1 << j1; - word0(d) += j << Exp_shift - 2 & Exp_mask; + dval(&d) *= 1 << j1; + word0(&d) += j << Exp_shift - 2 & Exp_mask; #else - word0(d) += (be + bbits - 1) << Exp_shift; + word0(&d) += (be + bbits - 1) << Exp_shift; #endif if (k >= 0 && k <= Ten_pmax) { - if (dval(d) < tens[k]) + if (dval(&d) < tens[k]) k--; k_check = 0; } @@ -288,11 +284,14 @@ mode -= 4; try_quick = 0; } + else if (i >= -4 - Emin || i < Emin) + try_quick = 0; leftright = 1; + ilim = ilim1 = -1; /* Values for cases 0 and 1; done here to */ + /* silence erroneous "gcc -Wall" warning. */ switch(mode) { case 0: case 1: - ilim = ilim1 = -1; i = (int)(nbits * .30103) + 3; ndigits = 0; break; @@ -334,10 +333,10 @@ /* Try to get by with floating-point arithmetic. */ i = 0; - d2 = dval(d); + d2 = dval(&d); #ifdef IBM - if ( (j = 11 - hi0bits(word0(d) & Frac_mask)) !=0) - dval(d) /= 1 << j; + if ( (j = 11 - hi0bits(word0(&d) & Frac_mask)) !=0) + dval(&d) /= 1 << j; #endif k0 = k; ilim0 = ilim; @@ -348,7 +347,7 @@ if (j & Bletch) { /* prevent overflows */ j &= Bletch - 1; - dval(d) /= bigtens[n_bigtens-1]; + dval(&d) /= bigtens[n_bigtens-1]; ieps++; } for(; j; j >>= 1, i++) @@ -360,30 +359,30 @@ else { ds = 1.; if ( (j1 = -k) !=0) { - dval(d) *= tens[j1 & 0xf]; + dval(&d) *= tens[j1 & 0xf]; for(j = j1 >> 4; j; j >>= 1, i++) if (j & 1) { ieps++; - dval(d) *= bigtens[i]; + dval(&d) *= bigtens[i]; } } } - if (k_check && dval(d) < 1. && ilim > 0) { + if (k_check && dval(&d) < 1. && ilim > 0) { if (ilim1 <= 0) goto fast_failed; ilim = ilim1; k--; - dval(d) *= 10.; + dval(&d) *= 10.; ieps++; } - dval(eps) = ieps*dval(d) + 7.; - word0(eps) -= (P-1)*Exp_msk1; + dval(&eps) = ieps*dval(&d) + 7.; + word0(&eps) -= (P-1)*Exp_msk1; if (ilim == 0) { S = mhi = 0; - dval(d) -= 5.; - if (dval(d) > dval(eps)) + dval(&d) -= 5.; + if (dval(&d) > dval(&eps)) goto one_digit; - if (dval(d) < -dval(eps)) + if (dval(&d) < -dval(&eps)) goto no_digits; goto fast_failed; } @@ -392,42 +391,40 @@ /* Use Steele & White method of only * generating digits needed. */ - dval(eps) = ds*0.5/tens[ilim-1] - dval(eps); + dval(&eps) = ds*0.5/tens[ilim-1] - dval(&eps); for(i = 0;;) { - L = (Long)(dval(d)/ds); - dval(d) -= L*ds; + L = (Long)(dval(&d)/ds); + dval(&d) -= L*ds; *s++ = '0' + (int)L; - if (dval(d) < dval(eps)) { - if (dval(d)) + if (dval(&d) < dval(&eps)) { + if (dval(&d)) inex = STRTOG_Inexlo; goto ret1; } - if (ds - dval(d) < dval(eps)) + if (ds - dval(&d) < dval(&eps)) goto bump_up; if (++i >= ilim) break; - dval(eps) *= 10.; - dval(d) *= 10.; + dval(&eps) *= 10.; + dval(&d) *= 10.; } } else { #endif /* Generate ilim digits, then fix them up. */ - dval(eps) *= tens[ilim-1]; - for(i = 1;; i++, dval(d) *= 10.) { - if ( (L = (Long)(dval(d)/ds)) !=0) - dval(d) -= L*ds; + dval(&eps) *= tens[ilim-1]; + for(i = 1;; i++, dval(&d) *= 10.) { + if ( (L = (Long)(dval(&d)/ds)) !=0) + dval(&d) -= L*ds; *s++ = '0' + (int)L; if (i == ilim) { ds *= 0.5; - if (dval(d) > ds + dval(eps)) + if (dval(&d) > ds + dval(&eps)) goto bump_up; - else if (dval(d) < ds - dval(eps)) { - while(*--s == '0'){} - s++; - if (dval(d)) + else if (dval(&d) < ds - dval(&eps)) { + if (dval(&d)) inex = STRTOG_Inexlo; - goto ret1; + goto clear_trailing0; } break; } @@ -437,7 +434,7 @@ #endif fast_failed: s = s0; - dval(d) = d2; + dval(&d) = d2; k = k0; ilim = ilim0; } @@ -449,22 +446,22 @@ ds = tens[k]; if (ndigits < 0 && ilim <= 0) { S = mhi = 0; - if (ilim < 0 || dval(d) <= 5*ds) + if (ilim < 0 || dval(&d) <= 5*ds) goto no_digits; goto one_digit; } - for(i = 1;; i++, dval(d) *= 10.) { - L = dval(d) / ds; - dval(d) -= L*ds; + for(i = 1;; i++, dval(&d) *= 10.) { + L = dval(&d) / ds; + dval(&d) -= L*ds; #ifdef Check_FLT_ROUNDS /* If FLT_ROUNDS == 2, L will usually be high by 1 */ - if (dval(d) < 0) { + if (dval(&d) < 0) { L--; - dval(d) += ds; + dval(&d) += ds; } #endif *s++ = '0' + (int)L; - if (dval(d) == 0.) + if (dval(&d) == 0.) break; if (i == ilim) { if (rdir) { @@ -473,8 +470,13 @@ inex = STRTOG_Inexlo; goto ret1; } - dval(d) += dval(d); - if (dval(d) > ds || dval(d) == ds && L & 1) { + dval(&d) += dval(&d); +#ifdef ROUND_BIASED + if (dval(&d) >= ds) +#else + if (dval(&d) > ds || (dval(&d) == ds && L & 1)) +#endif + { bump_up: inex = STRTOG_Inexhi; while(*--s == '9') @@ -485,8 +487,12 @@ } ++*s++; } - else + else { inex = STRTOG_Inexlo; + clear_trailing0: + while(*--s == '0'){} + ++s; + } break; } } @@ -497,13 +503,15 @@ m5 = b5; mhi = mlo = 0; if (leftright) { - if (mode < 2) { - i = nbits - bbits; - if (be - i++ < fpi->emin) - /* denormal */ - i = be - fpi->emin + 1; + i = nbits - bbits; + if (be - i++ < fpi->emin && mode != 3 && mode != 5) { + /* denormal */ + i = be - fpi->emin + 1; + if (mode >= 2 && ilim > 0 && ilim < i) + goto small_ilim; } - else { + else if (mode >= 2) { + small_ilim: j = ilim - 1; if (m5 >= j) m5 -= j; @@ -564,28 +572,11 @@ * and for all and pass them and a shift to quorem, so it * can do shifts and ors to compute the numerator for q. */ -#ifdef Pack_32 - if ( (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) !=0) - i = 32 - i; -#else - if ( (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf) !=0) - i = 16 - i; -#endif - if (i > 4) { - i -= 4; - b2 += i; - m2 += i; - s2 += i; - } - else if (i < 4) { - i += 28; - b2 += i; - m2 += i; - s2 += i; - } - if (b2 > 0) + i = ((s5 ? hi0bits(S->x[S->wds-1]) : ULbits - 1) - s2 - 4) & kmask; + m2 += i; + if ((b2 += i) > 0) b = lshift(b, b2); - if (s2 > 0) + if ((s2 += i) > 0) S = lshift(S, s2); if (k_check) { if (cmp(b,S) < 0) { @@ -650,11 +641,11 @@ goto ret; } #endif - if (j < 0 || j == 0 && !mode + if (j < 0 || (j == 0 && !mode #ifndef ROUND_BIASED && !(bits[0] & 1) #endif - ) { + )) { if (rdir && (b->wds > 1 || b->x[0])) { if (rdir == 2) { inex = STRTOG_Inexlo; @@ -677,7 +668,11 @@ if (j1 > 0) { b = lshift(b, 1); j1 = cmp(b, S); - if ((j1 > 0 || j1 == 0 && dig & 1) +#ifdef ROUND_BIASED + if (j1 >= 0 /*)*/ +#else + if ((j1 > 0 || (j1 == 0 && dig & 1)) +#endif && dig++ == '9') goto round_9_up; inex = STRTOG_Inexhi; @@ -722,13 +717,18 @@ /* Round off last digit */ if (rdir) { - if (rdir == 2 || b->wds <= 1 && !b->x[0]) + if (rdir == 2 || (b->wds <= 1 && !b->x[0])) goto chopzeros; goto roundoff; } b = lshift(b, 1); j = cmp(b, S); - if (j > 0 || j == 0 && dig & 1) { +#ifdef ROUND_BIASED + if (j >= 0) +#else + if (j > 0 || (j == 0 && dig & 1)) +#endif + { roundoff: inex = STRTOG_Inexhi; while(*--s == '9') @@ -744,7 +744,7 @@ if (b->wds > 1 || b->x[0]) inex = STRTOG_Inexlo; while(*--s == '0'){} - s++; + ++s; } ret: Bfree(S); diff --git a/contrib/gdtoa/gdtoa.h b/contrib/gdtoa/gdtoa.h index 62553f2..f004ec3 100644 --- a/contrib/gdtoa/gdtoa.h +++ b/contrib/gdtoa/gdtoa.h @@ -26,22 +26,17 @@ ****************************************************************/ -/* 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 #include "arith.h" +#include /* for size_t */ #ifndef Long -#define Long long +#define Long int #endif #ifndef ULong typedef unsigned Long ULong; @@ -80,9 +75,9 @@ /* The following may be or-ed into one of the above values. */ - STRTOG_Neg = 0x08, - STRTOG_Inexlo = 0x10, - STRTOG_Inexhi = 0x20, + STRTOG_Neg = 0x08, /* does not affect STRTOG_Inexlo or STRTOG_Inexhi */ + STRTOG_Inexlo = 0x10, /* returned result rounded toward zero */ + STRTOG_Inexhi = 0x20, /* returned result rounded away from zero */ STRTOG_Inexact = 0x30, STRTOG_Underflow= 0x40, STRTOG_Overflow = 0x80 @@ -117,12 +112,12 @@ extern double strtod ANSI((CONST char *, char **)); extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*)); -extern char* g_ddfmt ANSI((char*, double*, int, unsigned)); -extern char* g_dfmt ANSI((char*, double*, int, unsigned)); -extern char* g_ffmt ANSI((char*, float*, int, unsigned)); -extern char* g_Qfmt ANSI((char*, void*, int, unsigned)); -extern char* g_xfmt ANSI((char*, void*, int, unsigned)); -extern char* g_xLfmt ANSI((char*, void*, int, unsigned)); +extern char* g_ddfmt ANSI((char*, double*, int, size_t)); +extern char* g_dfmt ANSI((char*, double*, int, size_t)); +extern char* g_ffmt ANSI((char*, float*, int, size_t)); +extern char* g_Qfmt ANSI((char*, void*, int, size_t)); +extern char* g_xfmt ANSI((char*, void*, int, size_t)); +extern char* g_xLfmt ANSI((char*, void*, int, size_t)); extern int strtoId ANSI((CONST char*, char**, double*, double*)); extern int strtoIdd ANSI((CONST char*, char**, double*, double*)); diff --git a/contrib/gdtoa/gdtoaimp.h b/contrib/gdtoa/gdtoaimp.h index 7f3d70e..95487c5 100644 --- a/contrib/gdtoa/gdtoaimp.h +++ b/contrib/gdtoa/gdtoaimp.h @@ -26,7 +26,7 @@ ****************************************************************/ -/* $FreeBSD: src/contrib/gdtoa/gdtoaimp.h,v 1.7 2005/01/18 18:56:18 das Exp $ */ +/* $FreeBSD: releng/11.1/contrib/gdtoa/gdtoaimp.h 227753 2011-11-20 14:45:42Z theraven $ */ /* This is a variation on dtoa.c that converts arbitary binary floating-point formats to and from decimal notation. It uses @@ -35,13 +35,8 @@ double-precision arithmetic (any of IEEE, VAX D_floating, or IBM mainframe arithmetic). - 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 "."). */ /* On a machine with IEEE extended-precision registers, it is @@ -63,7 +58,7 @@ * biased rounding (add half and chop). * * Inspired loosely by William D. Clinger's paper "How to Read Floating - * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. + * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 112-126]. * * Modifications: * @@ -101,7 +96,12 @@ * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines * that use extended-precision instructions to compute rounded * products and quotients) with IBM. - * #define ROUND_BIASED for IEEE-format with biased rounding. + * #define ROUND_BIASED for IEEE-format with biased rounding and arithmetic + * that rounds toward +Infinity. + * #define ROUND_BIASED_without_Round_Up for IEEE-format with biased + * rounding when the underlying floating-point arithmetic uses + * unbiased rounding. This prevent using ordinary floating-point + * arithmetic when the result could be computed with one rounding error. * #define Inaccurate_Divide for IEEE-format with correctly rounded * products but inaccurate quotients, e.g., for Intel i860. * #define NO_LONG_LONG on machines that do not have a "long long" @@ -120,7 +120,12 @@ * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) * if memory is available and otherwise does something you deem * appropriate. If MALLOC is undefined, malloc will be invoked - * directly -- and assumed always to succeed. + * directly -- and assumed always to succeed. Similarly, if you + * want something other than the system's free() to be called to + * recycle memory acquired from MALLOC, #define FREE to be the + * name of the alternate routine. (FREE or free is only called in + * pathological cases, e.g., in a gdtoa call after a gdtoa return in + * mode 3 with thousands of digits requested.) * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making * memory allocations from a private pool of memory when possible. * When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes, @@ -133,20 +138,22 @@ * conversions of IEEE doubles in single-threaded executions with * 8-byte pointers, PRIVATE_MEM >= 7400 appears to suffice; with * 4-byte pointers, PRIVATE_MEM >= 7112 appears adequate. - * #define INFNAN_CHECK on IEEE systems to cause strtod to check for - * Infinity and NaN (case insensitively). On some systems (e.g., - * some HP systems), it may be necessary to #define NAN_WORD0 - * appropriately -- to the most significant word of a quiet NaN. - * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) + * #define NO_INFNAN_CHECK if you do not wish to have INFNAN_CHECK + * #defined automatically on IEEE systems. On such systems, + * when INFNAN_CHECK is #defined, strtod checks + * for Infinity and NaN (case insensitively). * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined, * strtodg also accepts (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. + * NaN(x), where x is a string of hexadecimal digits (optionally + * preceded by 0x or 0X) 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. + * Unless GDTOA_NON_PEDANTIC_NANCHECK is #defined, input "NaN(...)" + * is consumed even when ... has the wrong form (in which case the + * "(...)" is consumed but ignored). * #define MULTIPLE_THREADS if the system offers preemptively scheduled * multiple threads. In this case, you must provide (or suitably * #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed @@ -158,7 +165,7 @@ * dtoa. You may do so whether or not MULTIPLE_THREADS is #defined. * #define IMPRECISE_INEXACT if you do not care about the setting of * the STRTOG_Inexact bits in the special case of doing IEEE double - * precision conversions (which could also be done by the strtog in + * precision conversions (which could also be done by the strtod in * dtoa.c). * #define NO_HEX_FP to disable recognition of C9x's hexadecimal * floating-point constants. @@ -167,17 +174,19 @@ * #define NO_STRING_H to use private versions of memcpy. * On some K&R systems, it may also be necessary to * #define DECLARE_SIZE_T in this case. - * #define YES_ALIAS to permit aliasing certain double values with - * arrays of ULongs. This leads to slightly better code with - * some compilers and was always used prior to 19990916, but it - * is not strictly legal and can cause trouble with aggressively - * optimizing compilers (e.g., gcc 2.95.1 under -O2). * #define USE_LOCALE to use the current locale's decimal_point value. */ #ifndef GDTOAIMP_H_INCLUDED #define GDTOAIMP_H_INCLUDED + +#define Long int + #include "gdtoa.h" +#include "gd_qnan.h" +#ifdef Honor_FLT_ROUNDS +#include +#endif #ifdef DEBUG #include "stdio.h" @@ -192,6 +201,7 @@ #include "namespace.h" #include #include "un-namespace.h" +#include "xlocale_private.h" #ifdef KR_headers #define Char char @@ -207,7 +217,9 @@ #define INFNAN_CHECK #define USE_LOCALE +#define NO_LOCALE_CACHE #define Honor_FLT_ROUNDS +#define Trust_FLT_ROUNDS #undef IEEE_Arith #undef Avoid_Underflow @@ -281,25 +293,14 @@ typedef union { double d; ULong L[2]; } U; -#ifdef YES_ALIAS -#define dval(x) x #ifdef IEEE_8087 -#define word0(x) ((ULong *)&x)[1] -#define word1(x) ((ULong *)&x)[0] +#define word0(x) (x)->L[1] +#define word1(x) (x)->L[0] #else -#define word0(x) ((ULong *)&x)[0] -#define word1(x) ((ULong *)&x)[1] +#define word0(x) (x)->L[0] +#define word1(x) (x)->L[1] #endif -#else /* !YES_ALIAS */ -#ifdef IEEE_8087 -#define word0(x) ((U*)&x)->L[1] -#define word1(x) ((U*)&x)->L[0] -#else -#define word0(x) ((U*)&x)->L[0] -#define word1(x) ((U*)&x)->L[1] -#endif -#define dval(x) ((U*)&x)->d -#endif /* YES_ALIAS */ +#define dval(x) (x)->d /* The following definition of Storeinc is appropriate for MIPS processors. * An alternative that might be better on some machines is @@ -413,6 +414,11 @@ #ifndef IEEE_Arith #define ROUND_BIASED +#else +#ifdef ROUND_BIASED_without_Round_Up +#undef ROUND_BIASED +#define ROUND_BIASED +#endif #endif #ifdef RND_PRODQUOT @@ -479,7 +485,7 @@ _pthread_mutex_unlock(&__gdtoa_locks[n]); \ } while(0) -#define Kmax 15 +#define Kmax 9 struct Bigint { @@ -520,11 +526,11 @@ #define strtoIQ __strtoIQ #define strtoIx __strtoIx #define strtoIxL __strtoIxL -#define strtord __strtord +#define strtord_l __strtord_l #define strtordd __strtordd #define strtorf __strtorf -#define strtorQ __strtorQ -#define strtorx __strtorx +#define strtorQ_l __strtorQ_l +#define strtorx_l __strtorx_l #define strtorxL __strtorxL #define strtodI __strtodI #define strtopd __strtopd @@ -558,6 +564,7 @@ #define hexdig_init_D2A __hexdig_init_D2A #define hexnan __hexnan_D2A #define hi0bits __hi0bits_D2A +#define hi0bits_D2A __hi0bits_D2A #define i2b __i2b_D2A #define increment __increment_D2A #define lo0bits __lo0bits_D2A @@ -600,14 +607,14 @@ extern int cmp ANSI((Bigint*, Bigint*)); extern void copybits ANSI((ULong*, int, Bigint*)); extern Bigint *d2b ANSI((double, int*, int*)); - extern int decrement ANSI((Bigint*)); + extern void decrement ANSI((Bigint*)); extern Bigint *diff ANSI((Bigint*, Bigint*)); extern char *dtoa ANSI((double d, int mode, int ndigits, int *decpt, int *sign, char **rve)); extern void freedtoa ANSI((char*)); extern char *gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp, int mode, int ndigits, int *decpt, char **rve)); - extern char *g__fmt ANSI((char*, char*, char*, int, ULong)); + extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t)); extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int)); extern void hexdig_init_D2A(Void); extern int hexnan ANSI((CONST char**, FPI*, ULong*)); @@ -625,10 +632,10 @@ extern double ratio ANSI((Bigint*, Bigint*)); extern void rshift ANSI((Bigint*, int)); extern char *rv_alloc ANSI((int)); - extern Bigint *s2b ANSI((CONST char*, int, int, ULong)); + extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int)); extern Bigint *set_ones ANSI((Bigint*, int)); extern char *strcp ANSI((char*, const char*)); - extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*)); + extern int strtodg_l ANSI((CONST char*, char**, FPI*, Long*, ULong*, locale_t)); extern int strtoId ANSI((CONST char *, char **, double *, double *)); extern int strtoIdd ANSI((CONST char *, char **, double *, double *)); @@ -638,50 +645,63 @@ extern int strtoIx ANSI((CONST char *, char **, void *, void *)); extern int strtoIxL ANSI((CONST char *, char **, void *, void *)); extern double strtod ANSI((const char *s00, char **se)); + extern double strtod_l ANSI((const char *s00, char **se, locale_t)); extern int strtopQ ANSI((CONST char *, char **, Void *)); extern int strtopf ANSI((CONST char *, char **, float *)); extern int strtopd ANSI((CONST char *, char **, double *)); extern int strtopdd ANSI((CONST char *, char **, double *)); extern int strtopx ANSI((CONST char *, char **, Void *)); extern int strtopxL ANSI((CONST char *, char **, Void *)); - extern int strtord ANSI((CONST char *, char **, int, double *)); + extern int strtord_l ANSI((CONST char *, char **, int, double *, locale_t)); extern int strtordd ANSI((CONST char *, char **, int, double *)); extern int strtorf ANSI((CONST char *, char **, int, float *)); - extern int strtorQ ANSI((CONST char *, char **, int, void *)); - extern int strtorx ANSI((CONST char *, char **, int, void *)); + extern int strtorQ_l ANSI((CONST char *, char **, int, void *, locale_t)); + extern int strtorx_l ANSI((CONST char *, char **, int, void *, locale_t)); extern int strtorxL ANSI((CONST char *, char **, int, void *)); extern Bigint *sum ANSI((Bigint*, Bigint*)); extern int trailz ANSI((Bigint*)); - extern double ulp ANSI((double)); + extern double ulp ANSI((U*)); #ifdef __cplusplus } #endif - - +/* + * NAN_WORD0 and NAN_WORD1 are only referenced in strtod.c. Prior to + * 20050115, they used to be hard-wired here (to 0x7ff80000 and 0, + * respectively), but now are determined by compiling and running + * qnan.c to generate gd_qnan.h, which specifies d_QNAN0 and d_QNAN1. + * Formerly gdtoaimp.h recommended supplying suitable -DNAN_WORD0=... + * and -DNAN_WORD1=... values if necessary. This should still work. + * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) + */ #ifdef IEEE_Arith +#ifndef NO_INFNAN_CHECK +#undef INFNAN_CHECK +#define INFNAN_CHECK +#endif #ifdef IEEE_MC68k #define _0 0 #define _1 1 +#ifndef NAN_WORD0 +#define NAN_WORD0 d_QNAN0 +#endif +#ifndef NAN_WORD1 +#define NAN_WORD1 d_QNAN1 +#endif #else #define _0 1 #define _1 0 +#ifndef NAN_WORD0 +#define NAN_WORD0 d_QNAN1 +#endif +#ifndef NAN_WORD1 +#define NAN_WORD1 d_QNAN0 +#endif #endif #else #undef INFNAN_CHECK #endif -#ifdef INFNAN_CHECK - -#ifndef NAN_WORD0 -#define NAN_WORD0 0x7ff80000 -#endif - -#ifndef NAN_WORD1 -#define NAN_WORD1 0 -#endif -#endif /* INFNAN_CHECK */ - #undef SI #ifdef Sudden_Underflow #define SI 1 diff --git a/contrib/gdtoa/gethex.c b/contrib/gdtoa/gethex.c index fadb5de..a9982c9 100644 --- a/contrib/gdtoa/gethex.c +++ b/contrib/gdtoa/gethex.c @@ -26,10 +26,8 @@ ****************************************************************/ -/* 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,17 +45,30 @@ { Bigint *b; CONST unsigned char *decpt, *s0, *s, *s1; - int esign, havedig, irv, k, n, nbits, up; + int big, esign, havedig, irv, j, k, n, n0, nbits, up, zret; ULong L, lostbits, *x; Long e, e1; #ifdef USE_LOCALE - unsigned char decimalpoint = *localeconv()->decimal_point; + int i; +#ifdef NO_LOCALE_CACHE + const unsigned char *decimalpoint = (unsigned char*)localeconv()->decimal_point; #else -#define decimalpoint '.' + const unsigned char *decimalpoint; + static unsigned char *decimalpoint_cache; + if (!(s0 = decimalpoint_cache)) { + s0 = (unsigned char*)localeconv()->decimal_point; + if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { + strcpy(decimalpoint_cache, s0); + s0 = decimalpoint_cache; + } + } + decimalpoint = s0; +#endif #endif if (!hexdig['0']) hexdig_init_D2A(); + *bp = 0; havedig = 0; s0 = *(CONST unsigned char **)sp + 2; while(s0[havedig] == '0') @@ -65,39 +76,56 @@ s0 += havedig; s = s0; decpt = 0; - if (!hexdig[*s]) { - if (*s == decimalpoint) { - decpt = ++s; - if (!hexdig[*s]) - goto ret0; + zret = 0; + e = 0; + if (hexdig[*s]) + havedig++; + else { + zret = 1; +#ifdef USE_LOCALE + for(i = 0; decimalpoint[i]; ++i) { + if (s[i] != decimalpoint[i]) + goto pcheck; } - else { - ret0: - *sp = (char*)s; - return havedig ? STRTOG_Zero : STRTOG_NoNumber; - } + decpt = s += i; +#else + if (*s != '.') + goto pcheck; + decpt = ++s; +#endif + 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]) s++; - if (*s == decimalpoint && !decpt) { +#ifdef USE_LOCALE + if (*s == *decimalpoint && !decpt) { + for(i = 1; decimalpoint[i]; ++i) { + if (s[i] != decimalpoint[i]) + goto pcheck; + } + decpt = s += i; +#else + if (*s == '.' && !decpt) { decpt = ++s; +#endif while(hexdig[*s]) s++; - } - e = 0; + }/*}*/ if (decpt) e = -(((Long)(s-decpt)) << 2); + pcheck: s1 = s; + big = esign = 0; switch(*s) { case 'p': case 'P': - esign = 0; switch(*++s) { case '-': esign = 1; @@ -110,24 +138,87 @@ break; } e1 = n - 0x10; - while((n = hexdig[*++s]) !=0 && n <= 0x19) + while((n = hexdig[*++s]) !=0 && n <= 0x19) { + if (e1 & 0xf8000000) + big = 1; e1 = 10*e1 + n - 0x10; + } if (esign) e1 = -e1; e += e1; } *sp = (char*)s; + if (!havedig) + *sp = (char*)s0 - 1; + if (zret) + return STRTOG_Zero; + if (big) { + if (esign) { + switch(fpi->rounding) { + case FPI_Round_up: + if (sign) + break; + goto ret_tiny; + case FPI_Round_down: + if (!sign) + break; + goto ret_tiny; + } + goto retz; + ret_tiny: + b = Balloc(0); + b->wds = 1; + b->x[0] = 1; + goto dret; + } + switch(fpi->rounding) { + case FPI_Round_near: + goto ovfl1; + case FPI_Round_up: + if (!sign) + goto ovfl1; + goto ret_big; + case FPI_Round_down: + if (sign) + goto ovfl1; + goto ret_big; + } + ret_big: + nbits = fpi->nbits; + n0 = n = nbits >> kshift; + if (nbits & kmask) + ++n; + for(j = n, k = 0; j >>= 1; ++k); + *bp = b = Balloc(k); + b->wds = n; + for(j = 0; j < n0; ++j) + b->x[j] = ALL_ON; + if (n > n0) + b->x[j] = ULbits >> (ULbits - (nbits & kmask)); + *exp = fpi->emin; + return STRTOG_Normal | STRTOG_Inexlo; + } n = s1 - s0 - 1; - for(k = 0; n > 7; n >>= 1) + for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1) k++; b = Balloc(k); x = b->x; n = 0; L = 0; +#ifdef USE_LOCALE + for(i = 0; decimalpoint[i+1]; ++i); +#endif while(s1 > s0) { - if (*--s1 == decimalpoint) +#ifdef USE_LOCALE + if (*--s1 == decimalpoint[i]) { + s1 -= i; continue; - if (n == 32) { + } +#else + if (*--s1 == '.') + continue; +#endif + if (n == ULbits) { *x++ = L; L = 0; n = 0; @@ -137,7 +228,7 @@ } *x++ = L; b->wds = n = x - b->x; - n = 32*n - hi0bits(L); + n = ULbits*n - hi0bits(L); nbits = fpi->nbits; lostbits = 0; x = b->x; @@ -148,7 +239,7 @@ k = n - 1; if (x[k>>kshift] & 1 << (k & kmask)) { lostbits = 2; - if (k > 1 && any_on(b,k-1)) + if (k > 0 && any_on(b,k)) lostbits = 3; } } @@ -164,7 +255,10 @@ if (e > fpi->emax) { ovfl: Bfree(b); - *bp = 0; + ovfl1: +#ifndef NO_ERRNO + errno = ERANGE; +#endif return STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi; } irv = STRTOG_Normal; @@ -184,15 +278,22 @@ case FPI_Round_down: if (sign) { one_bit: - *exp = fpi->emin; x[0] = b->wds = 1; + dret: *bp = b; + *exp = fpi->emin; +#ifndef NO_ERRNO + errno = ERANGE; +#endif return STRTOG_Denormal | STRTOG_Inexhi | STRTOG_Underflow; } } Bfree(b); - *bp = 0; + retz: +#ifndef NO_ERRNO + errno = ERANGE; +#endif return STRTOG_Zero | STRTOG_Inexlo | STRTOG_Underflow; } k = n - 1; @@ -213,7 +314,7 @@ break; case FPI_Round_near: if (lostbits & 2 - && (lostbits & 1) | x[0] & 1) + && (lostbits | x[0]) & 1) up = 1; break; case FPI_Round_up: @@ -232,8 +333,8 @@ irv = STRTOG_Normal; } else if (b->wds > k - || (n = nbits & kmask) !=0 - && hi0bits(x[k-1]) < 32-n) { + || ((n = nbits & kmask) !=0 + && hi0bits(x[k-1]) < 32-n)) { rshift(b,1); if (++e > fpi->emax) goto ovfl; diff --git a/contrib/gdtoa/gmisc.c b/contrib/gdtoa/gmisc.c index 1607f4b..8270ef9 100644 --- a/contrib/gdtoa/gmisc.c +++ b/contrib/gdtoa/gmisc.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 73afca1..fa6e18d 100644 --- a/contrib/gdtoa/hd_init.c +++ b/contrib/gdtoa/hd_init.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 7a7e03a..a443721 100644 --- a/contrib/gdtoa/hexnan.c +++ b/contrib/gdtoa/hexnan.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -77,7 +71,13 @@ x1 = xe = x; havedig = hd0 = i = 0; s = *sp; - while(c = *(CONST unsigned char*)++s) { + /* allow optional initial 0x or 0X */ + while((c = *(CONST unsigned char*)(s+1)) && c <= ' ') + ++s; + if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X') + && *(CONST unsigned char*)(s+3) > ' ') + s += 2; + while((c = *(CONST unsigned char*)++s)) { if (!(h = hexdig[c])) { if (c <= ' ') { if (hd0 < havedig) { @@ -92,12 +92,25 @@ x1 = x; i = 0; } + while(*(CONST unsigned char*)(s+1) <= ' ') + ++s; + if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X') + && *(CONST unsigned char*)(s+3) > ' ') + s += 2; continue; } if (/*(*/ c == ')' && havedig) { *sp = s + 1; break; } +#ifndef GDTOA_NON_PEDANTIC_NANCHECK + do { + if (/*(*/ c == ')') { + *sp = s + 1; + break; + } + } while((c = *++s)); +#endif return STRTOG_NaN; } havedig++; @@ -107,7 +120,7 @@ i = 1; *--x = 0; } - *x = (*x << 4) | h & 0xf; + *x = (*x << 4) | (h & 0xf); } if (!havedig) return STRTOG_NaN; diff --git a/contrib/gdtoa/makefile b/contrib/gdtoa/makefile index 3387a65..97bd44f 100644 --- a/contrib/gdtoa/makefile +++ b/contrib/gdtoa/makefile @@ -25,39 +25,57 @@ .SUFFIXES: .c .o CC = cc -CFLAGS = -g -DINFNAN_CHECK +CFLAGS = -g +AR ?= ar +ARFLAGS ?= ruv .c.o: $(CC) -c $(CFLAGS) $*.c -all: arith.h gdtoa.a +# invoke "make Printf" to add printf.o to gdtoa.a (if desired) + +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 -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\ - 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 strtorf.c strtorx.c strtorxL.c sum.c ulp.c +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 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 strtorf.c\ + strtorx.c strtorxL.c sum.c ulp.c $(CC) -c $(CFLAGS) $? - x=`echo $? | sed 's/\.c/.o/g'` && ar ruv gdtoa.a $$x && rm $$x + x=`echo $? | sed 's/\.c/.o/g'` && $(AR) $(ARFLAGS) gdtoa.a $$x && rm $$x ranlib gdtoa.a || true +Printf: all printf.c + $(CC) -c $(CFLAGS) printf.c + $(AR) $(ARFLAGS) gdtoa.a printf.o + rm printf.o + touch Printf + # If your system lacks ranlib, you do not need it. -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\ - 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\ - strtorf.c strtorx.c strtorxL.c sum.c ulp.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\ + gdtoa_fltrnds.h gdtoaimp.h gethex.c gmisc.c hd_init.c hexnan.c\ + makefile misc.c printf.c printf.c0 qnan.c smisc.c stdio1.h\ + strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c\ + strtoIxL.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 +# "make -r xsum.out" to check for transmission errors; source for xsum is # netlib's "xsum.c from f2c", e.g., # ftp://netlib.bell-labs.com/netlib/f2c/xsum.c.gz @@ -66,4 +84,4 @@ 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] Printf xsum.out xsum1.out diff --git a/contrib/gdtoa/misc.c b/contrib/gdtoa/misc.c index 5f5cbc2..e5f7b04 100644 --- a/contrib/gdtoa/misc.c +++ b/contrib/gdtoa/misc.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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,7 +55,9 @@ #endif ACQUIRE_DTOA_LOCK(0); - if ( (rv = freelist[k]) !=0) { + /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */ + /* but this case seems very unlikely. */ + if (k <= Kmax && (rv = freelist[k]) !=0) { freelist[k] = rv->next; } else { @@ -71,7 +67,7 @@ #else len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) /sizeof(double); - if (pmem_next - private_mem + len <= PRIVATE_mem) { + if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { rv = (Bigint*)pmem_next; pmem_next += len; } @@ -95,10 +91,18 @@ #endif { if (v) { - ACQUIRE_DTOA_LOCK(0); - v->next = freelist[v->k]; - freelist[v->k] = v; - FREE_DTOA_LOCK(0); + if (v->k > Kmax) +#ifdef FREE + FREE((void*)v); +#else + free((void*)v); +#endif + else { + ACQUIRE_DTOA_LOCK(0); + v->next = freelist[v->k]; + freelist[v->k] = v; + FREE_DTOA_LOCK(0); + } } } @@ -110,8 +114,8 @@ (ULong *y) #endif { - register int k; - register ULong x = *y; + int k; + ULong x = *y; if (x & 7) { if (x & 1) @@ -143,7 +147,7 @@ if (!(x & 1)) { k++; x >>= 1; - if (!x & 1) + if (!x) return 32; } *y = x; @@ -208,14 +212,14 @@ } int -hi0bits +hi0bits_D2A #ifdef KR_headers - (x) register ULong x; + (x) ULong x; #else - (register ULong x) + (ULong x) #endif { - register int k = 0; + int k = 0; if (!(x & 0xffff0000)) { k = 16; @@ -618,12 +622,12 @@ { ULong *xa, *xa0, w, y, z; int k; - double d; + U d; #ifdef VAX ULong d0, d1; #else -#define d0 word0(d) -#define d1 word1(d) +#define d0 word0(&d) +#define d1 word1(&d) #endif xa0 = a->x; @@ -636,16 +640,16 @@ *e = 32 - k; #ifdef Pack_32 if (k < Ebits) { - d0 = Exp_1 | y >> Ebits - k; + d0 = Exp_1 | y >> (Ebits - k); w = xa > xa0 ? *--xa : 0; - d1 = y << (32-Ebits) + k | w >> Ebits - k; + d1 = y << ((32-Ebits) + k) | w >> (Ebits - k); goto ret_d; } z = xa > xa0 ? *--xa : 0; if (k -= Ebits) { - d0 = Exp_1 | y << k | z >> 32 - k; + d0 = Exp_1 | y << k | z >> (32 - k); y = xa > xa0 ? *--xa : 0; - d1 = z << k | y >> 32 - k; + d1 = z << k | y >> (32 - k); } else { d0 = Exp_1 | y; @@ -669,10 +673,10 @@ #endif ret_d: #ifdef VAX - word0(d) = d0 >> 16 | d0 << 16; - word1(d) = d1 >> 16 | d1 << 16; + word0(&d) = d0 >> 16 | d0 << 16; + word1(&d) = d1 >> 16 | d1 << 16; #endif - return dval(d); + return dval(&d); } #undef d0 #undef d1 @@ -680,21 +684,28 @@ Bigint * d2b #ifdef KR_headers - (d, e, bits) double d; int *e, *bits; + (dd, e, bits) double dd; int *e, *bits; #else - (double d, int *e, int *bits) + (double dd, int *e, int *bits) #endif { Bigint *b; - int de, i, k; + U d; +#ifndef Sudden_Underflow + int i; +#endif + int de, k; ULong *x, y, z; #ifdef VAX ULong d0, d1; - d0 = word0(d) >> 16 | word0(d) << 16; - d1 = word1(d) >> 16 | word1(d) << 16; #else -#define d0 word0(d) -#define d1 word1(d) +#define d0 word0(&d) +#define d1 word1(&d) +#endif + d.d = dd; +#ifdef VAX + d0 = word0(&d) >> 16 | word0(&d) << 16; + d1 = word1(&d) >> 16 | word1(&d) << 16; #endif #ifdef Pack_32 @@ -718,21 +729,23 @@ #ifdef Pack_32 if ( (y = d1) !=0) { if ( (k = lo0bits(&y)) !=0) { - x[0] = y | z << 32 - k; + x[0] = y | z << (32 - k); z >>= k; } 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 - if (!z) - Bug("Zero passed to d2b"); -#endif k = lo0bits(&z); x[0] = z; - i = b->wds = 1; +#ifndef Sudden_Underflow + i = +#endif + b->wds = 1; k += 32; } #else @@ -785,7 +798,7 @@ #endif #ifdef IBM *e = (de - Bias - (P-1) << 2) + k; - *bits = 4*P + 8 - k - hi0bits(word0(d) & Frac_mask); + *bits = 4*P + 8 - k - hi0bits(word0(&d) & Frac_mask); #else *e = de - Bias - (P-1) + k; *bits = P - k; @@ -838,7 +851,7 @@ strcp_D2A(char *a, CONST char *b) #endif { - while(*a = *b++) + while((*a = *b++)) a++; return a; } @@ -852,8 +865,8 @@ memcpy_D2A(void *a1, void *b1, size_t len) #endif { - register char *a = (char*)a1, *ae = a + len; - register char *b = (char*)b1, *a0 = a; + char *a = (char*)a1, *ae = a + len; + char *b = (char*)b1, *a0 = a; while(a < ae) *a++ = *b++; return a0; diff --git a/contrib/gdtoa/smisc.c b/contrib/gdtoa/smisc.c index e20e9da..f4dbafb 100644 --- a/contrib/gdtoa/smisc.c +++ b/contrib/gdtoa/smisc.c @@ -26,23 +26,17 @@ ****************************************************************/ -/* 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" Bigint * s2b #ifdef KR_headers - (s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9; + (s, nd0, nd, y9, dplen) CONST char *s; int dplen, nd0, nd; ULong y9; #else - (CONST char *s, int nd0, int nd, ULong y9) + (CONST char *s, int nd0, int nd, ULong y9, int dplen) #endif { Bigint *b; @@ -66,10 +60,10 @@ s += 9; do b = multadd(b, 10, *s++ - '0'); while(++i < nd0); - s++; + s += dplen; } else - s += 10; + s += dplen + 9; for(; i < nd; i++) b = multadd(b, 10, *s++ - '0'); return b; @@ -83,33 +77,33 @@ (Bigint *a, Bigint *b) #endif { - double da, db; + U da, db; int k, ka, kb; - dval(da) = b2d(a, &ka); - dval(db) = b2d(b, &kb); + dval(&da) = b2d(a, &ka); + dval(&db) = b2d(b, &kb); k = ka - kb + ULbits*(a->wds - b->wds); #ifdef IBM if (k > 0) { - word0(da) += (k >> 2)*Exp_msk1; + word0(&da) += (k >> 2)*Exp_msk1; if (k &= 3) - dval(da) *= 1 << k; + dval(&da) *= 1 << k; } else { k = -k; - word0(db) += (k >> 2)*Exp_msk1; + word0(&db) += (k >> 2)*Exp_msk1; if (k &= 3) - dval(db) *= 1 << k; + dval(&db) *= 1 << k; } #else if (k > 0) - word0(da) += k*Exp_msk1; + word0(&da) += k*Exp_msk1; else { k = -k; - word0(db) += k*Exp_msk1; + word0(&db) += k*Exp_msk1; } #endif - return dval(da) / dval(db); + return dval(&da) / dval(&db); } #ifdef INFNAN_CHECK diff --git a/contrib/gdtoa/strtoIQ.c b/contrib/gdtoa/strtoIQ.c index 0ce0420..9ce5120 100644 --- a/contrib/gdtoa/strtoIQ.c +++ b/contrib/gdtoa/strtoIQ.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 f986e04..1c97d38 100644 --- a/contrib/gdtoa/strtoId.c +++ b/contrib/gdtoa/strtoId.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 9622c18..40b7936 100644 --- a/contrib/gdtoa/strtoIdd.c +++ b/contrib/gdtoa/strtoIdd.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 c439ff5..65ecab2 100644 --- a/contrib/gdtoa/strtoIf.c +++ b/contrib/gdtoa/strtoIf.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 a766813..6a17760 100644 --- a/contrib/gdtoa/strtoIg.c +++ b/contrib/gdtoa/strtoIg.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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,16 +61,20 @@ if (rv & STRTOG_Inexlo) { swap = 0; b1 = increment(b1); - if (fpi->sudden_underflow - && (rv & STRTOG_Retmask) == STRTOG_Zero) { - b1->x[0] = 0; - b1->x[nw1] = 1L << nb11; - rv1 += STRTOG_Normal - STRTOG_Zero; - rv1 &= ~STRTOG_Underflow; + if ((rv & STRTOG_Retmask) == STRTOG_Zero) { + if (fpi->sudden_underflow) { + b1->x[0] = 0; + b1->x[nw1] = 1L << nb11; + rv1 += STRTOG_Normal - STRTOG_Zero; + rv1 &= ~STRTOG_Underflow; + goto swapcheck; + } + rv1 &= STRTOG_Inexlo | STRTOG_Underflow | STRTOG_Zero; + rv1 |= STRTOG_Inexhi | STRTOG_Denormal; goto swapcheck; } if (b1->wds > nw - || nb1 && b1->x[nw1] & 1L << nb1) { + || (nb1 && b1->x[nw1] & 1L << nb1)) { if (++e1 > fpi->emax) rv1 = STRTOG_Infinite | STRTOG_Inexhi; rshift(b1, 1); diff --git a/contrib/gdtoa/strtoIx.c b/contrib/gdtoa/strtoIx.c index d699f04..783a631 100644 --- a/contrib/gdtoa/strtoIx.c +++ b/contrib/gdtoa/strtoIx.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 c579589..869bfd1 100644 --- a/contrib/gdtoa/strtoIxL.c +++ b/contrib/gdtoa/strtoIxL.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 4913d50..50d0db0 100644 --- a/contrib/gdtoa/strtod.c +++ b/contrib/gdtoa/strtod.c @@ -26,12 +26,15 @@ ****************************************************************/ -/* 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 "."). */ + +/* $FreeBSD: releng/11.1/contrib/gdtoa/strtod.c 227753 2011-11-20 14:45:42Z theraven $ */ #include "gdtoaimp.h" +#ifndef NO_FENV_H +#include +#endif #ifdef USE_LOCALE #include "locale.h" @@ -41,49 +44,106 @@ #ifndef NO_IEEE_Scale #define Avoid_Underflow #undef tinytens -/* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */ +/* The factor of 2^106 in tinytens[4] helps us avoid setting the underflow */ /* flag unnecessarily. It leads to a song and dance at the end of strtod. */ static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, - 9007199254740992.e-256 + 9007199254740992.*9007199254740992.e-256 }; #endif #endif #ifdef Honor_FLT_ROUNDS -#define Rounding rounding #undef Check_FLT_ROUNDS #define Check_FLT_ROUNDS #else #define Rounding Flt_Rounds #endif - double -strtod +#ifdef Avoid_Underflow /*{*/ + static double +sulp #ifdef KR_headers - (s00, se) CONST char *s00; char **se; + (x, scale) U *x; int scale; #else - (CONST char *s00, char **se) + (U *x, int scale) +#endif +{ + U u; + double rv; + int i; + + rv = ulp(x); + if (!scale || (i = 2*P + 1 - ((word0(x) & Exp_mask) >> Exp_shift)) <= 0) + return rv; /* Is there an example where i <= 0 ? */ + word0(&u) = Exp_1 + (i << Exp_shift); + word1(&u) = 0; + return rv * u.d; + } +#endif /*}*/ + + double +strtod_l +#ifdef KR_headers + (s00, se, loc) CONST char *s00; char **se; locale_t loc +#else + (CONST char *s00, char **se, locale_t loc) #endif { #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; + double aadj; Long L; + U adj, aadj1, rv, rv0; ULong y, z; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; +#ifdef Avoid_Underflow + ULong Lsb, Lsb1; +#endif #ifdef SET_INEXACT int inexact, oldinexact; #endif -#ifdef Honor_FLT_ROUNDS - int rounding; -#endif +#ifdef USE_LOCALE /*{{*/ +#ifdef NO_LOCALE_CACHE + char *decimalpoint = localeconv_l(loc)->decimal_point; + int dplen = strlen(decimalpoint); +#else + char *decimalpoint; + static char *decimalpoint_cache; + static int dplen; + if (!(s0 = decimalpoint_cache)) { + s0 = localeconv_l(loc)->decimal_point; + if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { + strcpy(decimalpoint_cache, s0); + s0 = decimalpoint_cache; + } + dplen = strlen(s0); + } + decimalpoint = (char*)s0; +#endif /*NO_LOCALE_CACHE*/ +#else /*USE_LOCALE}{*/ +#define dplen 1 +#endif /*USE_LOCALE}}*/ - sign = nz0 = nz = 0; - dval(rv) = 0.; +#ifdef Honor_FLT_ROUNDS /*{*/ + int Rounding; +#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ + Rounding = Flt_Rounds; +#else /*}{*/ + Rounding = 1; + switch(fegetround()) { + case FE_TOWARDZERO: Rounding = 0; break; + case FE_UPWARD: Rounding = 2; break; + case FE_DOWNWARD: Rounding = 3; + } +#endif /*}}*/ +#endif /*}*/ + + sign = nz0 = nz = decpt = 0; + dval(&rv) = 0.; for(s = s00;;s++) switch(*s) { case '-': sign = 1; @@ -106,7 +166,7 @@ } break2: if (*s == '0') { -#ifndef NO_HEX_FP +#ifndef NO_HEX_FP /*{*/ { static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; Long exp; @@ -114,7 +174,14 @@ switch(s[1]) { case 'x': case 'X': - switch((i = gethex(&s, &fpi, &exp, &bb, sign)) & STRTOG_Retmask) { + { +#ifdef Honor_FLT_ROUNDS + FPI fpi1 = fpi; + fpi1.rounding = Rounding; +#else +#define fpi1 fpi +#endif + switch((i = gethex(&s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) { case STRTOG_NoNumber: s = s00; sign = 0; @@ -126,11 +193,11 @@ Bfree(bb); } ULtod(((U*)&rv)->L, bits, exp, i); - } + }} goto ret; } } -#endif +#endif /*}*/ nz0 = 1; while(*++s == '0') ; if (!*s) @@ -145,12 +212,17 @@ z = 10*z + c - '0'; nd0 = nd; #ifdef USE_LOCALE - if (c == *localeconv()->decimal_point) + if (c == *decimalpoint) { + for(i = 1; decimalpoint[i]; ++i) + if (s[i] != decimalpoint[i]) + goto dig_done; + s += i; + c = *s; #else - if (c == '.') -#endif - { + if (c == '.') { c = *++s; +#endif + decpt = 1; if (!nd) { for(; c == '0'; c = *++s) nz++; @@ -179,7 +251,7 @@ nz = 0; } } - } + }/*}*/ dig_done: e = 0; if (c == 'e' || c == 'E') { @@ -225,15 +297,16 @@ 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")) { --s; if (!match(&s,"inity")) ++s; - word0(rv) = 0x7ff00000; - word1(rv) = 0; + word0(&rv) = 0x7ff00000; + word1(&rv) = 0; goto ret; } break; @@ -244,12 +317,14 @@ if (*s == '(' /*)*/ && hexnan(&s, &fpinan, bits) == STRTOG_NaNbits) { - word0(rv) = 0x7ff00000 | bits[1]; - word1(rv) = bits[0]; + word0(&rv) = 0x7ff80000 | bits[1]; + word1(&rv) = bits[0]; } else { - word0(rv) = NAN_WORD0; - word1(rv) = NAN_WORD1; +#endif + word0(&rv) = NAN_WORD0; + word1(&rv) = NAN_WORD1; +#ifndef No_Hex_NaN } #endif goto ret; @@ -272,13 +347,13 @@ if (!nd0) nd0 = nd; k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; - dval(rv) = y; + dval(&rv) = y; if (k > 9) { #ifdef SET_INEXACT if (k > DBL_DIG) oldinexact = get_inexact(); #endif - dval(rv) = tens[k - 9] * dval(rv) + z; + dval(&rv) = tens[k - 9] * dval(&rv) + z; } bd0 = 0; if (nd <= DBL_DIG @@ -290,6 +365,7 @@ ) { if (!e) goto ret; +#ifndef ROUND_BIASED_without_Round_Up if (e > 0) { if (e <= Ten_pmax) { #ifdef VAX @@ -298,11 +374,11 @@ #ifdef Honor_FLT_ROUNDS /* round correctly FLT_ROUNDS = 2 or 3 */ if (sign) { - rv = -rv; + rv.d = -rv.d; sign = 0; } #endif - /* rv = */ rounded_product(dval(rv), tens[e]); + /* rv = */ rounded_product(dval(&rv), tens[e]); goto ret; #endif } @@ -314,25 +390,25 @@ #ifdef Honor_FLT_ROUNDS /* round correctly FLT_ROUNDS = 2 or 3 */ if (sign) { - rv = -rv; + rv.d = -rv.d; sign = 0; } #endif e -= i; - dval(rv) *= tens[i]; + dval(&rv) *= tens[i]; #ifdef VAX /* VAX exponent range is so narrow we must * worry about overflow here... */ vax_ovfl_check: - word0(rv) -= P*Exp_msk1; - /* rv = */ rounded_product(dval(rv), tens[e]); - if ((word0(rv) & Exp_mask) + word0(&rv) -= P*Exp_msk1; + /* rv = */ rounded_product(dval(&rv), tens[e]); + if ((word0(&rv) & Exp_mask) > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) goto ovfl; - word0(rv) += P*Exp_msk1; + word0(&rv) += P*Exp_msk1; #else - /* rv = */ rounded_product(dval(rv), tens[e]); + /* rv = */ rounded_product(dval(&rv), tens[e]); #endif goto ret; } @@ -342,14 +418,15 @@ #ifdef Honor_FLT_ROUNDS /* round correctly FLT_ROUNDS = 2 or 3 */ if (sign) { - rv = -rv; + rv.d = -rv.d; sign = 0; } #endif - /* rv = */ rounded_quotient(dval(rv), tens[-e]); + /* rv = */ rounded_quotient(dval(&rv), tens[-e]); goto ret; } #endif +#endif /* ROUND_BIASED_without_Round_Up */ } e1 += nd - k; @@ -363,12 +440,12 @@ scale = 0; #endif #ifdef Honor_FLT_ROUNDS - if ((rounding = Flt_Rounds) >= 2) { + if (Rounding >= 2) { if (sign) - rounding = rounding == 2 ? 0 : 2; + Rounding = Rounding == 2 ? 0 : 2; else - if (rounding != 2) - rounding = 0; + if (Rounding != 2) + Rounding = 0; } #endif #endif /*IEEE_Arith*/ @@ -377,67 +454,73 @@ if (e1 > 0) { if ( (i = e1 & 15) !=0) - dval(rv) *= tens[i]; + dval(&rv) *= tens[i]; if (e1 &= ~15) { if (e1 > DBL_MAX_10_EXP) { ovfl: -#ifndef NO_ERRNO - errno = ERANGE; -#endif /* Can't trust HUGE_VAL */ #ifdef IEEE_Arith #ifdef Honor_FLT_ROUNDS - switch(rounding) { + switch(Rounding) { case 0: /* toward 0 */ case 3: /* toward -infinity */ - word0(rv) = Big0; - word1(rv) = Big1; + word0(&rv) = Big0; + word1(&rv) = Big1; break; default: - word0(rv) = Exp_mask; - word1(rv) = 0; + word0(&rv) = Exp_mask; + word1(&rv) = 0; } #else /*Honor_FLT_ROUNDS*/ - word0(rv) = Exp_mask; - word1(rv) = 0; + word0(&rv) = Exp_mask; + word1(&rv) = 0; #endif /*Honor_FLT_ROUNDS*/ #ifdef SET_INEXACT /* set overflow bit */ - dval(rv0) = 1e300; - dval(rv0) *= dval(rv0); + dval(&rv0) = 1e300; + dval(&rv0) *= dval(&rv0); #endif #else /*IEEE_Arith*/ - word0(rv) = Big0; - word1(rv) = Big1; + word0(&rv) = Big0; + word1(&rv) = Big1; #endif /*IEEE_Arith*/ - if (bd0) - goto retfree; + range_err: + if (bd0) { + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(bd0); + Bfree(delta); + } +#ifndef NO_ERRNO + errno = ERANGE; +#endif goto ret; } e1 >>= 4; for(j = 0; e1 > 1; j++, e1 >>= 1) if (e1 & 1) - dval(rv) *= bigtens[j]; + dval(&rv) *= bigtens[j]; /* The last multiplication could overflow. */ - word0(rv) -= P*Exp_msk1; - dval(rv) *= bigtens[j]; - if ((z = word0(rv) & Exp_mask) + word0(&rv) -= P*Exp_msk1; + dval(&rv) *= bigtens[j]; + if ((z = word0(&rv) & Exp_mask) > Exp_msk1*(DBL_MAX_EXP+Bias-P)) goto ovfl; if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { /* set to largest number */ /* (Can't trust DBL_MAX) */ - word0(rv) = Big0; - word1(rv) = Big1; + word0(&rv) = Big0; + word1(&rv) = Big1; } else - word0(rv) += P*Exp_msk1; + word0(&rv) += P*Exp_msk1; } } else if (e1 < 0) { e1 = -e1; if ( (i = e1 & 15) !=0) - dval(rv) /= tens[i]; + dval(&rv) /= tens[i]; if (e1 >>= 4) { if (e1 >= 1 << n_bigtens) goto undfl; @@ -446,44 +529,39 @@ scale = 2*P; for(j = 0; e1 > 0; j++, e1 >>= 1) if (e1 & 1) - dval(rv) *= tinytens[j]; - if (scale && (j = 2*P + 1 - ((word0(rv) & Exp_mask) + dval(&rv) *= tinytens[j]; + if (scale && (j = 2*P + 1 - ((word0(&rv) & Exp_mask) >> Exp_shift)) > 0) { /* scaled rv is denormal; zap j low bits */ if (j >= 32) { - word1(rv) = 0; + word1(&rv) = 0; if (j >= 53) - word0(rv) = (P+2)*Exp_msk1; + word0(&rv) = (P+2)*Exp_msk1; else - word0(rv) &= 0xffffffff << j-32; + word0(&rv) &= 0xffffffff << (j-32); } else - word1(rv) &= 0xffffffff << j; + word1(&rv) &= 0xffffffff << j; } #else for(j = 0; e1 > 1; j++, e1 >>= 1) if (e1 & 1) - dval(rv) *= tinytens[j]; + dval(&rv) *= tinytens[j]; /* The last multiplication could underflow. */ - dval(rv0) = dval(rv); - dval(rv) *= tinytens[j]; - if (!dval(rv)) { - dval(rv) = 2.*dval(rv0); - dval(rv) *= tinytens[j]; + dval(&rv0) = dval(&rv); + dval(&rv) *= tinytens[j]; + if (!dval(&rv)) { + dval(&rv) = 2.*dval(&rv0); + dval(&rv) *= tinytens[j]; #endif - if (!dval(rv)) { + if (!dval(&rv)) { undfl: - dval(rv) = 0.; -#ifndef NO_ERRNO - errno = ERANGE; -#endif - if (bd0) - goto retfree; - goto ret; + dval(&rv) = 0.; + goto range_err; } #ifndef Avoid_Underflow - word0(rv) = Tiny0; - word1(rv) = Tiny1; + word0(&rv) = Tiny0; + word1(&rv) = Tiny1; /* The refinement below will clean * this approximation up. */ @@ -496,12 +574,12 @@ /* Put digits into bd: true value = bd * 10^e */ - bd0 = s2b(s0, nd0, nd, y); + bd0 = s2b(s0, nd0, nd, y, dplen); for(;;) { bd = Balloc(bd0->k); Bcopy(bd, bd0); - bb = d2b(dval(rv), &bbe, &bbbits); /* rv = bb * 2^bbe */ + bb = d2b(dval(&rv), &bbe, &bbbits); /* rv = bb * 2^bbe */ bs = i2b(1); if (e >= 0) { @@ -518,16 +596,23 @@ bd2 -= bbe; bs2 = bb2; #ifdef Honor_FLT_ROUNDS - if (rounding != 1) + if (Rounding != 1) bs2++; #endif #ifdef Avoid_Underflow + Lsb = LSB; + Lsb1 = 0; j = bbe - scale; i = j + bbbits - 1; /* logb(rv) */ - if (i < Emin) /* denormal */ - j += P - Emin; - else - j = P + 1 - bbbits; + j = P + 1 - bbbits; + if (i < Emin) { /* denormal */ + i = Emin - i; + j -= i; + if (i < 32) + Lsb <<= i; + else + Lsb1 = Lsb << (i-32); + } #else /*Avoid_Underflow*/ #ifdef Sudden_Underflow #ifdef IBM @@ -537,7 +622,7 @@ #endif #else /*Sudden_Underflow*/ j = bbe; - i = j + bbbits - 1; /* logb(rv) */ + i = j + bbbits - 1; /* logb(&rv) */ if (i < Emin) /* denormal */ j += P - Emin; else @@ -576,7 +661,7 @@ delta->sign = 0; i = cmp(delta, bs); #ifdef Honor_FLT_ROUNDS - if (rounding != 1) { + if (Rounding != 1) { if (i < 0) { /* Error is less than an ulp */ if (!delta->x[0] && delta->wds <= 1) { @@ -586,17 +671,17 @@ #endif break; } - if (rounding) { + if (Rounding) { if (dsign) { - adj = 1.; + dval(&adj) = 1.; goto apply_adj; } } else if (!dsign) { - adj = -1.; - if (!word1(rv) - && !(word0(rv) & Frac_mask)) { - y = word0(rv) & Exp_mask; + dval(&adj) = -1.; + if (!word1(&rv) + && !(word0(&rv) & Frac_mask)) { + y = word0(&rv) & Exp_mask; #ifdef Avoid_Underflow if (!scale || y > 2*P*Exp_msk1) #else @@ -605,63 +690,66 @@ { delta = lshift(delta,Log2P); if (cmp(delta, bs) <= 0) - adj = -0.5; + dval(&adj) = -0.5; } } apply_adj: #ifdef Avoid_Underflow - if (scale && (y = word0(rv) & Exp_mask) + if (scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) - word0(adj) += (2*P+1)*Exp_msk1 - y; + word0(&adj) += (2*P+1)*Exp_msk1 - y; #else #ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= + if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) { - word0(rv) += P*Exp_msk1; - dval(rv) += adj*ulp(dval(rv)); - word0(rv) -= P*Exp_msk1; + word0(&rv) += P*Exp_msk1; + dval(&rv) += adj*ulp(&rv); + word0(&rv) -= P*Exp_msk1; } else #endif /*Sudden_Underflow*/ #endif /*Avoid_Underflow*/ - dval(rv) += adj*ulp(dval(rv)); + dval(&rv) += adj.d*ulp(&rv); } break; } - adj = ratio(delta, bs); - if (adj < 1.) - adj = 1.; - if (adj <= 0x7ffffffe) { - /* adj = rounding ? ceil(adj) : floor(adj); */ - y = adj; - if (y != adj) { - if (!((rounding>>1) ^ dsign)) + dval(&adj) = ratio(delta, bs); + if (adj.d < 1.) + dval(&adj) = 1.; + if (adj.d <= 0x7ffffffe) { + /* dval(&adj) = Rounding ? ceil(&adj) : floor(&adj); */ + y = adj.d; + if (y != adj.d) { + if (!((Rounding>>1) ^ dsign)) y++; - adj = y; + dval(&adj) = y; } } #ifdef Avoid_Underflow - if (scale && (y = word0(rv) & Exp_mask) <= 2*P*Exp_msk1) - word0(adj) += (2*P+1)*Exp_msk1 - y; + if (scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) + word0(&adj) += (2*P+1)*Exp_msk1 - y; #else #ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { - word0(rv) += P*Exp_msk1; - adj *= ulp(dval(rv)); + if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) { + word0(&rv) += P*Exp_msk1; + dval(&adj) *= ulp(&rv); if (dsign) - dval(rv) += adj; + dval(&rv) += adj; else - dval(rv) -= adj; - word0(rv) -= P*Exp_msk1; + dval(&rv) -= adj; + word0(&rv) -= P*Exp_msk1; goto cont; } #endif /*Sudden_Underflow*/ #endif /*Avoid_Underflow*/ - adj *= ulp(dval(rv)); - if (dsign) - dval(rv) += adj; + dval(&adj) *= ulp(&rv); + if (dsign) { + if (word0(&rv) == Big0 && word1(&rv) == Big1) + goto ovfl; + dval(&rv) += adj.d; + } else - dval(rv) -= adj; + dval(&rv) -= adj.d; goto cont; } #endif /*Honor_FLT_ROUNDS*/ @@ -670,12 +758,12 @@ /* Error is less than half an ulp -- check for * special case of mantissa a power of two. */ - if (dsign || word1(rv) || word0(rv) & Bndry_mask + if (dsign || word1(&rv) || word0(&rv) & Bndry_mask #ifdef IEEE_Arith #ifdef Avoid_Underflow - || (word0(rv) & Exp_mask) <= (2*P+1)*Exp_msk1 + || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1 #else - || (word0(rv) & Exp_mask) <= Exp_msk1 + || (word0(&rv) & Exp_mask) <= Exp_msk1 #endif #endif ) { @@ -700,32 +788,34 @@ if (i == 0) { /* exactly half-way between */ if (dsign) { - if ((word0(rv) & Bndry_mask1) == Bndry_mask1 - && word1(rv) == ( + if ((word0(&rv) & Bndry_mask1) == Bndry_mask1 + && word1(&rv) == ( #ifdef Avoid_Underflow - (scale && (y = word0(rv) & Exp_mask) <= 2*P*Exp_msk1) + (scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) ? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) : #endif 0xffffffff)) { /*boundary case -- increment exponent*/ - word0(rv) = (word0(rv) & Exp_mask) + if (word0(&rv) == Big0 && word1(&rv) == Big1) + goto ovfl; + word0(&rv) = (word0(&rv) & Exp_mask) + Exp_msk1 #ifdef IBM | Exp_msk1 >> 4 #endif ; - word1(rv) = 0; + word1(&rv) = 0; #ifdef Avoid_Underflow dsign = 0; #endif break; } } - else if (!(word0(rv) & Bndry_mask) && !word1(rv)) { + else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) { drop_down: /* boundary case -- decrement exponent */ #ifdef Sudden_Underflow /*{{*/ - L = word0(rv) & Exp_mask; + L = word0(&rv) & Exp_mask; #ifdef IBM if (L < Exp_msk1) #else @@ -740,7 +830,7 @@ #else /*Sudden_Underflow}{*/ #ifdef Avoid_Underflow if (scale) { - L = word0(rv) & Exp_mask; + L = word0(&rv) & Exp_mask; if (L <= (2*P+1)*Exp_msk1) { if (L > (P+2)*Exp_msk1) /* round even ==> */ @@ -751,10 +841,10 @@ } } #endif /*Avoid_Underflow*/ - L = (word0(rv) & Exp_mask) - Exp_msk1; -#endif /*Sudden_Underflow}*/ - word0(rv) = L | Bndry_mask1; - word1(rv) = 0xffffffff; + L = (word0(&rv) & Exp_mask) - Exp_msk1; +#endif /*Sudden_Underflow}}*/ + word0(&rv) = L | Bndry_mask1; + word1(&rv) = 0xffffffff; #ifdef IBM goto cont; #else @@ -762,16 +852,33 @@ #endif } #ifndef ROUND_BIASED - if (!(word1(rv) & LSB)) +#ifdef Avoid_Underflow + if (Lsb1) { + if (!(word0(&rv) & Lsb1)) + break; + } + else if (!(word1(&rv) & Lsb)) + break; +#else + if (!(word1(&rv) & LSB)) break; #endif +#endif if (dsign) - dval(rv) += ulp(dval(rv)); +#ifdef Avoid_Underflow + dval(&rv) += sulp(&rv, scale); +#else + dval(&rv) += ulp(&rv); +#endif #ifndef ROUND_BIASED else { - dval(rv) -= ulp(dval(rv)); +#ifdef Avoid_Underflow + dval(&rv) -= sulp(&rv, scale); +#else + dval(&rv) -= ulp(&rv); +#endif #ifndef Sudden_Underflow - if (!dval(rv)) + if (!dval(&rv)) goto undfl; #endif } @@ -783,14 +890,14 @@ } if ((aadj = ratio(delta, bs)) <= 2.) { if (dsign) - aadj = aadj1 = 1.; - else if (word1(rv) || word0(rv) & Bndry_mask) { + aadj = dval(&aadj1) = 1.; + else if (word1(&rv) || word0(&rv) & Bndry_mask) { #ifndef Sudden_Underflow - if (word1(rv) == Tiny1 && !word0(rv)) + if (word1(&rv) == Tiny1 && !word0(&rv)) goto undfl; #endif aadj = 1.; - aadj1 = -1.; + dval(&aadj1) = -1.; } else { /* special case -- power of FLT_RADIX to be */ @@ -800,45 +907,45 @@ aadj = 1./FLT_RADIX; else aadj *= 0.5; - aadj1 = -aadj; + dval(&aadj1) = -aadj; } } else { aadj *= 0.5; - aadj1 = dsign ? aadj : -aadj; + dval(&aadj1) = dsign ? aadj : -aadj; #ifdef Check_FLT_ROUNDS switch(Rounding) { case 2: /* towards +infinity */ - aadj1 -= 0.5; + dval(&aadj1) -= 0.5; break; case 0: /* towards 0 */ case 3: /* towards -infinity */ - aadj1 += 0.5; + dval(&aadj1) += 0.5; } #else if (Flt_Rounds == 0) - aadj1 += 0.5; + dval(&aadj1) += 0.5; #endif /*Check_FLT_ROUNDS*/ } - y = word0(rv) & Exp_mask; + y = word0(&rv) & Exp_mask; /* Check for overflow */ if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { - dval(rv0) = dval(rv); - word0(rv) -= P*Exp_msk1; - adj = aadj1 * ulp(dval(rv)); - dval(rv) += adj; - if ((word0(rv) & Exp_mask) >= + dval(&rv0) = dval(&rv); + word0(&rv) -= P*Exp_msk1; + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += dval(&adj); + if ((word0(&rv) & Exp_mask) >= Exp_msk1*(DBL_MAX_EXP+Bias-P)) { - if (word0(rv0) == Big0 && word1(rv0) == Big1) + if (word0(&rv0) == Big0 && word1(&rv0) == Big1) goto ovfl; - word0(rv) = Big0; - word1(rv) = Big1; + word0(&rv) = Big0; + word1(&rv) = Big1; goto cont; } else - word0(rv) += P*Exp_msk1; + word0(&rv) += P*Exp_msk1; } else { #ifdef Avoid_Underflow @@ -847,58 +954,58 @@ if ((z = aadj) <= 0) z = 1; aadj = z; - aadj1 = dsign ? aadj : -aadj; + dval(&aadj1) = dsign ? aadj : -aadj; } - word0(aadj1) += (2*P+1)*Exp_msk1 - y; + word0(&aadj1) += (2*P+1)*Exp_msk1 - y; } - adj = aadj1 * ulp(dval(rv)); - dval(rv) += adj; + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += dval(&adj); #else #ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { - dval(rv0) = dval(rv); - word0(rv) += P*Exp_msk1; - adj = aadj1 * ulp(dval(rv)); - dval(rv) += adj; + if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) { + dval(&rv0) = dval(&rv); + word0(&rv) += P*Exp_msk1; + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += adj; #ifdef IBM - if ((word0(rv) & Exp_mask) < P*Exp_msk1) + if ((word0(&rv) & Exp_mask) < P*Exp_msk1) #else - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) + if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) #endif { - if (word0(rv0) == Tiny0 - && word1(rv0) == Tiny1) + if (word0(&rv0) == Tiny0 + && word1(&rv0) == Tiny1) goto undfl; - word0(rv) = Tiny0; - word1(rv) = Tiny1; + word0(&rv) = Tiny0; + word1(&rv) = Tiny1; goto cont; } else - word0(rv) -= P*Exp_msk1; + word0(&rv) -= P*Exp_msk1; } else { - adj = aadj1 * ulp(dval(rv)); - dval(rv) += adj; + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += adj; } #else /*Sudden_Underflow*/ - /* Compute adj so that the IEEE rounding rules will - * correctly round rv + adj in some half-way cases. - * If rv * ulp(rv) is denormalized (i.e., + /* Compute dval(&adj) so that the IEEE rounding rules will + * correctly round rv + dval(&adj) in some half-way cases. + * If rv * ulp(&rv) is denormalized (i.e., * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid * trouble from bits lost to denormalization; * example: 1.2e-307 . */ if (y <= (P-1)*Exp_msk1 && aadj > 1.) { - aadj1 = (double)(int)(aadj + 0.5); + dval(&aadj1) = (double)(int)(aadj + 0.5); if (!dsign) - aadj1 = -aadj1; + dval(&aadj1) = -dval(&aadj1); } - adj = aadj1 * ulp(dval(rv)); - dval(rv) += adj; + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += adj; #endif /*Sudden_Underflow*/ #endif /*Avoid_Underflow*/ } - z = word0(rv) & Exp_mask; + z = word0(&rv) & Exp_mask; #ifndef SET_INEXACT #ifdef Avoid_Underflow if (!scale) @@ -908,7 +1015,7 @@ L = (Long)aadj; aadj -= L; /* The tolerances below are conservative. */ - if (dsign || word1(rv) || word0(rv) & Bndry_mask) { + if (dsign || word1(&rv) || word0(&rv) & Bndry_mask) { if (aadj < .4999999 || aadj > .5000001) break; } @@ -922,12 +1029,17 @@ Bfree(bs); Bfree(delta); } + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(bd0); + Bfree(delta); #ifdef SET_INEXACT if (inexact) { if (!oldinexact) { - word0(rv0) = Exp_1 + (70 << Exp_shift); - word1(rv0) = 0; - dval(rv0) += 1.; + word0(&rv0) = Exp_1 + (70 << Exp_shift); + word1(&rv0) = 0; + dval(&rv0) += 1.; } } else if (!oldinexact) @@ -935,32 +1047,41 @@ #endif #ifdef Avoid_Underflow if (scale) { - word0(rv0) = Exp_1 - 2*P*Exp_msk1; - word1(rv0) = 0; - dval(rv) *= dval(rv0); + word0(&rv0) = Exp_1 - 2*P*Exp_msk1; + word1(&rv0) = 0; + dval(&rv) *= dval(&rv0); #ifndef NO_ERRNO /* try to avoid the bug of testing an 8087 register value */ - if (word0(rv) == 0 && word1(rv) == 0) +#ifdef IEEE_Arith + if (!(word0(&rv) & Exp_mask)) +#else + if (word0(&rv) == 0 && word1(&rv) == 0) +#endif errno = ERANGE; #endif } #endif /* Avoid_Underflow */ #ifdef SET_INEXACT - if (inexact && !(word0(rv) & Exp_mask)) { + if (inexact && !(word0(&rv) & Exp_mask)) { /* set underflow bit */ - dval(rv0) = 1e-300; - dval(rv0) *= dval(rv0); + dval(&rv0) = 1e-300; + dval(&rv0) *= dval(&rv0); } #endif - retfree: - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(bd0); - Bfree(delta); ret: if (se) *se = (char *)s; - return sign ? -dval(rv) : dval(rv); + return sign ? -dval(&rv) : dval(&rv); } + double +strtod +#ifdef KR_headers + (s00, se, loc) CONST char *s00; char **se; locale_t +#else + (CONST char *s00, char **se) +#endif +{ + return strtod_l(s00, se, __get_locale()); +} + diff --git a/contrib/gdtoa/strtodI.c b/contrib/gdtoa/strtodI.c index 163f363..0b7b8a4 100644 --- a/contrib/gdtoa/strtodI.c +++ b/contrib/gdtoa/strtodI.c @@ -26,29 +26,23 @@ ****************************************************************/ -/* 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" static double #ifdef KR_headers -ulpdown(d) double *d; +ulpdown(d) U *d; #else -ulpdown(double *d) +ulpdown(U *d) #endif { double u; - ULong *L = (ULong*)d; + ULong *L = d->L; - u = ulp(*d); - if (!(L[_1] | L[_0] & 0xfffff) + u = ulp(d); + if (!(L[_1] | (L[_0] & 0xfffff)) && (L[_0] & 0x7ff00000) > 0x00100000) u *= 0.5; return u; @@ -61,18 +55,10 @@ 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; - typedef union { - double d[2]; - ULong L[4]; - } U; U *u; k = strtodg(s, sp, &fpi, &exp, bits); @@ -80,17 +66,17 @@ sign = k & STRTOG_Neg ? 0x80000000L : 0; switch(k & STRTOG_Retmask) { case STRTOG_NoNumber: - u->d[0] = u->d[1] = 0.; + dval(&u[0]) = dval(&u[1]) = 0.; break; case STRTOG_Zero: - u->d[0] = u->d[1] = 0.; + dval(&u[0]) = dval(&u[1]) = 0.; #ifdef Sudden_Underflow if (k & STRTOG_Inexact) { if (sign) - u->L[_0] = 0x80100000L; + word0(&u[0]) = 0x80100000L; else - u->L[2+_0] = 0x100000L; + word0(&u[1]) = 0x100000L; } break; #else @@ -98,80 +84,80 @@ #endif case STRTOG_Denormal: - u->L[_1] = bits[0]; - u->L[_0] = bits[1]; + word1(&u[0]) = bits[0]; + word0(&u[0]) = bits[1]; goto contain; case STRTOG_Normal: - u->L[_1] = bits[0]; - u->L[_0] = (bits[1] & ~0x100000) | ((exp + 0x3ff + 52) << 20); + word1(&u[0]) = bits[0]; + word0(&u[0]) = (bits[1] & ~0x100000) | ((exp + 0x3ff + 52) << 20); contain: j = k & STRTOG_Inexact; if (sign) { - u->L[_0] |= sign; + word0(&u[0]) |= sign; j = STRTOG_Inexact - j; } switch(j) { case STRTOG_Inexlo: #ifdef Sudden_Underflow if ((u->L[_0] & 0x7ff00000) < 0x3500000) { - u->L[2+_0] = u->L[_0] + 0x3500000; - u->L[2+_1] = u->L[_1]; - u->d[1] += ulp(u->d[1]); - u->L[2+_0] -= 0x3500000; - if (!(u->L[2+_0] & 0x7ff00000)) { - u->L[2+_0] = sign; - u->L[2+_1] = 0; + word0(&u[1]) = word0(&u[0]) + 0x3500000; + word1(&u[1]) = word1(&u[0]); + dval(&u[1]) += ulp(&u[1]); + word0(&u[1]) -= 0x3500000; + if (!(word0(&u[1]) & 0x7ff00000)) { + word0(&u[1]) = sign; + word1(&u[1]) = 0; } } else #endif - u->d[1] = u->d[0] + ulp(u->d[0]); + dval(&u[1]) = dval(&u[0]) + ulp(&u[0]); break; case STRTOG_Inexhi: - u->d[1] = u->d[0]; + dval(&u[1]) = dval(&u[0]); #ifdef Sudden_Underflow - if ((u->L[_0] & 0x7ff00000) < 0x3500000) { - u->L[_0] += 0x3500000; - u->d[0] -= ulpdown(u->d); - u->L[_0] -= 0x3500000; - if (!(u->L[_0] & 0x7ff00000)) { - u->L[_0] = sign; - u->L[_1] = 0; + if ((word0(&u[0]) & 0x7ff00000) < 0x3500000) { + word0(&u[0]) += 0x3500000; + dval(&u[0]) -= ulpdown(u); + word0(&u[0]) -= 0x3500000; + if (!(word0(&u[0]) & 0x7ff00000)) { + word0(&u[0]) = sign; + word1(&u[0]) = 0; } } else #endif - u->d[0] -= ulpdown(u->d); + dval(&u[0]) -= ulpdown(u); break; default: - u->d[1] = u->d[0]; + dval(&u[1]) = dval(&u[0]); } break; case STRTOG_Infinite: - u->L[_0] = u->L[2+_0] = sign | 0x7ff00000; - u->L[_1] = u->L[2+_1] = 0; + word0(&u[0]) = word0(&u[1]) = sign | 0x7ff00000; + word1(&u[0]) = word1(&u[1]) = 0; if (k & STRTOG_Inexact) { if (sign) { - u->L[2+_0] = 0xffefffffL; - u->L[2+_1] = 0xffffffffL; + word0(&u[1]) = 0xffefffffL; + word1(&u[1]) = 0xffffffffL; } else { - u->L[_0] = 0x7fefffffL; - u->L[_1] = 0xffffffffL; + word0(&u[0]) = 0x7fefffffL; + word1(&u[0]) = 0xffffffffL; } } 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+1)->L[0] = d_QNAN0; + u->L[1] = (u+1)->L[1] = d_QNAN1; break; case STRTOG_NaNbits: - u->L[_0] = u->L[2+_0] = 0x7ff00000 | sign | bits[1]; - u->L[_1] = u->L[2+_1] = bits[0]; + word0(&u[0]) = word0(&u[1]) = 0x7ff00000 | sign | bits[1]; + word1(&u[0]) = word1(&u[1]) = bits[0]; } return k; } diff --git a/contrib/gdtoa/strtodg.c b/contrib/gdtoa/strtodg.c index bf30e33..37832b4 100644 --- a/contrib/gdtoa/strtodg.c +++ b/contrib/gdtoa/strtodg.c @@ -26,10 +26,8 @@ ****************************************************************/ -/* 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" @@ -91,7 +89,7 @@ return b; } - int + void #ifdef KR_headers decrement(b) Bigint *b; #else @@ -121,7 +119,6 @@ *x++ = y & 0xffff; } while(borrow && x < xe); #endif - return STRTOG_Inexlo; } static int @@ -175,9 +172,9 @@ rvOK #ifdef KR_headers (d, fpi, exp, bits, exact, rd, irv) - double d; FPI *fpi; Long *exp; ULong *bits; int exact, rd, *irv; + U *d; FPI *fpi; Long *exp; ULong *bits; int exact, rd, *irv; #else - (double d, FPI *fpi, Long *exp, ULong *bits, int exact, int rd, int *irv) + (U *d, FPI *fpi, Long *exp, ULong *bits, int exact, int rd, int *irv) #endif { Bigint *b; @@ -185,7 +182,7 @@ int bdif, e, j, k, k1, nb, rv; carry = rv = 0; - b = d2b(d, &e, &bdif); + b = d2b(dval(d), &e, &bdif); bdif -= nb = fpi->nbits; e += bdif; if (bdif <= 0) { @@ -208,9 +205,9 @@ goto ret; } switch(rd) { - case 1: + case 1: /* round down (toward -Infinity) */ goto trunc; - case 2: + case 2: /* round up (toward +Infinity) */ break; default: /* round near */ k = bdif - 1; @@ -239,7 +236,7 @@ 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; @@ -294,9 +291,9 @@ static int #ifdef KR_headers -mantbits(d) double d; +mantbits(d) U *d; #else -mantbits(double d) +mantbits(U *d) #endif { ULong L; @@ -316,28 +313,50 @@ } int -strtodg +strtodg_l #ifdef KR_headers - (s00, se, fpi, exp, bits) - CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; + (s00, se, fpi, exp, bits, loc) + CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc; #else - (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits) + (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc) #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; - double adj, adj0, rv, tol; + double adj0, tol; Long L; - ULong y, z; + U adj, rv; + ULong *b, *be, y, z; Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0; +#ifdef USE_LOCALE /*{{*/ +#ifdef NO_LOCALE_CACHE + char *decimalpoint = localeconv_l(loc)->decimal_point; + int dplen = strlen(decimalpoint); +#else + char *decimalpoint; + static char *decimalpoint_cache; + static int dplen; + if (!(s0 = decimalpoint_cache)) { + s0 = localeconv_l(loc)->decimal_point; + if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { + strcpy(decimalpoint_cache, s0); + s0 = decimalpoint_cache; + } + dplen = strlen(s0); + } + decimalpoint = (char*)s0; +#endif /*NO_LOCALE_CACHE*/ +#else /*USE_LOCALE}{*/ +#define dplen 1 +#endif /*USE_LOCALE}}*/ irv = STRTOG_Zero; denorm = sign = nz0 = nz = 0; - dval(rv) = 0.; + dval(&rv) = 0.; rvb = 0; nbits = fpi->nbits; for(s = s00;;s++) switch(*s) { @@ -385,19 +404,24 @@ 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) z = 10*z + c - '0'; nd0 = nd; #ifdef USE_LOCALE - if (c == *localeconv()->decimal_point) + if (c == *decimalpoint) { + for(i = 1; decimalpoint[i]; ++i) + if (s[i] != decimalpoint[i]) + goto dig_done; + s += i; + c = *s; #else - if (c == '.') -#endif - { + if (c == '.') { c = *++s; +#endif + decpt = 1; if (!nd) { for(; c == '0'; c = *++s) nz++; @@ -426,7 +450,7 @@ nz = 0; } } - } + }/*}*/ dig_done: e = 0; if (c == 'e' || c == 'E') { @@ -471,7 +495,8 @@ 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")) { @@ -523,13 +548,13 @@ if (!nd0) nd0 = nd; k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; - dval(rv) = y; + dval(&rv) = y; if (k > 9) - dval(rv) = tens[k - 9] * dval(rv) + z; + dval(&rv) = tens[k - 9] * dval(&rv) + z; bd0 = 0; if (nbits <= P && nd <= DBL_DIG) { if (!e) { - if (rvOK(dval(rv), fpi, exp, bits, 1, rd, &irv)) + if (rvOK(&rv, fpi, exp, bits, 1, rd, &irv)) goto ret; } else if (e > 0) { @@ -537,9 +562,9 @@ #ifdef VAX goto vax_ovfl_check; #else - i = fivesbits[e] + mantbits(dval(rv)) <= P; - /* rv = */ rounded_product(dval(rv), tens[e]); - if (rvOK(dval(rv), fpi, exp, bits, i, rd, &irv)) + i = fivesbits[e] + mantbits(&rv) <= P; + /* rv = */ rounded_product(dval(&rv), tens[e]); + if (rvOK(&rv, fpi, exp, bits, i, rd, &irv)) goto ret; e1 -= e; goto rv_notOK; @@ -552,32 +577,32 @@ */ e2 = e - i; e1 -= i; - dval(rv) *= tens[i]; + dval(&rv) *= tens[i]; #ifdef VAX /* VAX exponent range is so narrow we must * worry about overflow here... */ vax_ovfl_check: - dval(adj) = dval(rv); - word0(adj) -= P*Exp_msk1; - /* adj = */ rounded_product(dval(adj), tens[e2]); - if ((word0(adj) & Exp_mask) + dval(&adj) = dval(&rv); + word0(&adj) -= P*Exp_msk1; + /* adj = */ rounded_product(dval(&adj), tens[e2]); + if ((word0(&adj) & Exp_mask) > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) goto rv_notOK; - word0(adj) += P*Exp_msk1; - dval(rv) = dval(adj); + word0(&adj) += P*Exp_msk1; + dval(&rv) = dval(&adj); #else - /* rv = */ rounded_product(dval(rv), tens[e2]); + /* rv = */ rounded_product(dval(&rv), tens[e2]); #endif - if (rvOK(dval(rv), fpi, exp, bits, 0, rd, &irv)) + if (rvOK(&rv, fpi, exp, bits, 0, rd, &irv)) goto ret; e1 -= e2; } } #ifndef Inaccurate_Divide else if (e >= -Ten_pmax) { - /* rv = */ rounded_quotient(dval(rv), tens[-e]); - if (rvOK(dval(rv), fpi, exp, bits, 0, rd, &irv)) + /* rv = */ rounded_quotient(dval(&rv), tens[-e]); + if (rvOK(&rv, fpi, exp, bits, 0, rd, &irv)) goto ret; e1 -= e; } @@ -591,49 +616,56 @@ e2 = 0; if (e1 > 0) { if ( (i = e1 & 15) !=0) - dval(rv) *= tens[i]; + dval(&rv) *= tens[i]; if (e1 &= ~15) { e1 >>= 4; - while(e1 >= (1 << n_bigtens-1)) { - e2 += ((word0(rv) & Exp_mask) + while(e1 >= (1 << (n_bigtens-1))) { + e2 += ((word0(&rv) & Exp_mask) >> Exp_shift1) - Bias; - word0(rv) &= ~Exp_mask; - word0(rv) |= Bias << Exp_shift1; - dval(rv) *= bigtens[n_bigtens-1]; - e1 -= 1 << n_bigtens-1; + word0(&rv) &= ~Exp_mask; + word0(&rv) |= Bias << Exp_shift1; + dval(&rv) *= bigtens[n_bigtens-1]; + e1 -= 1 << (n_bigtens-1); } - e2 += ((word0(rv) & Exp_mask) >> Exp_shift1) - Bias; - word0(rv) &= ~Exp_mask; - word0(rv) |= Bias << Exp_shift1; + e2 += ((word0(&rv) & Exp_mask) >> Exp_shift1) - Bias; + word0(&rv) &= ~Exp_mask; + word0(&rv) |= Bias << Exp_shift1; for(j = 0; e1 > 0; j++, e1 >>= 1) if (e1 & 1) - dval(rv) *= bigtens[j]; + dval(&rv) *= bigtens[j]; } } else if (e1 < 0) { e1 = -e1; if ( (i = e1 & 15) !=0) - dval(rv) /= tens[i]; + dval(&rv) /= tens[i]; if (e1 &= ~15) { e1 >>= 4; - while(e1 >= (1 << n_bigtens-1)) { - e2 += ((word0(rv) & Exp_mask) + while(e1 >= (1 << (n_bigtens-1))) { + e2 += ((word0(&rv) & Exp_mask) >> Exp_shift1) - Bias; - word0(rv) &= ~Exp_mask; - word0(rv) |= Bias << Exp_shift1; - dval(rv) *= tinytens[n_bigtens-1]; - e1 -= 1 << n_bigtens-1; + word0(&rv) &= ~Exp_mask; + word0(&rv) |= Bias << Exp_shift1; + dval(&rv) *= tinytens[n_bigtens-1]; + e1 -= 1 << (n_bigtens-1); } - e2 += ((word0(rv) & Exp_mask) >> Exp_shift1) - Bias; - word0(rv) &= ~Exp_mask; - word0(rv) |= Bias << Exp_shift1; + e2 += ((word0(&rv) & Exp_mask) >> Exp_shift1) - Bias; + word0(&rv) &= ~Exp_mask; + word0(&rv) |= Bias << Exp_shift1; for(j = 0; e1 > 0; j++, e1 >>= 1) if (e1 & 1) - dval(rv) *= tinytens[j]; + dval(&rv) *= tinytens[j]; } } - - rvb = d2b(dval(rv), &rve, &rvbits); /* rv = rvb * 2^rve */ +#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) { rshift(rvb, j); @@ -642,16 +674,8 @@ } 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; @@ -685,7 +709,7 @@ /* Put digits into bd: true value = bd * 10^e */ - bd0 = s2b(s0, nd0, nd, y); + bd0 = s2b(s0, nd0, nd, y, dplen); for(;;) { bd = Balloc(bd0->k); @@ -819,14 +843,12 @@ } else irv = STRTOG_Normal | STRTOG_Inexhi; - if (bbbits < nbits && !denorm || !(rvb->x[0] & 1)) + if ((bbbits < nbits && !denorm) || !(rvb->x[0] & 1)) break; if (dsign) { rvb = increment(rvb); - if ( (j = rvbits >> kshift) !=0) - j = 32 - j; - if (hi0bits(rvb->x[(rvb->wds - 1) >> kshift]) - != j) + j = kmask & (ULbits - (rvbits & kmask)); + if (hi0bits(rvb->x[rvb->wds - 1]) != j) rvbits++; irv = STRTOG_Normal | STRTOG_Inexhi; } @@ -838,7 +860,7 @@ } break; } - if ((dval(adj) = ratio(delta, bs)) <= 2.) { + if ((dval(&adj) = ratio(delta, bs)) <= 2.) { adj1: inex = STRTOG_Inexlo; if (dsign) { @@ -852,15 +874,15 @@ irv = STRTOG_Underflow | STRTOG_Inexlo; break; } - adj0 = dval(adj) = 1.; + adj0 = dval(&adj) = 1.; } else { - adj0 = dval(adj) *= 0.5; + adj0 = dval(&adj) *= 0.5; if (dsign) { asub = 0; inex = STRTOG_Inexlo; } - if (dval(adj) < 2147483647.) { + if (dval(&adj) < 2147483647.) { L = adj0; adj0 -= L; switch(rd) { @@ -879,12 +901,12 @@ inex = STRTOG_Inexact - inex; } } - dval(adj) = L; + dval(&adj) = L; } } y = rve + rvbits; - /* adj *= ulp(dval(rv)); */ + /* adj *= ulp(dval(&rv)); */ /* if (asub) rv -= adj; else rv += adj; */ if (!denorm && rvbits < nbits) { @@ -892,7 +914,7 @@ rve -= j; rvbits = nbits; } - ab = d2b(dval(adj), &abe, &abits); + ab = d2b(dval(&adj), &abe, &abits); if (abe < 0) rshift(ab, -abe); else if (abe > 0) @@ -946,15 +968,15 @@ z = rve + rvbits; if (y == z && L) { /* Can we stop now? */ - tol = dval(adj) * 5e-16; /* > max rel error */ - dval(adj) = adj0 - .5; - if (dval(adj) < -tol) { + tol = dval(&adj) * 5e-16; /* > max rel error */ + dval(&adj) = adj0 - .5; + if (dval(&adj) < -tol) { if (adj0 > tol) { irv |= inex; break; } } - else if (dval(adj) > tol && adj0 < 1. - tol) { + else if (dval(&adj) > tol && adj0 < 1. - tol) { irv |= inex; break; } @@ -965,9 +987,11 @@ 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,17 +1000,57 @@ Bfree(bs); Bfree(bd0); Bfree(delta); + if (rve > fpi->emax) { + switch(fpi->rounding & 3) { + case FPI_Round_near: + goto huge; + case FPI_Round_up: + if (!sign) + goto huge; + break; + case FPI_Round_down: + if (sign) + goto huge; + } + /* Round to largest representable magnitude */ + Bfree(rvb); + rvb = 0; + irv = STRTOG_Normal | STRTOG_Inexlo; + *exp = fpi->emax; + b = bits; + be = b + ((fpi->nbits + 31) >> 5); + while(b < be) + *b++ = -1; + if ((j = fpi->nbits & 0x1f)) + *--be >>= (32 - j); + goto ret; + 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) { rvb->wds = 0; irv = STRTOG_Underflow | STRTOG_Inexlo; +#ifndef NO_ERRNO + errno = ERANGE; +#endif } else { irv = (irv & ~STRTOG_Retmask) | (rvb->wds > 0 ? STRTOG_Denormal : STRTOG_Zero); - if (irv & STRTOG_Inexact) + if (irv & STRTOG_Inexact) { irv |= STRTOG_Underflow; +#ifndef NO_ERRNO + errno = ERANGE; +#endif + } } } if (se) diff --git a/contrib/gdtoa/strtof.c b/contrib/gdtoa/strtof.c index bb283ae..8854616 100644 --- a/contrib/gdtoa/strtof.c +++ b/contrib/gdtoa/strtof.c @@ -26,35 +26,32 @@ ****************************************************************/ -/* 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 "."). */ + +/* $FreeBSD: releng/11.1/contrib/gdtoa/strtof.c 227753 2011-11-20 14:45:42Z theraven $ */ #include "gdtoaimp.h" float #ifdef KR_headers -strtof(s, sp) CONST char *s; char **sp; +strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc; #else -strtof(CONST char *s, char **sp) +strtof_l(CONST char *s, char **sp, locale_t loc) #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 fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; ULong bits[1]; Long exp; int k; union { ULong L[1]; float f; } u; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - k = strtodg(s, sp, &fpi, &exp, bits); + k = strtodg_l(s, sp, fpi, &exp, bits, loc); switch(k & STRTOG_Retmask) { case STRTOG_NoNumber: case STRTOG_Zero: @@ -62,10 +59,14 @@ break; case STRTOG_Normal: - case STRTOG_NaNbits: - u.L[0] = bits[0] & 0x7fffff | exp + 0x7f + 23 << 23; + u.L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23); break; + case STRTOG_NaNbits: + /* FreeBSD local: always return a quiet NaN */ + u.L[0] = bits[0] | 0x7fc00000; + break; + case STRTOG_Denormal: u.L[0] = bits[0]; break; @@ -75,9 +76,19 @@ break; case STRTOG_NaN: - u.L[0] = 0x7fffffff; + u.L[0] = f_QNAN; } if (k & STRTOG_Neg) u.L[0] |= 0x80000000L; return u.f; } + float +#ifdef KR_headers +strtof(s, sp) CONST char *s; char **sp; +#else +strtof(CONST char *s, char **sp) +#endif +{ + return strtof_l(s, sp, __get_locale()); +} + diff --git a/contrib/gdtoa/strtopQ.c b/contrib/gdtoa/strtopQ.c index 4bcc581..77f3190 100644 --- a/contrib/gdtoa/strtopQ.c +++ b/contrib/gdtoa/strtopQ.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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,17 +56,18 @@ 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 fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, SI }; ULong bits[4]; Long exp; int k; ULong *L = (ULong*)V; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - k = strtodg(s, sp, &fpi, &exp, bits); + k = strtodg(s, sp, fpi, &exp, bits); switch(k & STRTOG_Retmask) { case STRTOG_NoNumber: case STRTOG_Zero: @@ -100,8 +95,10 @@ 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 54e0838..0fb35da 100644 --- a/contrib/gdtoa/strtopd.c +++ b/contrib/gdtoa/strtopd.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -48,8 +42,13 @@ ULong bits[2]; Long exp; int k; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - k = strtodg(s, sp, &fpi0, &exp, bits); + k = strtodg(s, sp, fpi, &exp, bits); ULtod((ULong*)d, bits, exp, k); return k; } diff --git a/contrib/gdtoa/strtopdd.c b/contrib/gdtoa/strtopdd.c index f71bced..738372d 100644 --- a/contrib/gdtoa/strtopdd.c +++ b/contrib/gdtoa/strtopdd.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -45,9 +39,9 @@ #endif { #ifdef Sudden_Underflow - static FPI fpi = { 106, 1-1023, 2046-1023-106+1, 1, 1 }; + static FPI fpi0 = { 106, 1-1023, 2046-1023-106+1, 1, 1 }; #else - static FPI fpi = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 }; + static FPI fpi0 = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 }; #endif ULong bits[4]; Long exp; @@ -57,8 +51,13 @@ ULong L[4]; } U; U *u; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - rv = strtodg(s, sp, &fpi, &exp, bits); + rv = strtodg(s, sp, fpi, &exp, bits); u = (U*)dd; switch(rv & STRTOG_Retmask) { case STRTOG_NoNumber: @@ -68,8 +67,8 @@ case STRTOG_Normal: u->L[_1] = (bits[1] >> 21 | bits[2] << 11) & 0xffffffffL; - u->L[_0] = bits[2] >> 21 | bits[3] << 11 & 0xfffff - | exp + 0x3ff + 105 << 20; + u->L[_0] = (bits[2] >> 21) | ((bits[3] << 11) & 0xfffff) + | ((exp + 0x3ff + 105) << 20); exp += 0x3ff + 52; if (bits[1] &= 0x1fffff) { i = hi0bits(bits[1]) - 11; @@ -80,7 +79,7 @@ else exp -= i; if (i > 0) { - bits[1] = bits[1] << i | bits[0] >> 32-i; + bits[1] = bits[1] << i | bits[0] >> (32-i); bits[0] = bits[0] << i & 0xffffffffL; } } @@ -93,11 +92,11 @@ else exp -= i; if (i < 32) { - bits[1] = bits[0] >> 32 - i; + bits[1] = bits[0] >> (32 - i); bits[0] = bits[0] << i & 0xffffffffL; } else { - bits[1] = bits[0] << i - 32; + bits[1] = bits[0] << (i - 32); bits[0] = 0; } } @@ -106,7 +105,7 @@ break; } u->L[2+_1] = bits[0]; - u->L[2+_0] = bits[1] & 0xfffff | exp << 20; + u->L[2+_0] = (bits[1] & 0xfffff) | (exp << 20); break; case STRTOG_Denormal: @@ -125,10 +124,10 @@ nearly_normal: i = hi0bits(bits[3]) - 11; /* i >= 12 */ j = 32 - i; - u->L[_0] = (bits[3] << i | bits[2] >> j) & 0xfffff - | 65 - i << 20; + u->L[_0] = ((bits[3] << i | bits[2] >> j) & 0xfffff) + | ((65 - i) << 20); u->L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL; - u->L[2+_0] = bits[1] & (1L << j) - 1; + u->L[2+_0] = bits[1] & ((1L << j) - 1); u->L[2+_1] = bits[0]; break; @@ -137,34 +136,34 @@ if (i < 0) { j = -i; i += 32; - u->L[_0] = bits[2] >> j & 0xfffff | (33 + j) << 20; - u->L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL; - u->L[2+_0] = bits[1] & (1L << j) - 1; + u->L[_0] = (bits[2] >> j & 0xfffff) | (33 + j) << 20; + u->L[_1] = ((bits[2] << i) | (bits[1] >> j)) & 0xffffffffL; + u->L[2+_0] = bits[1] & ((1L << j) - 1); u->L[2+_1] = bits[0]; break; } if (i == 0) { - u->L[_0] = bits[2] & 0xfffff | 33 << 20; + u->L[_0] = (bits[2] & 0xfffff) | (33 << 20); u->L[_1] = bits[1]; u->L[2+_0] = 0; u->L[2+_1] = bits[0]; break; } j = 32 - i; - u->L[_0] = (bits[2] << i | bits[1] >> j) & 0xfffff - | j + 1 << 20; + u->L[_0] = (((bits[2] << i) | (bits[1] >> j)) & 0xfffff) + | ((j + 1) << 20); u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL; u->L[2+_0] = 0; - u->L[2+_1] = bits[0] & (1L << j) - 1; + u->L[2+_1] = bits[0] & ((1L << j) - 1); break; hardly_normal: j = 11 - hi0bits(bits[1]); i = 32 - j; - u->L[_0] = bits[1] >> j & 0xfffff | j + 1 << 20; + u->L[_0] = (bits[1] >> j & 0xfffff) | ((j + 1) << 20); u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL; u->L[2+_0] = 0; - u->L[2+_1] = bits[0] & (1L << j) - 1; + u->L[2+_1] = bits[0] & ((1L << j) - 1); break; case STRTOG_Infinite: @@ -173,8 +172,8 @@ 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 c49fc96..23ca5cb 100644 --- a/contrib/gdtoa/strtopf.c +++ b/contrib/gdtoa/strtopf.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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,16 +38,17 @@ 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 fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; ULong bits[1], *L; Long exp; int k; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - k = strtodg(s, sp, &fpi, &exp, bits); + k = strtodg(s, sp, fpi, &exp, bits); L = (ULong*)f; switch(k & STRTOG_Retmask) { case STRTOG_NoNumber: @@ -63,7 +58,7 @@ case STRTOG_Normal: case STRTOG_NaNbits: - L[0] = bits[0] & 0x7fffff | exp + 0x7f + 23 << 23; + L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23); break; case STRTOG_Denormal: @@ -75,7 +70,7 @@ 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 190b80f..f7a25ff 100644 --- a/contrib/gdtoa/strtopx.c +++ b/contrib/gdtoa/strtopx.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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,41 +58,50 @@ 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 fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; ULong bits[2]; Long exp; int k; UShort *L = (UShort*)V; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - k = strtodg(s, sp, &fpi, &exp, bits); + k = strtodg(s, sp, fpi, &exp, bits); switch(k & STRTOG_Retmask) { case STRTOG_NoNumber: case STRTOG_Zero: 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: L[_0] = 0x7fff; - L[_1] = L[_2] = L[_3] = L[_4] = 0; + L[_1] = 0x8000; + L[_2] = L[_3] = L[_4] = 0; 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 95fd3d5..6519a41 100644 --- a/contrib/gdtoa/strtopxL.c +++ b/contrib/gdtoa/strtopxL.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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,17 +54,18 @@ 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 fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; ULong bits[2]; Long exp; int k; ULong *L = (ULong*)V; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif - k = strtodg(s, sp, &fpi, &exp, bits); + k = strtodg(s, sp, fpi, &exp, bits); switch(k & STRTOG_Retmask) { case STRTOG_NoNumber: case STRTOG_Zero: @@ -87,12 +82,14 @@ case STRTOG_Infinite: L[_0] = 0x7fff << 16; - L[_1] = L[_2] = 0; + L[_1] = 0x80000000; + L[_2] = 0; 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 63a7b6a..7ef3302 100644 --- a/contrib/gdtoa/strtorQ.c +++ b/contrib/gdtoa/strtorQ.c @@ -26,14 +26,10 @@ ****************************************************************/ -/* 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 "."). */ + +/* $FreeBSD: releng/11.1/contrib/gdtoa/strtorQ.c 227753 2011-11-20 14:45:42Z theraven $ */ #include "gdtoaimp.h" @@ -69,13 +65,20 @@ break; case STRTOG_Normal: - case STRTOG_NaNbits: L[_3] = bits[0]; L[_2] = bits[1]; L[_1] = bits[2]; L[_0] = (bits[3] & ~0x10000) | ((exp + 0x3fff + 112) << 16); break; + case STRTOG_NaNbits: + L[_3] = bits[0]; + L[_2] = bits[1]; + L[_1] = bits[2]; + L[_0] = (bits[3] & ~0x10000) + | (((exp + 0x3fff + 112) << 16) | (1 << 15)); + break; + case STRTOG_Denormal: L[_3] = bits[0]; L[_2] = bits[1]; @@ -89,8 +92,10 @@ 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; @@ -98,9 +103,10 @@ int #ifdef KR_headers -strtorQ(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L; +strtorQ_l(s, sp, rounding, L, locale) CONST char *s; char **sp; int rounding; +void *L; locale_t locale; #else -strtorQ(CONST char *s, char **sp, int rounding, void *L) +strtorQ_l(CONST char *s, char **sp, int rounding, void *L, locale_t locale) #endif { static FPI fpi0 = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI }; @@ -115,7 +121,7 @@ fpi1.rounding = rounding; fpi = &fpi1; } - k = strtodg(s, sp, fpi, &exp, bits); + k = strtodg_l(s, sp, fpi, &exp, bits, locale); ULtoQ((ULong*)L, bits, exp, k); return k; } diff --git a/contrib/gdtoa/strtord.c b/contrib/gdtoa/strtord.c index 12213f9..490f3e1 100644 --- a/contrib/gdtoa/strtord.c +++ b/contrib/gdtoa/strtord.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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 @@ 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; @@ -76,9 +70,10 @@ int #ifdef KR_headers -strtord(s, sp, rounding, d) CONST char *s; char **sp; int rounding; double *d; +strtord_l(s, sp, rounding, d, locale) CONST char *s; char **sp; int rounding; +double *d; locale_t locale; #else -strtord(CONST char *s, char **sp, int rounding, double *d) +strtord_l(CONST char *s, char **sp, int rounding, double *d, locale_t locale) #endif { static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; @@ -93,7 +88,8 @@ fpi1.rounding = rounding; fpi = &fpi1; } - k = strtodg(s, sp, fpi, &exp, bits); + k = strtodg_l(s, sp, fpi, &exp, bits, locale); ULtod((ULong*)d, bits, exp, k); return k; } + diff --git a/contrib/gdtoa/strtordd.c b/contrib/gdtoa/strtordd.c index 626a4d3..e0b8e6a 100644 --- a/contrib/gdtoa/strtordd.c +++ b/contrib/gdtoa/strtordd.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -54,8 +48,8 @@ case STRTOG_Normal: L[_1] = (bits[1] >> 21 | bits[2] << 11) & (ULong)0xffffffffL; - L[_0] = bits[2] >> 21 | bits[3] << 11 & 0xfffff - | exp + 0x3ff + 105 << 20; + L[_0] = (bits[2] >> 21) | (bits[3] << 11 & 0xfffff) + | ((exp + 0x3ff + 105) << 20); exp += 0x3ff + 52; if (bits[1] &= 0x1fffff) { i = hi0bits(bits[1]) - 11; @@ -66,7 +60,7 @@ else exp -= i; if (i > 0) { - bits[1] = bits[1] << i | bits[0] >> 32-i; + bits[1] = bits[1] << i | bits[0] >> (32-i); bits[0] = bits[0] << i & (ULong)0xffffffffL; } } @@ -79,11 +73,11 @@ else exp -= i; if (i < 32) { - bits[1] = bits[0] >> 32 - i; + bits[1] = bits[0] >> (32 - i); bits[0] = bits[0] << i & (ULong)0xffffffffL; } else { - bits[1] = bits[0] << i - 32; + bits[1] = bits[0] << (i - 32); bits[0] = 0; } } @@ -92,7 +86,7 @@ break; } L[2+_1] = bits[0]; - L[2+_0] = bits[1] & 0xfffff | exp << 20; + L[2+_0] = (bits[1] & 0xfffff) | (exp << 20); break; case STRTOG_Denormal: @@ -111,10 +105,10 @@ nearly_normal: i = hi0bits(bits[3]) - 11; /* i >= 12 */ j = 32 - i; - L[_0] = (bits[3] << i | bits[2] >> j) & 0xfffff - | 65 - i << 20; + L[_0] = ((bits[3] << i | bits[2] >> j) & 0xfffff) + | ((65 - i) << 20); L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL; - L[2+_0] = bits[1] & ((ULong)1L << j) - 1; + L[2+_0] = bits[1] & (((ULong)1L << j) - 1); L[2+_1] = bits[0]; break; @@ -123,34 +117,34 @@ if (i < 0) { j = -i; i += 32; - L[_0] = bits[2] >> j & 0xfffff | (33 + j) << 20; + L[_0] = (bits[2] >> j & 0xfffff) | ((33 + j) << 20); L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL; - L[2+_0] = bits[1] & ((ULong)1L << j) - 1; + L[2+_0] = bits[1] & (((ULong)1L << j) - 1); L[2+_1] = bits[0]; break; } if (i == 0) { - L[_0] = bits[2] & 0xfffff | 33 << 20; + L[_0] = (bits[2] & 0xfffff) | (33 << 20); L[_1] = bits[1]; L[2+_0] = 0; L[2+_1] = bits[0]; break; } j = 32 - i; - L[_0] = (bits[2] << i | bits[1] >> j) & 0xfffff - | j + 1 << 20; + L[_0] = (((bits[2] << i) | (bits[1] >> j)) & 0xfffff) + | ((j + 1) << 20); L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL; L[2+_0] = 0; - L[2+_1] = bits[0] & (1L << j) - 1; + L[2+_1] = bits[0] & ((1L << j) - 1); break; hardly_normal: j = 11 - hi0bits(bits[1]); i = 32 - j; - L[_0] = bits[1] >> j & 0xfffff | j + 1 << 20; + L[_0] = (bits[1] >> j & 0xfffff) | ((j + 1) << 20); L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL; L[2+_0] = 0; - L[2+_1] = bits[0] & ((ULong)1L << j) - 1; + L[2+_1] = bits[0] & (((ULong)1L << j) - 1); break; case STRTOG_Infinite: @@ -159,8 +153,8 @@ 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 ecd1c0b..21c6d28 100644 --- a/contrib/gdtoa/strtorf.c +++ b/contrib/gdtoa/strtorf.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -52,7 +46,7 @@ case STRTOG_Normal: case STRTOG_NaNbits: - L[0] = bits[0] & 0x7fffff | exp + 0x7f + 23 << 23; + L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23); break; case STRTOG_Denormal: @@ -64,7 +58,7 @@ 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 0a81e95..8dca309 100644 --- a/contrib/gdtoa/strtorx.c +++ b/contrib/gdtoa/strtorx.c @@ -26,14 +26,10 @@ ****************************************************************/ -/* 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 "."). */ + +/* $FreeBSD: releng/11.1/contrib/gdtoa/strtorx.c 227753 2011-11-20 14:45:42Z theraven $ */ #include "gdtoaimp.h" @@ -70,24 +66,39 @@ L[0] = L[1] = L[2] = L[3] = L[4] = 0; break; - case STRTOG_Normal: case STRTOG_Denormal: - case STRTOG_NaNbits: + L[_0] = 0; + goto normal_bits; + + case STRTOG_Normal: + 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); + break; + + case STRTOG_NaNbits: L[_0] = exp + 0x3fff + 63; + L[_4] = (UShort)bits[0]; + L[_3] = (UShort)(bits[0] >> 16); + L[_2] = (UShort)bits[1]; + L[_1] = (UShort)((bits[1] >> 16) | (3 << 14)); break; case STRTOG_Infinite: L[_0] = 0x7fff; - L[_1] = L[_2] = L[_3] = L[_4] = 0; + L[_1] = 0x8000; + L[_2] = L[_3] = L[_4] = 0; 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; @@ -95,9 +106,10 @@ int #ifdef KR_headers -strtorx(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L; +strtorx_l(s, sp, rounding, L, locale) CONST char *s; char **sp; int rounding; +void *L; locale_t locale; #else -strtorx(CONST char *s, char **sp, int rounding, void *L) +strtorx_l(CONST char *s, char **sp, int rounding, void *L, locale_t locale) #endif { static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; @@ -112,7 +124,7 @@ fpi1.rounding = rounding; fpi = &fpi1; } - k = strtodg(s, sp, fpi, &exp, bits); + k = strtodg_l(s, sp, fpi, &exp, bits, locale); ULtox((UShort*)L, bits, exp, k); return k; } diff --git a/contrib/gdtoa/strtorxL.c b/contrib/gdtoa/strtorxL.c index 126cef8..58acc80 100644 --- a/contrib/gdtoa/strtorxL.c +++ b/contrib/gdtoa/strtorxL.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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" @@ -76,12 +70,14 @@ case STRTOG_Infinite: L[_0] = 0x7fff << 16; - L[_1] = L[_2] = 0; + L[_1] = 0x80000000; + L[_2] = 0; 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 1e1a4de..dc0c88b 100644 --- a/contrib/gdtoa/sum.c +++ b/contrib/gdtoa/sum.c @@ -26,14 +26,8 @@ ****************************************************************/ -/* 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/Q.ou0 b/contrib/gdtoa/test/Q.ou0 deleted file mode 100644 index 66c7e9b..0000000 --- a/contrib/gdtoa/test/Q.ou0 +++ /dev/null @@ -1,1180 +0,0 @@ - -Input: 1.23 - -strtoQ consumes 4 bytes and returns 17 -with bits = #3fff3ae1 47ae147a e147ae14 7ae147ae -g_Qfmt(0) gives 4 bytes: "1.23" - -strtoIQ returns 17, consuming 4 bytes. -fI[0] = #3fff3ae1 47ae147a e147ae14 7ae147ae -fI[1] = #3fff3ae1 47ae147a e147ae14 7ae147af -fI[0] == strtod - - -Input: 1.23e+20 - -strtoQ consumes 8 bytes and returns 1 -with bits = #4041aabd f2145b43 0 0 -g_Qfmt(0) gives 8 bytes: "1.23e+20" - -strtoIQ returns 1, consuming 8 bytes. -fI[0] == fI[1] = #4041aabd f2145b43 0 0 - - -Input: 1.23e-20 - -strtoQ consumes 8 bytes and returns 17 -with bits = #3fbcd0ae 4cf76753 9e4cbca ad934841 -g_Qfmt(0) gives 8 bytes: "1.23e-20" - -strtoIQ returns 17, consuming 8 bytes. -fI[0] = #3fbcd0ae 4cf76753 9e4cbca ad934841 -fI[1] = #3fbcd0ae 4cf76753 9e4cbca ad934842 -fI[0] == strtod - - -Input: 1.23456789 - -strtoQ consumes 10 bytes and returns 17 -with bits = #3fff3c0c a4283de1 b7eb6945 1304948f -g_Qfmt(0) gives 10 bytes: "1.23456789" - -strtoIQ returns 17, consuming 10 bytes. -fI[0] = #3fff3c0c a4283de1 b7eb6945 1304948f -fI[1] = #3fff3c0c a4283de1 b7eb6945 13049490 -fI[0] == strtod - - -Input: 1.23456589e+20 - -strtoQ consumes 14 bytes and returns 1 -with bits = #4041ac53 7a660b99 74000000 0 -g_Qfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoIQ returns 1, consuming 14 bytes. -fI[0] == fI[1] = #4041ac53 7a660b99 74000000 0 - - -Input: 1.23e+30 - -strtoQ consumes 8 bytes and returns 1 -with bits = #4062f0cb 4e8fb79 4945600 0 -g_Qfmt(0) gives 8 bytes: "1.23e+30" - -strtoIQ returns 1, consuming 8 bytes. -fI[0] == fI[1] = #4062f0cb 4e8fb79 4945600 0 - - -Input: 1.23e-30 - -strtoQ consumes 8 bytes and returns 17 -with bits = #3f9b8f28 66f5010a a9d63f9e d7e8ba14 -g_Qfmt(0) gives 8 bytes: "1.23e-30" - -strtoIQ returns 17, consuming 8 bytes. -fI[0] = #3f9b8f28 66f5010a a9d63f9e d7e8ba14 -fI[1] = #3f9b8f28 66f5010a a9d63f9e d7e8ba15 -fI[0] == strtod - - -Input: 1.23456789e-20 - -strtoQ consumes 14 bytes and returns 33 -with bits = #3fbcd268 1471e7ad a6a4a029 d86c1fa2 -g_Qfmt(0) gives 14 bytes: "1.23456789e-20" - -strtoIQ returns 33, consuming 14 bytes. -fI[0] = #3fbcd268 1471e7ad a6a4a029 d86c1fa1 -fI[1] = #3fbcd268 1471e7ad a6a4a029 d86c1fa2 -fI[1] == strtod - - -Input: 1.23456789e-30 - -strtoQ consumes 14 bytes and returns 17 -with bits = #3f9b90a3 e33bbd99 51f85855 5a6b19d4 -g_Qfmt(0) gives 14 bytes: "1.23456789e-30" - -strtoIQ returns 17, consuming 14 bytes. -fI[0] = #3f9b90a3 e33bbd99 51f85855 5a6b19d4 -fI[1] = #3f9b90a3 e33bbd99 51f85855 5a6b19d5 -fI[0] == strtod - - -Input: 1.234567890123456789 - -strtoQ consumes 20 bytes and returns 17 -with bits = #3fff3c0c a428c59f b71a4194 68dd175b -g_Qfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIQ returns 17, consuming 20 bytes. -fI[0] = #3fff3c0c a428c59f b71a4194 68dd175b -fI[1] = #3fff3c0c a428c59f b71a4194 68dd175c -fI[0] == strtod - - -Input: 1.23456789012345678901234567890123456789 - -strtoQ consumes 40 bytes and returns 17 -with bits = #3fff3c0c a428c59f b71a7be1 6b6b6d5b -g_Qfmt(0) gives 36 bytes: "1.2345678901234567890123456789012346" - -strtoIQ returns 17, consuming 40 bytes. -fI[0] = #3fff3c0c a428c59f b71a7be1 6b6b6d5b -fI[1] = #3fff3c0c a428c59f b71a7be1 6b6b6d5c -fI[0] == strtod - - -Input: 1.23e306 - -strtoQ consumes 8 bytes and returns 33 -with bits = #43f7c067 6cd1c61f 4daac5f1 e9fa3b55 -g_Qfmt(0) gives 9 bytes: "1.23e+306" - -strtoIQ returns 33, consuming 8 bytes. -fI[0] = #43f7c067 6cd1c61f 4daac5f1 e9fa3b54 -fI[1] = #43f7c067 6cd1c61f 4daac5f1 e9fa3b55 -fI[1] == strtod - - -Input: 1.23e-306 - -strtoQ consumes 9 bytes and returns 17 -with bits = #3c06ba3b 85da396e 7e496ab7 d233c3dd -g_Qfmt(0) gives 9 bytes: "1.23e-306" - -strtoIQ returns 17, consuming 9 bytes. -fI[0] = #3c06ba3b 85da396e 7e496ab7 d233c3dd -fI[1] = #3c06ba3b 85da396e 7e496ab7 d233c3de -fI[0] == strtod - - -Input: 1.23e-320 - -strtoQ consumes 9 bytes and returns 33 -with bits = #3bd83731 86e30898 7e33b2e8 355f847b -g_Qfmt(0) gives 9 bytes: "1.23e-320" - -strtoIQ returns 33, consuming 9 bytes. -fI[0] = #3bd83731 86e30898 7e33b2e8 355f847a -fI[1] = #3bd83731 86e30898 7e33b2e8 355f847b -fI[1] == strtod - - -Input: 1.23e-20 - -strtoQ consumes 8 bytes and returns 17 -with bits = #3fbcd0ae 4cf76753 9e4cbca ad934841 -g_Qfmt(0) gives 8 bytes: "1.23e-20" - -strtoIQ returns 17, consuming 8 bytes. -fI[0] = #3fbcd0ae 4cf76753 9e4cbca ad934841 -fI[1] = #3fbcd0ae 4cf76753 9e4cbca ad934842 -fI[0] == strtod - - -Input: 1.23456789e307 - -strtoQ consumes 14 bytes and returns 17 -with bits = #43fb194b 14bdaecd bcea468c 902464cf -g_Qfmt(0) gives 15 bytes: "1.23456789e+307" - -strtoIQ returns 17, consuming 14 bytes. -fI[0] = #43fb194b 14bdaecd bcea468c 902464cf -fI[1] = #43fb194b 14bdaecd bcea468c 902464d0 -fI[0] == strtod - - -Input: 1.23456589e-307 - -strtoQ consumes 15 bytes and returns 17 -with bits = #3c036319 6bb9845f a6d234e3 39163574 -g_Qfmt(0) gives 15 bytes: "1.23456589e-307" - -strtoIQ returns 17, consuming 15 bytes. -fI[0] = #3c036319 6bb9845f a6d234e3 39163574 -fI[1] = #3c036319 6bb9845f a6d234e3 39163575 -fI[0] == strtod - - -Input: 1.234567890123456789 - -strtoQ consumes 20 bytes and returns 17 -with bits = #3fff3c0c a428c59f b71a4194 68dd175b -g_Qfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIQ returns 17, consuming 20 bytes. -fI[0] = #3fff3c0c a428c59f b71a4194 68dd175b -fI[1] = #3fff3c0c a428c59f b71a4194 68dd175c -fI[0] == strtod - - -Input: 1.234567890123456789e301 - -strtoQ consumes 24 bytes and returns 33 -with bits = #43e726f5 175f5641 3017ea80 763990ef -g_Qfmt(0) gives 25 bytes: "1.234567890123456789e+301" - -strtoIQ returns 33, consuming 24 bytes. -fI[0] = #43e726f5 175f5641 3017ea80 763990ee -fI[1] = #43e726f5 175f5641 3017ea80 763990ef -fI[1] == strtod - - -Input: 1.234567890123456789e-301 - -strtoQ consumes 25 bytes and returns 17 -with bits = #3c1752a6 4e34ba0d 35b19b04 3222fce5 -g_Qfmt(0) gives 25 bytes: "1.234567890123456789e-301" - -strtoIQ returns 17, consuming 25 bytes. -fI[0] = #3c1752a6 4e34ba0d 35b19b04 3222fce5 -fI[1] = #3c1752a6 4e34ba0d 35b19b04 3222fce6 -fI[0] == strtod - - -Input: 1.234567890123456789e-321 - -strtoQ consumes 25 bytes and returns 17 -with bits = #3bd4f3c2 3699d4db 99d1ea94 2fecd7de -g_Qfmt(0) gives 25 bytes: "1.234567890123456789e-321" - -strtoIQ returns 17, consuming 25 bytes. -fI[0] = #3bd4f3c2 3699d4db 99d1ea94 2fecd7de -fI[1] = #3bd4f3c2 3699d4db 99d1ea94 2fecd7df -fI[0] == strtod - - -Input: 1e23 - -strtoQ consumes 4 bytes and returns 1 -with bits = #404b52d0 2c7e14af 68000000 0 -g_Qfmt(0) gives 5 bytes: "1e+23" - -strtoIQ returns 1, consuming 4 bytes. -fI[0] == fI[1] = #404b52d0 2c7e14af 68000000 0 - - -Input: 1e310 - -strtoQ consumes 5 bytes and returns 33 -with bits = #4404bd03 c8140697 9e9ff00e fefd4cbd -g_Qfmt(0) gives 6 bytes: "1e+310" - -strtoIQ returns 33, consuming 5 bytes. -fI[0] = #4404bd03 c8140697 9e9ff00e fefd4cbc -fI[1] = #4404bd03 c8140697 9e9ff00e fefd4cbd -fI[1] == strtod - - -Input: 9.0259718793241475e-277 - -strtoQ consumes 23 bytes and returns 17 -with bits = #3c69ffff ffffffff f9ed5779 ac118fe1 -g_Qfmt(0) gives 23 bytes: "9.0259718793241475e-277" - -strtoIQ returns 17, consuming 23 bytes. -fI[0] = #3c69ffff ffffffff f9ed5779 ac118fe1 -fI[1] = #3c69ffff ffffffff f9ed5779 ac118fe2 -fI[0] == strtod - - -Input: 9.025971879324147880346310405869e-277 - -strtoQ consumes 37 bytes and returns 33 -with bits = #3c6a0000 0 0 9a -g_Qfmt(0) gives 37 bytes: "9.025971879324147880346310405869e-277" - -strtoIQ returns 33, consuming 37 bytes. -fI[0] = #3c6a0000 0 0 99 -fI[1] = #3c6a0000 0 0 9a -fI[1] == strtod - - -Input: 9.025971879324147880346310405868e-277 - -strtoQ consumes 37 bytes and returns 17 -with bits = #3c69ffff ffffffff ffffffff fffffcb5 -g_Qfmt(0) gives 37 bytes: "9.025971879324147880346310405868e-277" - -strtoIQ returns 17, consuming 37 bytes. -fI[0] = #3c69ffff ffffffff ffffffff fffffcb5 -fI[1] = #3c69ffff ffffffff ffffffff fffffcb6 -fI[0] == strtod - - -Input: 2.2250738585072014e-308 - -strtoQ consumes 23 bytes and returns 33 -with bits = #3c010000 0 8c304c cf867de0 -g_Qfmt(0) gives 23 bytes: "2.2250738585072014e-308" - -strtoIQ returns 33, consuming 23 bytes. -fI[0] = #3c010000 0 8c304c cf867ddf -fI[1] = #3c010000 0 8c304c cf867de0 -fI[1] == strtod - - -Input: 2.2250738585072013e-308 - -strtoQ consumes 23 bytes and returns 33 -with bits = #3c00ffff ffffffff fa9e4c4f 4c1e8a10 -g_Qfmt(0) gives 23 bytes: "2.2250738585072013e-308" - -strtoIQ returns 33, consuming 23 bytes. -fI[0] = #3c00ffff ffffffff fa9e4c4f 4c1e8a0f -fI[1] = #3c00ffff ffffffff fa9e4c4f 4c1e8a10 -fI[1] == strtod - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff1999 99999999 99999999 99999999 -g_Qfmt(0) gives 36 bytes: "1.0999999999999999999999999999999999" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff1999 99999999 99999999 99999999 -fI[1] = #3fff1999 99999999 99999999 9999999a -fI[0] == strtod - - -Input: -1.1 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff1999 99999999 99999999 99999999 -g_Qfmt(0) gives 37 bytes: "-1.0999999999999999999999999999999999" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff1999 99999999 99999999 9999999a -fI[1] = #bfff1999 99999999 99999999 99999999 -fI[1] == strtod - - -Input: 1.2 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff3333 33333333 33333333 33333333 -g_Qfmt(0) gives 3 bytes: "1.2" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff3333 33333333 33333333 33333333 -fI[1] = #3fff3333 33333333 33333333 33333334 -fI[0] == strtod - - -Input: -1.2 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff3333 33333333 33333333 33333333 -g_Qfmt(0) gives 4 bytes: "-1.2" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff3333 33333333 33333333 33333334 -fI[1] = #bfff3333 33333333 33333333 33333333 -fI[1] == strtod - - -Input: 1.3 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff4ccc cccccccc cccccccc cccccccc -g_Qfmt(0) gives 36 bytes: "1.2999999999999999999999999999999998" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff4ccc cccccccc cccccccc cccccccc -fI[1] = #3fff4ccc cccccccc cccccccc cccccccd -fI[0] == strtod - - -Input: -1.3 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff4ccc cccccccc cccccccc cccccccc -g_Qfmt(0) gives 37 bytes: "-1.2999999999999999999999999999999998" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff4ccc cccccccc cccccccc cccccccd -fI[1] = #bfff4ccc cccccccc cccccccc cccccccc -fI[1] == strtod - - -Input: 1.4 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff6666 66666666 66666666 66666666 -g_Qfmt(0) gives 3 bytes: "1.4" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff6666 66666666 66666666 66666666 -fI[1] = #3fff6666 66666666 66666666 66666667 -fI[0] == strtod - - -Input: -1.4 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff6666 66666666 66666666 66666666 -g_Qfmt(0) gives 4 bytes: "-1.4" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff6666 66666666 66666666 66666667 -fI[1] = #bfff6666 66666666 66666666 66666666 -fI[1] == strtod - - -Input: 1.5 - -strtoQ consumes 3 bytes and returns 1 -with bits = #3fff8000 0 0 0 -g_Qfmt(0) gives 3 bytes: "1.5" - -strtoIQ returns 1, consuming 3 bytes. -fI[0] == fI[1] = #3fff8000 0 0 0 - - -Input: -1.5 - -strtoQ consumes 4 bytes and returns 9 -with bits = #bfff8000 0 0 0 -g_Qfmt(0) gives 4 bytes: "-1.5" - -strtoIQ returns 9, consuming 4 bytes. -fI[0] == fI[1] = #bfff8000 0 0 0 - - -Input: 1.6 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff9999 99999999 99999999 99999999 -g_Qfmt(0) gives 36 bytes: "1.5999999999999999999999999999999999" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff9999 99999999 99999999 99999999 -fI[1] = #3fff9999 99999999 99999999 9999999a -fI[0] == strtod - - -Input: -1.6 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff9999 99999999 99999999 99999999 -g_Qfmt(0) gives 37 bytes: "-1.5999999999999999999999999999999999" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff9999 99999999 99999999 9999999a -fI[1] = #bfff9999 99999999 99999999 99999999 -fI[1] == strtod - - -Input: 1.7 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffb333 33333333 33333333 33333333 -g_Qfmt(0) gives 3 bytes: "1.7" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffb333 33333333 33333333 33333333 -fI[1] = #3fffb333 33333333 33333333 33333334 -fI[0] == strtod - - -Input: -1.7 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffb333 33333333 33333333 33333333 -g_Qfmt(0) gives 4 bytes: "-1.7" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffb333 33333333 33333333 33333334 -fI[1] = #bfffb333 33333333 33333333 33333333 -fI[1] == strtod - - -Input: 1.8 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffcccc cccccccc cccccccc cccccccc -g_Qfmt(0) gives 36 bytes: "1.7999999999999999999999999999999998" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fffcccc cccccccc cccccccc cccccccc -fI[1] = #3fffcccc cccccccc cccccccc cccccccd -fI[0] == strtod - - -Input: -1.8 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffcccc cccccccc cccccccc cccccccc -g_Qfmt(0) gives 37 bytes: "-1.7999999999999999999999999999999998" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfffcccc cccccccc cccccccc cccccccd -fI[1] = #bfffcccc cccccccc cccccccc cccccccc -fI[1] == strtod - - -Input: 1.9 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffe666 66666666 66666666 66666666 -g_Qfmt(0) gives 3 bytes: "1.9" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffe666 66666666 66666666 66666666 -fI[1] = #3fffe666 66666666 66666666 66666667 -fI[0] == strtod - - -Input: -1.9 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffe666 66666666 66666666 66666666 -g_Qfmt(0) gives 4 bytes: "-1.9" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffe666 66666666 66666666 66666667 -fI[1] = #bfffe666 66666666 66666666 66666666 -fI[1] == strtod - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff1999 99999999 99999999 9999999a -g_Qfmt(0) gives 3 bytes: "1.1" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff1999 99999999 99999999 99999999 -fI[1] = #3fff1999 99999999 99999999 9999999a -fI[1] == strtod - - -Input: -1.1 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff1999 99999999 99999999 9999999a -g_Qfmt(0) gives 4 bytes: "-1.1" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff1999 99999999 99999999 9999999a -fI[1] = #bfff1999 99999999 99999999 99999999 -fI[0] == strtod - - -Input: 1.2 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff3333 33333333 33333333 33333333 -g_Qfmt(0) gives 3 bytes: "1.2" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff3333 33333333 33333333 33333333 -fI[1] = #3fff3333 33333333 33333333 33333334 -fI[0] == strtod - - -Input: -1.2 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff3333 33333333 33333333 33333333 -g_Qfmt(0) gives 4 bytes: "-1.2" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff3333 33333333 33333333 33333334 -fI[1] = #bfff3333 33333333 33333333 33333333 -fI[1] == strtod - - -Input: 1.3 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff4ccc cccccccc cccccccc cccccccd -g_Qfmt(0) gives 3 bytes: "1.3" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff4ccc cccccccc cccccccc cccccccc -fI[1] = #3fff4ccc cccccccc cccccccc cccccccd -fI[1] == strtod - - -Input: -1.3 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff4ccc cccccccc cccccccc cccccccd -g_Qfmt(0) gives 4 bytes: "-1.3" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff4ccc cccccccc cccccccc cccccccd -fI[1] = #bfff4ccc cccccccc cccccccc cccccccc -fI[0] == strtod - - -Input: 1.4 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff6666 66666666 66666666 66666666 -g_Qfmt(0) gives 3 bytes: "1.4" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff6666 66666666 66666666 66666666 -fI[1] = #3fff6666 66666666 66666666 66666667 -fI[0] == strtod - - -Input: -1.4 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff6666 66666666 66666666 66666666 -g_Qfmt(0) gives 4 bytes: "-1.4" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff6666 66666666 66666666 66666667 -fI[1] = #bfff6666 66666666 66666666 66666666 -fI[1] == strtod - - -Input: 1.5 - -strtoQ consumes 3 bytes and returns 1 -with bits = #3fff8000 0 0 0 -g_Qfmt(0) gives 3 bytes: "1.5" - -strtoIQ returns 1, consuming 3 bytes. -fI[0] == fI[1] = #3fff8000 0 0 0 - - -Input: -1.5 - -strtoQ consumes 4 bytes and returns 9 -with bits = #bfff8000 0 0 0 -g_Qfmt(0) gives 4 bytes: "-1.5" - -strtoIQ returns 9, consuming 4 bytes. -fI[0] == fI[1] = #bfff8000 0 0 0 - - -Input: 1.6 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff9999 99999999 99999999 9999999a -g_Qfmt(0) gives 3 bytes: "1.6" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff9999 99999999 99999999 99999999 -fI[1] = #3fff9999 99999999 99999999 9999999a -fI[1] == strtod - - -Input: -1.6 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff9999 99999999 99999999 9999999a -g_Qfmt(0) gives 4 bytes: "-1.6" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff9999 99999999 99999999 9999999a -fI[1] = #bfff9999 99999999 99999999 99999999 -fI[0] == strtod - - -Input: 1.7 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffb333 33333333 33333333 33333333 -g_Qfmt(0) gives 3 bytes: "1.7" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffb333 33333333 33333333 33333333 -fI[1] = #3fffb333 33333333 33333333 33333334 -fI[0] == strtod - - -Input: -1.7 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffb333 33333333 33333333 33333333 -g_Qfmt(0) gives 4 bytes: "-1.7" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffb333 33333333 33333333 33333334 -fI[1] = #bfffb333 33333333 33333333 33333333 -fI[1] == strtod - - -Input: 1.8 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fffcccc cccccccc cccccccc cccccccd -g_Qfmt(0) gives 3 bytes: "1.8" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fffcccc cccccccc cccccccc cccccccc -fI[1] = #3fffcccc cccccccc cccccccc cccccccd -fI[1] == strtod - - -Input: -1.8 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfffcccc cccccccc cccccccc cccccccd -g_Qfmt(0) gives 4 bytes: "-1.8" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfffcccc cccccccc cccccccc cccccccd -fI[1] = #bfffcccc cccccccc cccccccc cccccccc -fI[0] == strtod - - -Input: 1.9 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffe666 66666666 66666666 66666666 -g_Qfmt(0) gives 3 bytes: "1.9" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffe666 66666666 66666666 66666666 -fI[1] = #3fffe666 66666666 66666666 66666667 -fI[0] == strtod - - -Input: -1.9 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffe666 66666666 66666666 66666666 -g_Qfmt(0) gives 4 bytes: "-1.9" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffe666 66666666 66666666 66666667 -fI[1] = #bfffe666 66666666 66666666 66666666 -fI[1] == strtod - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff1999 99999999 99999999 9999999a -g_Qfmt(0) gives 3 bytes: "1.1" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff1999 99999999 99999999 99999999 -fI[1] = #3fff1999 99999999 99999999 9999999a -fI[1] == strtod - - -Input: -1.1 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff1999 99999999 99999999 99999999 -g_Qfmt(0) gives 37 bytes: "-1.0999999999999999999999999999999999" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff1999 99999999 99999999 9999999a -fI[1] = #bfff1999 99999999 99999999 99999999 -fI[1] == strtod - - -Input: 1.2 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff3333 33333333 33333333 33333334 -g_Qfmt(0) gives 36 bytes: "1.2000000000000000000000000000000002" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff3333 33333333 33333333 33333333 -fI[1] = #3fff3333 33333333 33333333 33333334 -fI[1] == strtod - - -Input: -1.2 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff3333 33333333 33333333 33333333 -g_Qfmt(0) gives 4 bytes: "-1.2" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff3333 33333333 33333333 33333334 -fI[1] = #bfff3333 33333333 33333333 33333333 -fI[1] == strtod - - -Input: 1.3 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff4ccc cccccccc cccccccc cccccccd -g_Qfmt(0) gives 3 bytes: "1.3" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff4ccc cccccccc cccccccc cccccccc -fI[1] = #3fff4ccc cccccccc cccccccc cccccccd -fI[1] == strtod - - -Input: -1.3 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff4ccc cccccccc cccccccc cccccccc -g_Qfmt(0) gives 37 bytes: "-1.2999999999999999999999999999999998" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff4ccc cccccccc cccccccc cccccccd -fI[1] = #bfff4ccc cccccccc cccccccc cccccccc -fI[1] == strtod - - -Input: 1.4 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff6666 66666666 66666666 66666667 -g_Qfmt(0) gives 36 bytes: "1.4000000000000000000000000000000001" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff6666 66666666 66666666 66666666 -fI[1] = #3fff6666 66666666 66666666 66666667 -fI[1] == strtod - - -Input: -1.4 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff6666 66666666 66666666 66666666 -g_Qfmt(0) gives 4 bytes: "-1.4" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff6666 66666666 66666666 66666667 -fI[1] = #bfff6666 66666666 66666666 66666666 -fI[1] == strtod - - -Input: 1.5 - -strtoQ consumes 3 bytes and returns 1 -with bits = #3fff8000 0 0 0 -g_Qfmt(0) gives 3 bytes: "1.5" - -strtoIQ returns 1, consuming 3 bytes. -fI[0] == fI[1] = #3fff8000 0 0 0 - - -Input: -1.5 - -strtoQ consumes 4 bytes and returns 9 -with bits = #bfff8000 0 0 0 -g_Qfmt(0) gives 4 bytes: "-1.5" - -strtoIQ returns 9, consuming 4 bytes. -fI[0] == fI[1] = #bfff8000 0 0 0 - - -Input: 1.6 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff9999 99999999 99999999 9999999a -g_Qfmt(0) gives 3 bytes: "1.6" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff9999 99999999 99999999 99999999 -fI[1] = #3fff9999 99999999 99999999 9999999a -fI[1] == strtod - - -Input: -1.6 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff9999 99999999 99999999 99999999 -g_Qfmt(0) gives 37 bytes: "-1.5999999999999999999999999999999999" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff9999 99999999 99999999 9999999a -fI[1] = #bfff9999 99999999 99999999 99999999 -fI[1] == strtod - - -Input: 1.7 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fffb333 33333333 33333333 33333334 -g_Qfmt(0) gives 36 bytes: "1.7000000000000000000000000000000002" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffb333 33333333 33333333 33333333 -fI[1] = #3fffb333 33333333 33333333 33333334 -fI[1] == strtod - - -Input: -1.7 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffb333 33333333 33333333 33333333 -g_Qfmt(0) gives 4 bytes: "-1.7" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffb333 33333333 33333333 33333334 -fI[1] = #bfffb333 33333333 33333333 33333333 -fI[1] == strtod - - -Input: 1.8 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fffcccc cccccccc cccccccc cccccccd -g_Qfmt(0) gives 3 bytes: "1.8" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fffcccc cccccccc cccccccc cccccccc -fI[1] = #3fffcccc cccccccc cccccccc cccccccd -fI[1] == strtod - - -Input: -1.8 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffcccc cccccccc cccccccc cccccccc -g_Qfmt(0) gives 37 bytes: "-1.7999999999999999999999999999999998" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfffcccc cccccccc cccccccc cccccccd -fI[1] = #bfffcccc cccccccc cccccccc cccccccc -fI[1] == strtod - - -Input: 1.9 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fffe666 66666666 66666666 66666667 -g_Qfmt(0) gives 36 bytes: "1.9000000000000000000000000000000001" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffe666 66666666 66666666 66666666 -fI[1] = #3fffe666 66666666 66666666 66666667 -fI[1] == strtod - - -Input: -1.9 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffe666 66666666 66666666 66666666 -g_Qfmt(0) gives 4 bytes: "-1.9" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffe666 66666666 66666666 66666667 -fI[1] = #bfffe666 66666666 66666666 66666666 -fI[1] == strtod - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff1999 99999999 99999999 99999999 -g_Qfmt(0) gives 36 bytes: "1.0999999999999999999999999999999999" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff1999 99999999 99999999 99999999 -fI[1] = #3fff1999 99999999 99999999 9999999a -fI[0] == strtod - - -Input: -1.1 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff1999 99999999 99999999 9999999a -g_Qfmt(0) gives 4 bytes: "-1.1" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff1999 99999999 99999999 9999999a -fI[1] = #bfff1999 99999999 99999999 99999999 -fI[0] == strtod - - -Input: 1.2 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff3333 33333333 33333333 33333333 -g_Qfmt(0) gives 3 bytes: "1.2" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff3333 33333333 33333333 33333333 -fI[1] = #3fff3333 33333333 33333333 33333334 -fI[0] == strtod - - -Input: -1.2 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff3333 33333333 33333333 33333334 -g_Qfmt(0) gives 37 bytes: "-1.2000000000000000000000000000000002" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff3333 33333333 33333333 33333334 -fI[1] = #bfff3333 33333333 33333333 33333333 -fI[0] == strtod - - -Input: 1.3 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff4ccc cccccccc cccccccc cccccccc -g_Qfmt(0) gives 36 bytes: "1.2999999999999999999999999999999998" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff4ccc cccccccc cccccccc cccccccc -fI[1] = #3fff4ccc cccccccc cccccccc cccccccd -fI[0] == strtod - - -Input: -1.3 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff4ccc cccccccc cccccccc cccccccd -g_Qfmt(0) gives 4 bytes: "-1.3" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff4ccc cccccccc cccccccc cccccccd -fI[1] = #bfff4ccc cccccccc cccccccc cccccccc -fI[0] == strtod - - -Input: 1.4 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff6666 66666666 66666666 66666666 -g_Qfmt(0) gives 3 bytes: "1.4" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff6666 66666666 66666666 66666666 -fI[1] = #3fff6666 66666666 66666666 66666667 -fI[0] == strtod - - -Input: -1.4 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff6666 66666666 66666666 66666667 -g_Qfmt(0) gives 37 bytes: "-1.4000000000000000000000000000000001" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff6666 66666666 66666666 66666667 -fI[1] = #bfff6666 66666666 66666666 66666666 -fI[0] == strtod - - -Input: 1.5 - -strtoQ consumes 3 bytes and returns 1 -with bits = #3fff8000 0 0 0 -g_Qfmt(0) gives 3 bytes: "1.5" - -strtoIQ returns 1, consuming 3 bytes. -fI[0] == fI[1] = #3fff8000 0 0 0 - - -Input: -1.5 - -strtoQ consumes 4 bytes and returns 9 -with bits = #bfff8000 0 0 0 -g_Qfmt(0) gives 4 bytes: "-1.5" - -strtoIQ returns 9, consuming 4 bytes. -fI[0] == fI[1] = #bfff8000 0 0 0 - - -Input: 1.6 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff9999 99999999 99999999 99999999 -g_Qfmt(0) gives 36 bytes: "1.5999999999999999999999999999999999" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff9999 99999999 99999999 99999999 -fI[1] = #3fff9999 99999999 99999999 9999999a -fI[0] == strtod - - -Input: -1.6 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff9999 99999999 99999999 9999999a -g_Qfmt(0) gives 4 bytes: "-1.6" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff9999 99999999 99999999 9999999a -fI[1] = #bfff9999 99999999 99999999 99999999 -fI[0] == strtod - - -Input: 1.7 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffb333 33333333 33333333 33333333 -g_Qfmt(0) gives 3 bytes: "1.7" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffb333 33333333 33333333 33333333 -fI[1] = #3fffb333 33333333 33333333 33333334 -fI[0] == strtod - - -Input: -1.7 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfffb333 33333333 33333333 33333334 -g_Qfmt(0) gives 37 bytes: "-1.7000000000000000000000000000000002" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffb333 33333333 33333333 33333334 -fI[1] = #bfffb333 33333333 33333333 33333333 -fI[0] == strtod - - -Input: 1.8 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffcccc cccccccc cccccccc cccccccc -g_Qfmt(0) gives 36 bytes: "1.7999999999999999999999999999999998" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fffcccc cccccccc cccccccc cccccccc -fI[1] = #3fffcccc cccccccc cccccccc cccccccd -fI[0] == strtod - - -Input: -1.8 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfffcccc cccccccc cccccccc cccccccd -g_Qfmt(0) gives 4 bytes: "-1.8" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfffcccc cccccccc cccccccc cccccccd -fI[1] = #bfffcccc cccccccc cccccccc cccccccc -fI[0] == strtod - - -Input: 1.9 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffe666 66666666 66666666 66666666 -g_Qfmt(0) gives 3 bytes: "1.9" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffe666 66666666 66666666 66666666 -fI[1] = #3fffe666 66666666 66666666 66666667 -fI[0] == strtod - - -Input: -1.9 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfffe666 66666666 66666666 66666667 -g_Qfmt(0) gives 37 bytes: "-1.9000000000000000000000000000000001" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffe666 66666666 66666666 66666667 -fI[1] = #bfffe666 66666666 66666666 66666666 -fI[0] == strtod - diff --git a/contrib/gdtoa/test/Q.ou1 b/contrib/gdtoa/test/Q.ou1 deleted file mode 100644 index cb2a23f..0000000 --- a/contrib/gdtoa/test/Q.ou1 +++ /dev/null @@ -1,1468 +0,0 @@ - -Input: 1.23 - -strtoQ consumes 4 bytes and returns 17 -with bits = #3fff3ae1 47ae147a e147ae14 7ae147ae -printf("%.35Lg") gives 1.23 -g_Qfmt(0) gives 4 bytes: "1.23" - -strtoIQ returns 17, consuming 4 bytes. -fI[0] = #3fff3ae1 47ae147a e147ae14 7ae147ae -= 1.23 -fI[1] = #3fff3ae1 47ae147a e147ae14 7ae147af -= 1.2300000000000000000000000000000002 -fI[0] == strtod - - -Input: 1.23e+20 - -strtoQ consumes 8 bytes and returns 1 -with bits = #4041aabd f2145b43 0 0 -printf("%.35Lg") gives 123000000000000000000 -g_Qfmt(0) gives 8 bytes: "1.23e+20" - -strtoIQ returns 1, consuming 8 bytes. -fI[0] == fI[1] = #4041aabd f2145b43 0 0 -= 123000000000000000000 - - -Input: 1.23e-20 - -strtoQ consumes 8 bytes and returns 17 -with bits = #3fbcd0ae 4cf76753 9e4cbca ad934841 -printf("%.35Lg") gives 1.2299999999999999999999999999999999e-20 -g_Qfmt(0) gives 8 bytes: "1.23e-20" - -strtoIQ returns 17, consuming 8 bytes. -fI[0] = #3fbcd0ae 4cf76753 9e4cbca ad934841 -= 1.2299999999999999999999999999999999e-20 -fI[1] = #3fbcd0ae 4cf76753 9e4cbca ad934842 -= 1.2300000000000000000000000000000001e-20 -fI[0] == strtod - - -Input: 1.23456789 - -strtoQ consumes 10 bytes and returns 17 -with bits = #3fff3c0c a4283de1 b7eb6945 1304948f -printf("%.35Lg") gives 1.2345678899999999999999999999999999 -g_Qfmt(0) gives 10 bytes: "1.23456789" - -strtoIQ returns 17, consuming 10 bytes. -fI[0] = #3fff3c0c a4283de1 b7eb6945 1304948f -= 1.2345678899999999999999999999999999 -fI[1] = #3fff3c0c a4283de1 b7eb6945 13049490 -= 1.2345678900000000000000000000000001 -fI[0] == strtod - - -Input: 1.23456589e+20 - -strtoQ consumes 14 bytes and returns 1 -with bits = #4041ac53 7a660b99 74000000 0 -printf("%.35Lg") gives 123456589000000000000 -g_Qfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoIQ returns 1, consuming 14 bytes. -fI[0] == fI[1] = #4041ac53 7a660b99 74000000 0 -= 123456589000000000000 - - -Input: 1.23e+30 - -strtoQ consumes 8 bytes and returns 1 -with bits = #4062f0cb 4e8fb79 4945600 0 -printf("%.35Lg") gives 1230000000000000000000000000000 -g_Qfmt(0) gives 8 bytes: "1.23e+30" - -strtoIQ returns 1, consuming 8 bytes. -fI[0] == fI[1] = #4062f0cb 4e8fb79 4945600 0 -= 1230000000000000000000000000000 - - -Input: 1.23e-30 - -strtoQ consumes 8 bytes and returns 17 -with bits = #3f9b8f28 66f5010a a9d63f9e d7e8ba14 -printf("%.35Lg") gives 1.2299999999999999999999999999999999e-30 -g_Qfmt(0) gives 8 bytes: "1.23e-30" - -strtoIQ returns 17, consuming 8 bytes. -fI[0] = #3f9b8f28 66f5010a a9d63f9e d7e8ba14 -= 1.2299999999999999999999999999999999e-30 -fI[1] = #3f9b8f28 66f5010a a9d63f9e d7e8ba15 -= 1.2300000000000000000000000000000001e-30 -fI[0] == strtod - - -Input: 1.23456789e-20 - -strtoQ consumes 14 bytes and returns 33 -with bits = #3fbcd268 1471e7ad a6a4a029 d86c1fa2 -printf("%.35Lg") gives 1.2345678900000000000000000000000001e-20 -g_Qfmt(0) gives 14 bytes: "1.23456789e-20" - -strtoIQ returns 33, consuming 14 bytes. -fI[0] = #3fbcd268 1471e7ad a6a4a029 d86c1fa1 -= 1.2345678899999999999999999999999999e-20 -fI[1] = #3fbcd268 1471e7ad a6a4a029 d86c1fa2 -= 1.2345678900000000000000000000000001e-20 -fI[1] == strtod - - -Input: 1.23456789e-30 - -strtoQ consumes 14 bytes and returns 17 -with bits = #3f9b90a3 e33bbd99 51f85855 5a6b19d4 -printf("%.35Lg") gives 1.23456789e-30 -g_Qfmt(0) gives 14 bytes: "1.23456789e-30" - -strtoIQ returns 17, consuming 14 bytes. -fI[0] = #3f9b90a3 e33bbd99 51f85855 5a6b19d4 -= 1.23456789e-30 -fI[1] = #3f9b90a3 e33bbd99 51f85855 5a6b19d5 -= 1.2345678900000000000000000000000001e-30 -fI[0] == strtod - - -Input: 1.234567890123456789 - -strtoQ consumes 20 bytes and returns 17 -with bits = #3fff3c0c a428c59f b71a4194 68dd175b -printf("%.35Lg") gives 1.234567890123456789 -g_Qfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIQ returns 17, consuming 20 bytes. -fI[0] = #3fff3c0c a428c59f b71a4194 68dd175b -= 1.234567890123456789 -fI[1] = #3fff3c0c a428c59f b71a4194 68dd175c -= 1.2345678901234567890000000000000002 -fI[0] == strtod - - -Input: 1.23456789012345678901234567890123456789 - -strtoQ consumes 40 bytes and returns 17 -with bits = #3fff3c0c a428c59f b71a7be1 6b6b6d5b -printf("%.35Lg") gives 1.2345678901234567890123456789012346 -g_Qfmt(0) gives 36 bytes: "1.2345678901234567890123456789012346" - -strtoIQ returns 17, consuming 40 bytes. -fI[0] = #3fff3c0c a428c59f b71a7be1 6b6b6d5b -= 1.2345678901234567890123456789012346 -fI[1] = #3fff3c0c a428c59f b71a7be1 6b6b6d5c -= 1.2345678901234567890123456789012347 -fI[0] == strtod - - -Input: 1.23e306 - -strtoQ consumes 8 bytes and returns 33 -with bits = #43f7c067 6cd1c61f 4daac5f1 e9fa3b55 -printf("%.35Lg") gives 1.23e+306 -g_Qfmt(0) gives 9 bytes: "1.23e+306" - -strtoIQ returns 33, consuming 8 bytes. -fI[0] = #43f7c067 6cd1c61f 4daac5f1 e9fa3b54 -= 1.2299999999999999999999999999999999e+306 -fI[1] = #43f7c067 6cd1c61f 4daac5f1 e9fa3b55 -= 1.23e+306 -fI[1] == strtod - - -Input: 1.23e-306 - -strtoQ consumes 9 bytes and returns 17 -with bits = #3c06ba3b 85da396e 7e496ab7 d233c3dd -printf("%.35Lg") gives 1.23e-306 -g_Qfmt(0) gives 9 bytes: "1.23e-306" - -strtoIQ returns 17, consuming 9 bytes. -fI[0] = #3c06ba3b 85da396e 7e496ab7 d233c3dd -= 1.23e-306 -fI[1] = #3c06ba3b 85da396e 7e496ab7 d233c3de -= 1.2300000000000000000000000000000001e-306 -fI[0] == strtod - - -Input: 1.23e-320 - -strtoQ consumes 9 bytes and returns 33 -with bits = #3bd83731 86e30898 7e33b2e8 355f847b -printf("%.35Lg") gives 1.2300000000000000000000000000000001e-320 -g_Qfmt(0) gives 9 bytes: "1.23e-320" - -strtoIQ returns 33, consuming 9 bytes. -fI[0] = #3bd83731 86e30898 7e33b2e8 355f847a -= 1.2299999999999999999999999999999999e-320 -fI[1] = #3bd83731 86e30898 7e33b2e8 355f847b -= 1.2300000000000000000000000000000001e-320 -fI[1] == strtod - - -Input: 1.23e-20 - -strtoQ consumes 8 bytes and returns 17 -with bits = #3fbcd0ae 4cf76753 9e4cbca ad934841 -printf("%.35Lg") gives 1.2299999999999999999999999999999999e-20 -g_Qfmt(0) gives 8 bytes: "1.23e-20" - -strtoIQ returns 17, consuming 8 bytes. -fI[0] = #3fbcd0ae 4cf76753 9e4cbca ad934841 -= 1.2299999999999999999999999999999999e-20 -fI[1] = #3fbcd0ae 4cf76753 9e4cbca ad934842 -= 1.2300000000000000000000000000000001e-20 -fI[0] == strtod - - -Input: 1.23456789e307 - -strtoQ consumes 14 bytes and returns 17 -with bits = #43fb194b 14bdaecd bcea468c 902464cf -printf("%.35Lg") gives 1.2345678899999999999999999999999999e+307 -g_Qfmt(0) gives 15 bytes: "1.23456789e+307" - -strtoIQ returns 17, consuming 14 bytes. -fI[0] = #43fb194b 14bdaecd bcea468c 902464cf -= 1.2345678899999999999999999999999999e+307 -fI[1] = #43fb194b 14bdaecd bcea468c 902464d0 -= 1.2345678900000000000000000000000001e+307 -fI[0] == strtod - - -Input: 1.23456589e-307 - -strtoQ consumes 15 bytes and returns 17 -with bits = #3c036319 6bb9845f a6d234e3 39163574 -printf("%.35Lg") gives 1.23456589e-307 -g_Qfmt(0) gives 15 bytes: "1.23456589e-307" - -strtoIQ returns 17, consuming 15 bytes. -fI[0] = #3c036319 6bb9845f a6d234e3 39163574 -= 1.23456589e-307 -fI[1] = #3c036319 6bb9845f a6d234e3 39163575 -= 1.2345658900000000000000000000000002e-307 -fI[0] == strtod - - -Input: 1.234567890123456789 - -strtoQ consumes 20 bytes and returns 17 -with bits = #3fff3c0c a428c59f b71a4194 68dd175b -printf("%.35Lg") gives 1.234567890123456789 -g_Qfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIQ returns 17, consuming 20 bytes. -fI[0] = #3fff3c0c a428c59f b71a4194 68dd175b -= 1.234567890123456789 -fI[1] = #3fff3c0c a428c59f b71a4194 68dd175c -= 1.2345678901234567890000000000000002 -fI[0] == strtod - - -Input: 1.234567890123456789e301 - -strtoQ consumes 24 bytes and returns 33 -with bits = #43e726f5 175f5641 3017ea80 763990ef -printf("%.35Lg") gives 1.2345678901234567890000000000000001e+301 -g_Qfmt(0) gives 25 bytes: "1.234567890123456789e+301" - -strtoIQ returns 33, consuming 24 bytes. -fI[0] = #43e726f5 175f5641 3017ea80 763990ee -= 1.2345678901234567889999999999999999e+301 -fI[1] = #43e726f5 175f5641 3017ea80 763990ef -= 1.2345678901234567890000000000000001e+301 -fI[1] == strtod - - -Input: 1.234567890123456789e-301 - -strtoQ consumes 25 bytes and returns 17 -with bits = #3c1752a6 4e34ba0d 35b19b04 3222fce5 -printf("%.35Lg") gives 1.234567890123456789e-301 -g_Qfmt(0) gives 25 bytes: "1.234567890123456789e-301" - -strtoIQ returns 17, consuming 25 bytes. -fI[0] = #3c1752a6 4e34ba0d 35b19b04 3222fce5 -= 1.234567890123456789e-301 -fI[1] = #3c1752a6 4e34ba0d 35b19b04 3222fce6 -= 1.2345678901234567890000000000000002e-301 -fI[0] == strtod - - -Input: 1.234567890123456789e-321 - -strtoQ consumes 25 bytes and returns 17 -with bits = #3bd4f3c2 3699d4db 99d1ea94 2fecd7de -printf("%.35Lg") gives 1.234567890123456789e-321 -g_Qfmt(0) gives 25 bytes: "1.234567890123456789e-321" - -strtoIQ returns 17, consuming 25 bytes. -fI[0] = #3bd4f3c2 3699d4db 99d1ea94 2fecd7de -= 1.234567890123456789e-321 -fI[1] = #3bd4f3c2 3699d4db 99d1ea94 2fecd7df -= 1.2345678901234567890000000000000001e-321 -fI[0] == strtod - - -Input: 1e23 - -strtoQ consumes 4 bytes and returns 1 -with bits = #404b52d0 2c7e14af 68000000 0 -printf("%.35Lg") gives 100000000000000000000000 -g_Qfmt(0) gives 5 bytes: "1e+23" - -strtoIQ returns 1, consuming 4 bytes. -fI[0] == fI[1] = #404b52d0 2c7e14af 68000000 0 -= 100000000000000000000000 - - -Input: 1e310 - -strtoQ consumes 5 bytes and returns 33 -with bits = #4404bd03 c8140697 9e9ff00e fefd4cbd -printf("%.35Lg") gives 1e+310 -g_Qfmt(0) gives 6 bytes: "1e+310" - -strtoIQ returns 33, consuming 5 bytes. -fI[0] = #4404bd03 c8140697 9e9ff00e fefd4cbc -= 9.9999999999999999999999999999999992e+309 -fI[1] = #4404bd03 c8140697 9e9ff00e fefd4cbd -= 1e+310 -fI[1] == strtod - - -Input: 9.0259718793241475e-277 - -strtoQ consumes 23 bytes and returns 17 -with bits = #3c69ffff ffffffff f9ed5779 ac118fe1 -printf("%.35Lg") gives 9.0259718793241474999999999999999997e-277 -g_Qfmt(0) gives 23 bytes: "9.0259718793241475e-277" - -strtoIQ returns 17, consuming 23 bytes. -fI[0] = #3c69ffff ffffffff f9ed5779 ac118fe1 -= 9.0259718793241474999999999999999997e-277 -fI[1] = #3c69ffff ffffffff f9ed5779 ac118fe2 -= 9.0259718793241475000000000000000006e-277 -fI[0] == strtod - - -Input: 9.025971879324147880346310405869e-277 - -strtoQ consumes 37 bytes and returns 33 -with bits = #3c6a0000 0 0 9a -printf("%.35Lg") gives 9.0259718793241478803463104058690004e-277 -g_Qfmt(0) gives 37 bytes: "9.025971879324147880346310405869e-277" - -strtoIQ returns 33, consuming 37 bytes. -fI[0] = #3c6a0000 0 0 99 -= 9.0259718793241478803463104058689987e-277 -fI[1] = #3c6a0000 0 0 9a -= 9.0259718793241478803463104058690004e-277 -fI[1] == strtod - - -Input: 9.025971879324147880346310405868e-277 - -strtoQ consumes 37 bytes and returns 17 -with bits = #3c69ffff ffffffff ffffffff fffffcb5 -printf("%.35Lg") gives 9.025971879324147880346310405868e-277 -g_Qfmt(0) gives 37 bytes: "9.025971879324147880346310405868e-277" - -strtoIQ returns 17, consuming 37 bytes. -fI[0] = #3c69ffff ffffffff ffffffff fffffcb5 -= 9.025971879324147880346310405868e-277 -fI[1] = #3c69ffff ffffffff ffffffff fffffcb6 -= 9.0259718793241478803463104058680009e-277 -fI[0] == strtod - - -Input: 2.2250738585072014e-308 - -strtoQ consumes 23 bytes and returns 33 -with bits = #3c010000 0 8c304c cf867de0 -printf("%.35Lg") gives 2.2250738585072014000000000000000001e-308 -g_Qfmt(0) gives 23 bytes: "2.2250738585072014e-308" - -strtoIQ returns 33, consuming 23 bytes. -fI[0] = #3c010000 0 8c304c cf867ddf -= 2.2250738585072013999999999999999997e-308 -fI[1] = #3c010000 0 8c304c cf867de0 -= 2.2250738585072014000000000000000001e-308 -fI[1] == strtod - - -Input: 2.2250738585072013e-308 - -strtoQ consumes 23 bytes and returns 33 -with bits = #3c00ffff ffffffff fa9e4c4f 4c1e8a10 -printf("%.35Lg") gives 2.2250738585072013e-308 -g_Qfmt(0) gives 23 bytes: "2.2250738585072013e-308" - -strtoIQ returns 33, consuming 23 bytes. -fI[0] = #3c00ffff ffffffff fa9e4c4f 4c1e8a0f -= 2.2250738585072012999999999999999998e-308 -fI[1] = #3c00ffff ffffffff fa9e4c4f 4c1e8a10 -= 2.2250738585072013e-308 -fI[1] == strtod - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff1999 99999999 99999999 99999999 -printf("%.35Lg") gives 1.0999999999999999999999999999999999 -g_Qfmt(0) gives 36 bytes: "1.0999999999999999999999999999999999" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff1999 99999999 99999999 99999999 -= 1.0999999999999999999999999999999999 -fI[1] = #3fff1999 99999999 99999999 9999999a -= 1.1000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.1 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff1999 99999999 99999999 99999999 -printf("%.35Lg") gives -1.0999999999999999999999999999999999 -g_Qfmt(0) gives 37 bytes: "-1.0999999999999999999999999999999999" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff1999 99999999 99999999 9999999a -= -1.1000000000000000000000000000000001 -fI[1] = #bfff1999 99999999 99999999 99999999 -= -1.0999999999999999999999999999999999 -fI[1] == strtod - - -Input: 1.2 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff3333 33333333 33333333 33333333 -printf("%.35Lg") gives 1.2 -g_Qfmt(0) gives 3 bytes: "1.2" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff3333 33333333 33333333 33333333 -= 1.2 -fI[1] = #3fff3333 33333333 33333333 33333334 -= 1.2000000000000000000000000000000002 -fI[0] == strtod - - -Input: -1.2 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff3333 33333333 33333333 33333333 -printf("%.35Lg") gives -1.2 -g_Qfmt(0) gives 4 bytes: "-1.2" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff3333 33333333 33333333 33333334 -= -1.2000000000000000000000000000000002 -fI[1] = #bfff3333 33333333 33333333 33333333 -= -1.2 -fI[1] == strtod - - -Input: 1.3 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff4ccc cccccccc cccccccc cccccccc -printf("%.35Lg") gives 1.2999999999999999999999999999999998 -g_Qfmt(0) gives 36 bytes: "1.2999999999999999999999999999999998" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff4ccc cccccccc cccccccc cccccccc -= 1.2999999999999999999999999999999998 -fI[1] = #3fff4ccc cccccccc cccccccc cccccccd -= 1.3 -fI[0] == strtod - - -Input: -1.3 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff4ccc cccccccc cccccccc cccccccc -printf("%.35Lg") gives -1.2999999999999999999999999999999998 -g_Qfmt(0) gives 37 bytes: "-1.2999999999999999999999999999999998" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff4ccc cccccccc cccccccc cccccccd -= -1.3 -fI[1] = #bfff4ccc cccccccc cccccccc cccccccc -= -1.2999999999999999999999999999999998 -fI[1] == strtod - - -Input: 1.4 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff6666 66666666 66666666 66666666 -printf("%.35Lg") gives 1.3999999999999999999999999999999999 -g_Qfmt(0) gives 3 bytes: "1.4" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff6666 66666666 66666666 66666666 -= 1.3999999999999999999999999999999999 -fI[1] = #3fff6666 66666666 66666666 66666667 -= 1.4000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.4 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff6666 66666666 66666666 66666666 -printf("%.35Lg") gives -1.3999999999999999999999999999999999 -g_Qfmt(0) gives 4 bytes: "-1.4" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff6666 66666666 66666666 66666667 -= -1.4000000000000000000000000000000001 -fI[1] = #bfff6666 66666666 66666666 66666666 -= -1.3999999999999999999999999999999999 -fI[1] == strtod - - -Input: 1.5 - -strtoQ consumes 3 bytes and returns 1 -with bits = #3fff8000 0 0 0 -printf("%.35Lg") gives 1.5 -g_Qfmt(0) gives 3 bytes: "1.5" - -strtoIQ returns 1, consuming 3 bytes. -fI[0] == fI[1] = #3fff8000 0 0 0 -= 1.5 - - -Input: -1.5 - -strtoQ consumes 4 bytes and returns 9 -with bits = #bfff8000 0 0 0 -printf("%.35Lg") gives -1.5 -g_Qfmt(0) gives 4 bytes: "-1.5" - -strtoIQ returns 9, consuming 4 bytes. -fI[0] == fI[1] = #bfff8000 0 0 0 -= -1.5 - - -Input: 1.6 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff9999 99999999 99999999 99999999 -printf("%.35Lg") gives 1.5999999999999999999999999999999999 -g_Qfmt(0) gives 36 bytes: "1.5999999999999999999999999999999999" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff9999 99999999 99999999 99999999 -= 1.5999999999999999999999999999999999 -fI[1] = #3fff9999 99999999 99999999 9999999a -= 1.6000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.6 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff9999 99999999 99999999 99999999 -printf("%.35Lg") gives -1.5999999999999999999999999999999999 -g_Qfmt(0) gives 37 bytes: "-1.5999999999999999999999999999999999" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff9999 99999999 99999999 9999999a -= -1.6000000000000000000000000000000001 -fI[1] = #bfff9999 99999999 99999999 99999999 -= -1.5999999999999999999999999999999999 -fI[1] == strtod - - -Input: 1.7 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffb333 33333333 33333333 33333333 -printf("%.35Lg") gives 1.7 -g_Qfmt(0) gives 3 bytes: "1.7" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffb333 33333333 33333333 33333333 -= 1.7 -fI[1] = #3fffb333 33333333 33333333 33333334 -= 1.7000000000000000000000000000000002 -fI[0] == strtod - - -Input: -1.7 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffb333 33333333 33333333 33333333 -printf("%.35Lg") gives -1.7 -g_Qfmt(0) gives 4 bytes: "-1.7" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffb333 33333333 33333333 33333334 -= -1.7000000000000000000000000000000002 -fI[1] = #bfffb333 33333333 33333333 33333333 -= -1.7 -fI[1] == strtod - - -Input: 1.8 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffcccc cccccccc cccccccc cccccccc -printf("%.35Lg") gives 1.7999999999999999999999999999999998 -g_Qfmt(0) gives 36 bytes: "1.7999999999999999999999999999999998" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fffcccc cccccccc cccccccc cccccccc -= 1.7999999999999999999999999999999998 -fI[1] = #3fffcccc cccccccc cccccccc cccccccd -= 1.8 -fI[0] == strtod - - -Input: -1.8 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffcccc cccccccc cccccccc cccccccc -printf("%.35Lg") gives -1.7999999999999999999999999999999998 -g_Qfmt(0) gives 37 bytes: "-1.7999999999999999999999999999999998" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfffcccc cccccccc cccccccc cccccccd -= -1.8 -fI[1] = #bfffcccc cccccccc cccccccc cccccccc -= -1.7999999999999999999999999999999998 -fI[1] == strtod - - -Input: 1.9 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffe666 66666666 66666666 66666666 -printf("%.35Lg") gives 1.8999999999999999999999999999999999 -g_Qfmt(0) gives 3 bytes: "1.9" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffe666 66666666 66666666 66666666 -= 1.8999999999999999999999999999999999 -fI[1] = #3fffe666 66666666 66666666 66666667 -= 1.9000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.9 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffe666 66666666 66666666 66666666 -printf("%.35Lg") gives -1.8999999999999999999999999999999999 -g_Qfmt(0) gives 4 bytes: "-1.9" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffe666 66666666 66666666 66666667 -= -1.9000000000000000000000000000000001 -fI[1] = #bfffe666 66666666 66666666 66666666 -= -1.8999999999999999999999999999999999 -fI[1] == strtod - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff1999 99999999 99999999 9999999a -printf("%.35Lg") gives 1.1000000000000000000000000000000001 -g_Qfmt(0) gives 3 bytes: "1.1" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff1999 99999999 99999999 99999999 -= 1.0999999999999999999999999999999999 -fI[1] = #3fff1999 99999999 99999999 9999999a -= 1.1000000000000000000000000000000001 -fI[1] == strtod - - -Input: -1.1 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff1999 99999999 99999999 9999999a -printf("%.35Lg") gives -1.1000000000000000000000000000000001 -g_Qfmt(0) gives 4 bytes: "-1.1" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff1999 99999999 99999999 9999999a -= -1.1000000000000000000000000000000001 -fI[1] = #bfff1999 99999999 99999999 99999999 -= -1.0999999999999999999999999999999999 -fI[0] == strtod - - -Input: 1.2 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff3333 33333333 33333333 33333333 -printf("%.35Lg") gives 1.2 -g_Qfmt(0) gives 3 bytes: "1.2" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff3333 33333333 33333333 33333333 -= 1.2 -fI[1] = #3fff3333 33333333 33333333 33333334 -= 1.2000000000000000000000000000000002 -fI[0] == strtod - - -Input: -1.2 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff3333 33333333 33333333 33333333 -printf("%.35Lg") gives -1.2 -g_Qfmt(0) gives 4 bytes: "-1.2" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff3333 33333333 33333333 33333334 -= -1.2000000000000000000000000000000002 -fI[1] = #bfff3333 33333333 33333333 33333333 -= -1.2 -fI[1] == strtod - - -Input: 1.3 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff4ccc cccccccc cccccccc cccccccd -printf("%.35Lg") gives 1.3 -g_Qfmt(0) gives 3 bytes: "1.3" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff4ccc cccccccc cccccccc cccccccc -= 1.2999999999999999999999999999999998 -fI[1] = #3fff4ccc cccccccc cccccccc cccccccd -= 1.3 -fI[1] == strtod - - -Input: -1.3 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff4ccc cccccccc cccccccc cccccccd -printf("%.35Lg") gives -1.3 -g_Qfmt(0) gives 4 bytes: "-1.3" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff4ccc cccccccc cccccccc cccccccd -= -1.3 -fI[1] = #bfff4ccc cccccccc cccccccc cccccccc -= -1.2999999999999999999999999999999998 -fI[0] == strtod - - -Input: 1.4 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff6666 66666666 66666666 66666666 -printf("%.35Lg") gives 1.3999999999999999999999999999999999 -g_Qfmt(0) gives 3 bytes: "1.4" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff6666 66666666 66666666 66666666 -= 1.3999999999999999999999999999999999 -fI[1] = #3fff6666 66666666 66666666 66666667 -= 1.4000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.4 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff6666 66666666 66666666 66666666 -printf("%.35Lg") gives -1.3999999999999999999999999999999999 -g_Qfmt(0) gives 4 bytes: "-1.4" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff6666 66666666 66666666 66666667 -= -1.4000000000000000000000000000000001 -fI[1] = #bfff6666 66666666 66666666 66666666 -= -1.3999999999999999999999999999999999 -fI[1] == strtod - - -Input: 1.5 - -strtoQ consumes 3 bytes and returns 1 -with bits = #3fff8000 0 0 0 -printf("%.35Lg") gives 1.5 -g_Qfmt(0) gives 3 bytes: "1.5" - -strtoIQ returns 1, consuming 3 bytes. -fI[0] == fI[1] = #3fff8000 0 0 0 -= 1.5 - - -Input: -1.5 - -strtoQ consumes 4 bytes and returns 9 -with bits = #bfff8000 0 0 0 -printf("%.35Lg") gives -1.5 -g_Qfmt(0) gives 4 bytes: "-1.5" - -strtoIQ returns 9, consuming 4 bytes. -fI[0] == fI[1] = #bfff8000 0 0 0 -= -1.5 - - -Input: 1.6 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff9999 99999999 99999999 9999999a -printf("%.35Lg") gives 1.6000000000000000000000000000000001 -g_Qfmt(0) gives 3 bytes: "1.6" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff9999 99999999 99999999 99999999 -= 1.5999999999999999999999999999999999 -fI[1] = #3fff9999 99999999 99999999 9999999a -= 1.6000000000000000000000000000000001 -fI[1] == strtod - - -Input: -1.6 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff9999 99999999 99999999 9999999a -printf("%.35Lg") gives -1.6000000000000000000000000000000001 -g_Qfmt(0) gives 4 bytes: "-1.6" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff9999 99999999 99999999 9999999a -= -1.6000000000000000000000000000000001 -fI[1] = #bfff9999 99999999 99999999 99999999 -= -1.5999999999999999999999999999999999 -fI[0] == strtod - - -Input: 1.7 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffb333 33333333 33333333 33333333 -printf("%.35Lg") gives 1.7 -g_Qfmt(0) gives 3 bytes: "1.7" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffb333 33333333 33333333 33333333 -= 1.7 -fI[1] = #3fffb333 33333333 33333333 33333334 -= 1.7000000000000000000000000000000002 -fI[0] == strtod - - -Input: -1.7 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffb333 33333333 33333333 33333333 -printf("%.35Lg") gives -1.7 -g_Qfmt(0) gives 4 bytes: "-1.7" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffb333 33333333 33333333 33333334 -= -1.7000000000000000000000000000000002 -fI[1] = #bfffb333 33333333 33333333 33333333 -= -1.7 -fI[1] == strtod - - -Input: 1.8 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fffcccc cccccccc cccccccc cccccccd -printf("%.35Lg") gives 1.8 -g_Qfmt(0) gives 3 bytes: "1.8" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fffcccc cccccccc cccccccc cccccccc -= 1.7999999999999999999999999999999998 -fI[1] = #3fffcccc cccccccc cccccccc cccccccd -= 1.8 -fI[1] == strtod - - -Input: -1.8 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfffcccc cccccccc cccccccc cccccccd -printf("%.35Lg") gives -1.8 -g_Qfmt(0) gives 4 bytes: "-1.8" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfffcccc cccccccc cccccccc cccccccd -= -1.8 -fI[1] = #bfffcccc cccccccc cccccccc cccccccc -= -1.7999999999999999999999999999999998 -fI[0] == strtod - - -Input: 1.9 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffe666 66666666 66666666 66666666 -printf("%.35Lg") gives 1.8999999999999999999999999999999999 -g_Qfmt(0) gives 3 bytes: "1.9" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffe666 66666666 66666666 66666666 -= 1.8999999999999999999999999999999999 -fI[1] = #3fffe666 66666666 66666666 66666667 -= 1.9000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.9 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffe666 66666666 66666666 66666666 -printf("%.35Lg") gives -1.8999999999999999999999999999999999 -g_Qfmt(0) gives 4 bytes: "-1.9" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffe666 66666666 66666666 66666667 -= -1.9000000000000000000000000000000001 -fI[1] = #bfffe666 66666666 66666666 66666666 -= -1.8999999999999999999999999999999999 -fI[1] == strtod - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff1999 99999999 99999999 9999999a -printf("%.35Lg") gives 1.1000000000000000000000000000000001 -g_Qfmt(0) gives 3 bytes: "1.1" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff1999 99999999 99999999 99999999 -= 1.0999999999999999999999999999999999 -fI[1] = #3fff1999 99999999 99999999 9999999a -= 1.1000000000000000000000000000000001 -fI[1] == strtod - - -Input: -1.1 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff1999 99999999 99999999 99999999 -printf("%.35Lg") gives -1.0999999999999999999999999999999999 -g_Qfmt(0) gives 37 bytes: "-1.0999999999999999999999999999999999" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff1999 99999999 99999999 9999999a -= -1.1000000000000000000000000000000001 -fI[1] = #bfff1999 99999999 99999999 99999999 -= -1.0999999999999999999999999999999999 -fI[1] == strtod - - -Input: 1.2 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff3333 33333333 33333333 33333334 -printf("%.35Lg") gives 1.2000000000000000000000000000000002 -g_Qfmt(0) gives 36 bytes: "1.2000000000000000000000000000000002" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff3333 33333333 33333333 33333333 -= 1.2 -fI[1] = #3fff3333 33333333 33333333 33333334 -= 1.2000000000000000000000000000000002 -fI[1] == strtod - - -Input: -1.2 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff3333 33333333 33333333 33333333 -printf("%.35Lg") gives -1.2 -g_Qfmt(0) gives 4 bytes: "-1.2" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff3333 33333333 33333333 33333334 -= -1.2000000000000000000000000000000002 -fI[1] = #bfff3333 33333333 33333333 33333333 -= -1.2 -fI[1] == strtod - - -Input: 1.3 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff4ccc cccccccc cccccccc cccccccd -printf("%.35Lg") gives 1.3 -g_Qfmt(0) gives 3 bytes: "1.3" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff4ccc cccccccc cccccccc cccccccc -= 1.2999999999999999999999999999999998 -fI[1] = #3fff4ccc cccccccc cccccccc cccccccd -= 1.3 -fI[1] == strtod - - -Input: -1.3 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff4ccc cccccccc cccccccc cccccccc -printf("%.35Lg") gives -1.2999999999999999999999999999999998 -g_Qfmt(0) gives 37 bytes: "-1.2999999999999999999999999999999998" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff4ccc cccccccc cccccccc cccccccd -= -1.3 -fI[1] = #bfff4ccc cccccccc cccccccc cccccccc -= -1.2999999999999999999999999999999998 -fI[1] == strtod - - -Input: 1.4 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff6666 66666666 66666666 66666667 -printf("%.35Lg") gives 1.4000000000000000000000000000000001 -g_Qfmt(0) gives 36 bytes: "1.4000000000000000000000000000000001" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff6666 66666666 66666666 66666666 -= 1.3999999999999999999999999999999999 -fI[1] = #3fff6666 66666666 66666666 66666667 -= 1.4000000000000000000000000000000001 -fI[1] == strtod - - -Input: -1.4 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff6666 66666666 66666666 66666666 -printf("%.35Lg") gives -1.3999999999999999999999999999999999 -g_Qfmt(0) gives 4 bytes: "-1.4" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff6666 66666666 66666666 66666667 -= -1.4000000000000000000000000000000001 -fI[1] = #bfff6666 66666666 66666666 66666666 -= -1.3999999999999999999999999999999999 -fI[1] == strtod - - -Input: 1.5 - -strtoQ consumes 3 bytes and returns 1 -with bits = #3fff8000 0 0 0 -printf("%.35Lg") gives 1.5 -g_Qfmt(0) gives 3 bytes: "1.5" - -strtoIQ returns 1, consuming 3 bytes. -fI[0] == fI[1] = #3fff8000 0 0 0 -= 1.5 - - -Input: -1.5 - -strtoQ consumes 4 bytes and returns 9 -with bits = #bfff8000 0 0 0 -printf("%.35Lg") gives -1.5 -g_Qfmt(0) gives 4 bytes: "-1.5" - -strtoIQ returns 9, consuming 4 bytes. -fI[0] == fI[1] = #bfff8000 0 0 0 -= -1.5 - - -Input: 1.6 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fff9999 99999999 99999999 9999999a -printf("%.35Lg") gives 1.6000000000000000000000000000000001 -g_Qfmt(0) gives 3 bytes: "1.6" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff9999 99999999 99999999 99999999 -= 1.5999999999999999999999999999999999 -fI[1] = #3fff9999 99999999 99999999 9999999a -= 1.6000000000000000000000000000000001 -fI[1] == strtod - - -Input: -1.6 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfff9999 99999999 99999999 99999999 -printf("%.35Lg") gives -1.5999999999999999999999999999999999 -g_Qfmt(0) gives 37 bytes: "-1.5999999999999999999999999999999999" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff9999 99999999 99999999 9999999a -= -1.6000000000000000000000000000000001 -fI[1] = #bfff9999 99999999 99999999 99999999 -= -1.5999999999999999999999999999999999 -fI[1] == strtod - - -Input: 1.7 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fffb333 33333333 33333333 33333334 -printf("%.35Lg") gives 1.7000000000000000000000000000000002 -g_Qfmt(0) gives 36 bytes: "1.7000000000000000000000000000000002" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffb333 33333333 33333333 33333333 -= 1.7 -fI[1] = #3fffb333 33333333 33333333 33333334 -= 1.7000000000000000000000000000000002 -fI[1] == strtod - - -Input: -1.7 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffb333 33333333 33333333 33333333 -printf("%.35Lg") gives -1.7 -g_Qfmt(0) gives 4 bytes: "-1.7" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffb333 33333333 33333333 33333334 -= -1.7000000000000000000000000000000002 -fI[1] = #bfffb333 33333333 33333333 33333333 -= -1.7 -fI[1] == strtod - - -Input: 1.8 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fffcccc cccccccc cccccccc cccccccd -printf("%.35Lg") gives 1.8 -g_Qfmt(0) gives 3 bytes: "1.8" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fffcccc cccccccc cccccccc cccccccc -= 1.7999999999999999999999999999999998 -fI[1] = #3fffcccc cccccccc cccccccc cccccccd -= 1.8 -fI[1] == strtod - - -Input: -1.8 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffcccc cccccccc cccccccc cccccccc -printf("%.35Lg") gives -1.7999999999999999999999999999999998 -g_Qfmt(0) gives 37 bytes: "-1.7999999999999999999999999999999998" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfffcccc cccccccc cccccccc cccccccd -= -1.8 -fI[1] = #bfffcccc cccccccc cccccccc cccccccc -= -1.7999999999999999999999999999999998 -fI[1] == strtod - - -Input: 1.9 - -strtoQ consumes 3 bytes and returns 33 -with bits = #3fffe666 66666666 66666666 66666667 -printf("%.35Lg") gives 1.9000000000000000000000000000000001 -g_Qfmt(0) gives 36 bytes: "1.9000000000000000000000000000000001" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffe666 66666666 66666666 66666666 -= 1.8999999999999999999999999999999999 -fI[1] = #3fffe666 66666666 66666666 66666667 -= 1.9000000000000000000000000000000001 -fI[1] == strtod - - -Input: -1.9 - -strtoQ consumes 4 bytes and returns 25 -with bits = #bfffe666 66666666 66666666 66666666 -printf("%.35Lg") gives -1.8999999999999999999999999999999999 -g_Qfmt(0) gives 4 bytes: "-1.9" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffe666 66666666 66666666 66666667 -= -1.9000000000000000000000000000000001 -fI[1] = #bfffe666 66666666 66666666 66666666 -= -1.8999999999999999999999999999999999 -fI[1] == strtod - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff1999 99999999 99999999 99999999 -printf("%.35Lg") gives 1.0999999999999999999999999999999999 -g_Qfmt(0) gives 36 bytes: "1.0999999999999999999999999999999999" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff1999 99999999 99999999 99999999 -= 1.0999999999999999999999999999999999 -fI[1] = #3fff1999 99999999 99999999 9999999a -= 1.1000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.1 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff1999 99999999 99999999 9999999a -printf("%.35Lg") gives -1.1000000000000000000000000000000001 -g_Qfmt(0) gives 4 bytes: "-1.1" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff1999 99999999 99999999 9999999a -= -1.1000000000000000000000000000000001 -fI[1] = #bfff1999 99999999 99999999 99999999 -= -1.0999999999999999999999999999999999 -fI[0] == strtod - - -Input: 1.2 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff3333 33333333 33333333 33333333 -printf("%.35Lg") gives 1.2 -g_Qfmt(0) gives 3 bytes: "1.2" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff3333 33333333 33333333 33333333 -= 1.2 -fI[1] = #3fff3333 33333333 33333333 33333334 -= 1.2000000000000000000000000000000002 -fI[0] == strtod - - -Input: -1.2 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff3333 33333333 33333333 33333334 -printf("%.35Lg") gives -1.2000000000000000000000000000000002 -g_Qfmt(0) gives 37 bytes: "-1.2000000000000000000000000000000002" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff3333 33333333 33333333 33333334 -= -1.2000000000000000000000000000000002 -fI[1] = #bfff3333 33333333 33333333 33333333 -= -1.2 -fI[0] == strtod - - -Input: 1.3 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff4ccc cccccccc cccccccc cccccccc -printf("%.35Lg") gives 1.2999999999999999999999999999999998 -g_Qfmt(0) gives 36 bytes: "1.2999999999999999999999999999999998" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff4ccc cccccccc cccccccc cccccccc -= 1.2999999999999999999999999999999998 -fI[1] = #3fff4ccc cccccccc cccccccc cccccccd -= 1.3 -fI[0] == strtod - - -Input: -1.3 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff4ccc cccccccc cccccccc cccccccd -printf("%.35Lg") gives -1.3 -g_Qfmt(0) gives 4 bytes: "-1.3" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff4ccc cccccccc cccccccc cccccccd -= -1.3 -fI[1] = #bfff4ccc cccccccc cccccccc cccccccc -= -1.2999999999999999999999999999999998 -fI[0] == strtod - - -Input: 1.4 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff6666 66666666 66666666 66666666 -printf("%.35Lg") gives 1.3999999999999999999999999999999999 -g_Qfmt(0) gives 3 bytes: "1.4" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fff6666 66666666 66666666 66666666 -= 1.3999999999999999999999999999999999 -fI[1] = #3fff6666 66666666 66666666 66666667 -= 1.4000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.4 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff6666 66666666 66666666 66666667 -printf("%.35Lg") gives -1.4000000000000000000000000000000001 -g_Qfmt(0) gives 37 bytes: "-1.4000000000000000000000000000000001" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfff6666 66666666 66666666 66666667 -= -1.4000000000000000000000000000000001 -fI[1] = #bfff6666 66666666 66666666 66666666 -= -1.3999999999999999999999999999999999 -fI[0] == strtod - - -Input: 1.5 - -strtoQ consumes 3 bytes and returns 1 -with bits = #3fff8000 0 0 0 -printf("%.35Lg") gives 1.5 -g_Qfmt(0) gives 3 bytes: "1.5" - -strtoIQ returns 1, consuming 3 bytes. -fI[0] == fI[1] = #3fff8000 0 0 0 -= 1.5 - - -Input: -1.5 - -strtoQ consumes 4 bytes and returns 9 -with bits = #bfff8000 0 0 0 -printf("%.35Lg") gives -1.5 -g_Qfmt(0) gives 4 bytes: "-1.5" - -strtoIQ returns 9, consuming 4 bytes. -fI[0] == fI[1] = #bfff8000 0 0 0 -= -1.5 - - -Input: 1.6 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fff9999 99999999 99999999 99999999 -printf("%.35Lg") gives 1.5999999999999999999999999999999999 -g_Qfmt(0) gives 36 bytes: "1.5999999999999999999999999999999999" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fff9999 99999999 99999999 99999999 -= 1.5999999999999999999999999999999999 -fI[1] = #3fff9999 99999999 99999999 9999999a -= 1.6000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.6 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfff9999 99999999 99999999 9999999a -printf("%.35Lg") gives -1.6000000000000000000000000000000001 -g_Qfmt(0) gives 4 bytes: "-1.6" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfff9999 99999999 99999999 9999999a -= -1.6000000000000000000000000000000001 -fI[1] = #bfff9999 99999999 99999999 99999999 -= -1.5999999999999999999999999999999999 -fI[0] == strtod - - -Input: 1.7 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffb333 33333333 33333333 33333333 -printf("%.35Lg") gives 1.7 -g_Qfmt(0) gives 3 bytes: "1.7" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffb333 33333333 33333333 33333333 -= 1.7 -fI[1] = #3fffb333 33333333 33333333 33333334 -= 1.7000000000000000000000000000000002 -fI[0] == strtod - - -Input: -1.7 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfffb333 33333333 33333333 33333334 -printf("%.35Lg") gives -1.7000000000000000000000000000000002 -g_Qfmt(0) gives 37 bytes: "-1.7000000000000000000000000000000002" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffb333 33333333 33333333 33333334 -= -1.7000000000000000000000000000000002 -fI[1] = #bfffb333 33333333 33333333 33333333 -= -1.7 -fI[0] == strtod - - -Input: 1.8 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffcccc cccccccc cccccccc cccccccc -printf("%.35Lg") gives 1.7999999999999999999999999999999998 -g_Qfmt(0) gives 36 bytes: "1.7999999999999999999999999999999998" - -strtoIQ returns 33, consuming 3 bytes. -fI[0] = #3fffcccc cccccccc cccccccc cccccccc -= 1.7999999999999999999999999999999998 -fI[1] = #3fffcccc cccccccc cccccccc cccccccd -= 1.8 -fI[0] == strtod - - -Input: -1.8 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfffcccc cccccccc cccccccc cccccccd -printf("%.35Lg") gives -1.8 -g_Qfmt(0) gives 4 bytes: "-1.8" - -strtoIQ returns 41, consuming 4 bytes. -fI[0] = #bfffcccc cccccccc cccccccc cccccccd -= -1.8 -fI[1] = #bfffcccc cccccccc cccccccc cccccccc -= -1.7999999999999999999999999999999998 -fI[0] == strtod - - -Input: 1.9 - -strtoQ consumes 3 bytes and returns 17 -with bits = #3fffe666 66666666 66666666 66666666 -printf("%.35Lg") gives 1.8999999999999999999999999999999999 -g_Qfmt(0) gives 3 bytes: "1.9" - -strtoIQ returns 17, consuming 3 bytes. -fI[0] = #3fffe666 66666666 66666666 66666666 -= 1.8999999999999999999999999999999999 -fI[1] = #3fffe666 66666666 66666666 66666667 -= 1.9000000000000000000000000000000001 -fI[0] == strtod - - -Input: -1.9 - -strtoQ consumes 4 bytes and returns 41 -with bits = #bfffe666 66666666 66666666 66666667 -printf("%.35Lg") gives -1.9000000000000000000000000000000001 -g_Qfmt(0) gives 37 bytes: "-1.9000000000000000000000000000000001" - -strtoIQ returns 25, consuming 4 bytes. -fI[0] = #bfffe666 66666666 66666666 66666667 -= -1.9000000000000000000000000000000001 -fI[1] = #bfffe666 66666666 66666666 66666666 -= -1.8999999999999999999999999999999999 -fI[0] == strtod - diff --git a/contrib/gdtoa/test/Qtest.c b/contrib/gdtoa/test/Qtest.c deleted file mode 100644 index 14e5de7..0000000 --- a/contrib/gdtoa/test/Qtest.c +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998-2001 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -/* Test program for g_Qfmt, strtoIQ, strtopQ, and strtorQ. - * - * Inputs (on stdin): - * r rounding_mode - * n ndig - * number - * #hex0 hex1 hex2 hex3 - * - * rounding_mode values: - * 0 = toward zero - * 1 = nearest - * 2 = toward +Infinity - * 3 = toward -Infinity - * - * where number is a decimal floating-point number, - * hex0 is a string of <= 8 Hex digits for the most significant - * word of the number, hex1 is a similar string for the next - * word, etc., and ndig is a parameters to g_Qfmt. - */ - -#include "gdtoa.h" -#include -#include -#include - - extern int getround ANSI((int,char*)); - - static char ibuf[2048], obuf[2048]; -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#define _3 3 -#endif -#ifdef IEEE_8087 -#define _0 3 -#define _1 2 -#define _2 1 -#define _3 0 -#endif - -#define U (unsigned long) - - int -main(Void) -{ - char *s, *se, *se1; - int i, dItry, ndig = 0, r = 1; - union { long double d; ULong bits[4]; } u, v[2]; - - while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) { - while(*s <= ' ') - if (!*s++) - continue; - dItry = 0; - switch(*s) { - case 'r': - r = getround(r, s); - continue; - case 'n': - i = s[1]; - if (i <= ' ' || i >= '0' && i <= '9') { - ndig = atoi(s+1); - continue; - } - break; /* nan? */ - case '#': - sscanf(s+1, "%lx %lx %lx %lx", &u.bits[_0], - &u.bits[_1], &u.bits[_2], &u.bits[_3]); - printf("\nInput: %s", ibuf); - printf(" --> f = #%lx %lx %lx %lx\n", u.bits[_0], - u.bits[_1], u.bits[_2], u.bits[_3]); - goto fmt_test; - } - dItry = 1; - printf("\nInput: %s", ibuf); - i = strtorQ(ibuf, &se, r, u.bits); - if (r == 1 && (strtopQ(ibuf,&se1,v[0].bits) != i - || se != se1 || memcmp(u.bits, v[0].bits, 16))) - printf("***strtoQ and strtorQ disagree!!\n:"); - printf("\nstrtoQ consumes %d bytes and returns %d\n", - (int)(se-ibuf), i); - printf("with bits = #%lx %lx %lx %lx\n", - U u.bits[_0], U u.bits[_1], U u.bits[_2], U u.bits[_3]); - fmt_test: - if (sizeof(long double) == 16) - printf("printf(\"%%.35Lg\") gives %.35Lg\n", u.d); - se = g_Qfmt(obuf, u.bits, ndig, sizeof(obuf)); - printf("g_Qfmt(%d) gives %d bytes: \"%s\"\n\n", ndig, - (int)(se-obuf), se ? obuf : ""); - if (!dItry) - continue; - printf("strtoIQ returns %d,", - strtoIQ(ibuf, &se, v[0].bits, v[1].bits)); - printf(" consuming %d bytes.\n", (int)(se-ibuf)); - if (!memcmp(v[0].bits, v[1].bits, 16)) { - if (!memcpy(u.bits, v[0].bits, 16)) - printf("fI[0] == fI[1] == strtoQ\n"); - else { - printf("fI[0] == fI[1] = #%lx %lx %lx %lx\n", - U v[0].bits[_0], U v[0].bits[_1], - U v[0].bits[_2], U v[0].bits[_3]); - if (sizeof(long double) == 16) - printf("= %.35Lg\n", v[0].d); - } - } - else { - printf("fI[0] = #%lx %lx %lx %lx\n", - U v[0].bits[_0], U v[0].bits[_1], - U v[0].bits[_2], U v[0].bits[_3]); - if (sizeof(long double) == 16) - printf("= %.35Lg\n", v[0].d); - printf("fI[1] = #%lx %lx %lx %lx\n", - U v[1].bits[_0], U v[1].bits[_1], - U v[1].bits[_2], U v[1].bits[_3]); - if (sizeof(long double) == 16) - printf("= %.35Lg\n", v[1].d); - if (!memcmp(v[0].bits, u.bits, 16)) - printf("fI[0] == strtod\n"); - else if (!memcmp(v[1].bits, u.bits, 16)) - printf("fI[1] == strtod\n"); - else - printf("**** Both differ from strtod ****\n"); - } - printf("\n"); - } - return 0; - } diff --git a/contrib/gdtoa/test/README b/contrib/gdtoa/test/README deleted file mode 100644 index 79b1c91..0000000 --- a/contrib/gdtoa/test/README +++ /dev/null @@ -1,61 +0,0 @@ -This directory contains source for several test programs: - -dt is for conversion to/from double; it permits input of pairs of -32-bit hex integers as #hhhhhhhh hhhhhhhh (i.e., the initial '#' -indicates hex input). No initial # ==> decimal input. -After the input number is an optional : mode ndigits -(colon, and decimal integers for parameters "mode" and "ndigits" -to gdtoa). - -Qtest, ddtest, dtest, ftest, xLtest and xtest are for conversion to/from - - f IEEE single precision - d IEEE double precision - xL IEEE extended precision, as on Motorola 680x0 chips - x IEEE extended precision, as on Intel 80x87 chips or - software emulation of Motorola 680x0 chips - Q quad precision, as on Sun Sparc chips - dd double double, pairs of IEEE double numbers - whose sum is the desired value - -They're all similar, except for the precision. They test both -directed roundings and interval input (the strtoI* routines). -Lines that begin with "r" specify or interrogate the desired rounding -direction: - - 0 = toward 0 - 1 = nearest (default) - 2 = toward +Infinity - 3 = toward -Infinity - -These are the FPI_Round_* values in gdota.h. The "r" value is sticky: -it stays in effect til changed. To change the value, give a line that -starts with r followed by 0, 1, 2, or 3. To check the value, give "r" -by itself. - -Lines that begin with n followed by a number specify the ndig -argument for subsequent calls to the relevant g_*fmt routine. - -Lines that start with # followed by the appropriate number of -hexadecimal strings (see the comments) give the big-endian -internal representation of the desired number. - -When routines Qtest, xLtest, and xtest are used on machines whose -long double is of type "quad" (for Qtest) or "extended" (for x*test), -they try to print with %Lg as another way to show binary values. - -Program ddtest also accepts (white-space separated) pairs of decimal -input numbers; it converts both with strtod and feeds the result -to g_ddfmt. - -Program dItest exercises strtodI and strtoId. - -Programs dItestsi and ddtestsi are for testing the sudden-underflow -logic (on double and double-double conversions). - -Program strtodt tests strtod on some hard cases (in file testnos3) -posted by Fred Tydeman to comp.arch.arithmetic on 26 Feb. 1996. - -These are simple test programs, not meant for exhaustive testing, -but for manually testing "interesting" cases. Paxson's testbase -is good for more exhaustive testing, in part with random inputs. diff --git a/contrib/gdtoa/test/d.out b/contrib/gdtoa/test/d.out deleted file mode 100644 index a0ac991..0000000 --- a/contrib/gdtoa/test/d.out +++ /dev/null @@ -1,986 +0,0 @@ - -Input: 1.23 -strtod consumes 4 bytes and returns 17 with f = 1.23 = #3ff3ae14 7ae147ae -g_dfmt(0) gives 4 bytes: "1.23" - -strtoId returns 17, consuming 4 bytes. -fI[0] = #3ff3ae14 7ae147ae = 1.23 -fI[1] = #3ff3ae14 7ae147af = 1.2300000000000002 -fI[0] == strtod - - -Input: 1.23e+20 -strtod consumes 8 bytes and returns 1 with f = 1.23e+20 = #441aabdf 2145b430 -g_dfmt(0) gives 8 bytes: "1.23e+20" - -strtoId returns 1, consuming 8 bytes. -fI[0] == fI[1] == strtod - - -Input: 1.23e-20 -strtod consumes 8 bytes and returns 33 with f = 1.2300000000000001e-20 = #3bcd0ae4 cf767531 -g_dfmt(0) gives 8 bytes: "1.23e-20" - -strtoId returns 33, consuming 8 bytes. -fI[0] = #3bcd0ae4 cf767530 = 1.2299999999999999e-20 -fI[1] = #3bcd0ae4 cf767531 = 1.2300000000000001e-20 -fI[1] == strtod - - -Input: 1.23456789 -strtod consumes 10 bytes and returns 17 with f = 1.2345678899999999 = #3ff3c0ca 4283de1b -g_dfmt(0) gives 10 bytes: "1.23456789" - -strtoId returns 17, consuming 10 bytes. -fI[0] = #3ff3c0ca 4283de1b = 1.2345678899999999 -fI[1] = #3ff3c0ca 4283de1c = 1.2345678900000001 -fI[0] == strtod - - -Input: 1.23456589e+20 -strtod consumes 14 bytes and returns 17 with f = 1.23456589e+20 = #441ac537 a660b997 -g_dfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoId returns 17, consuming 14 bytes. -fI[0] = #441ac537 a660b997 = 1.23456589e+20 -fI[1] = #441ac537 a660b998 = 1.2345658900000001e+20 -fI[0] == strtod - - -Input: 1.23e+30 -strtod consumes 8 bytes and returns 17 with f = 1.23e+30 = #462f0cb0 4e8fb790 -g_dfmt(0) gives 8 bytes: "1.23e+30" - -strtoId returns 17, consuming 8 bytes. -fI[0] = #462f0cb0 4e8fb790 = 1.23e+30 -fI[1] = #462f0cb0 4e8fb791 = 1.2300000000000001e+30 -fI[0] == strtod - - -Input: 1.23e-30 -strtod consumes 8 bytes and returns 33 with f = 1.2300000000000001e-30 = #39b8f286 6f5010ab -g_dfmt(0) gives 8 bytes: "1.23e-30" - -strtoId returns 33, consuming 8 bytes. -fI[0] = #39b8f286 6f5010aa = 1.2299999999999999e-30 -fI[1] = #39b8f286 6f5010ab = 1.2300000000000001e-30 -fI[1] == strtod - - -Input: 1.23456789e-20 -strtod consumes 14 bytes and returns 17 with f = 1.2345678899999999e-20 = #3bcd2681 471e7ada -g_dfmt(0) gives 14 bytes: "1.23456789e-20" - -strtoId returns 17, consuming 14 bytes. -fI[0] = #3bcd2681 471e7ada = 1.2345678899999999e-20 -fI[1] = #3bcd2681 471e7adb = 1.2345678900000001e-20 -fI[0] == strtod - - -Input: 1.23456789e-30 -strtod consumes 14 bytes and returns 17 with f = 1.23456789e-30 = #39b90a3e 33bbd995 -g_dfmt(0) gives 14 bytes: "1.23456789e-30" - -strtoId returns 17, consuming 14 bytes. -fI[0] = #39b90a3e 33bbd995 = 1.23456789e-30 -fI[1] = #39b90a3e 33bbd996 = 1.2345678900000002e-30 -fI[0] == strtod - - -Input: 1.234567890123456789 -strtod consumes 20 bytes and returns 17 with f = 1.2345678901234567 = #3ff3c0ca 428c59fb -g_dfmt(0) gives 18 bytes: "1.2345678901234567" - -strtoId returns 17, consuming 20 bytes. -fI[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -fI[1] = #3ff3c0ca 428c59fc = 1.2345678901234569 -fI[0] == strtod - - -Input: 1.23456789012345678901234567890123456789 -strtod consumes 40 bytes and returns 17 with f = 1.2345678901234567 = #3ff3c0ca 428c59fb -g_dfmt(0) gives 18 bytes: "1.2345678901234567" - -strtoId returns 17, consuming 40 bytes. -fI[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -fI[1] = #3ff3c0ca 428c59fc = 1.2345678901234569 -fI[0] == strtod - - -Input: 1.23e306 -strtod consumes 8 bytes and returns 33 with f = 1.23e+306 = #7f7c0676 cd1c61f5 -g_dfmt(0) gives 9 bytes: "1.23e+306" - -strtoId returns 33, consuming 8 bytes. -fI[0] = #7f7c0676 cd1c61f4 = 1.2299999999999999e+306 -fI[1] = #7f7c0676 cd1c61f5 = 1.23e+306 -fI[1] == strtod - - -Input: 1.23e-306 -strtod consumes 9 bytes and returns 33 with f = 1.23e-306 = #6ba3b8 5da396e8 -g_dfmt(0) gives 9 bytes: "1.23e-306" - -strtoId returns 33, consuming 9 bytes. -fI[0] = #6ba3b8 5da396e7 = 1.2299999999999999e-306 -fI[1] = #6ba3b8 5da396e8 = 1.23e-306 -fI[1] == strtod - - -Input: 1.23e-320 -strtod consumes 9 bytes and returns 98 with f = 1.2302234581447039e-320 = #0 9ba -g_dfmt(0) gives 9 bytes: "1.23e-320" - -strtoId returns 98, consuming 9 bytes. -fI[0] = #0 9b9 = 1.2297293924988626e-320 -fI[1] = #0 9ba = 1.2302234581447039e-320 -fI[1] == strtod - - -Input: 1.23e-20 -strtod consumes 8 bytes and returns 33 with f = 1.2300000000000001e-20 = #3bcd0ae4 cf767531 -g_dfmt(0) gives 8 bytes: "1.23e-20" - -strtoId returns 33, consuming 8 bytes. -fI[0] = #3bcd0ae4 cf767530 = 1.2299999999999999e-20 -fI[1] = #3bcd0ae4 cf767531 = 1.2300000000000001e-20 -fI[1] == strtod - - -Input: 1.23456789e307 -strtod consumes 14 bytes and returns 33 with f = 1.23456789e+307 = #7fb194b1 4bdaecdc -g_dfmt(0) gives 15 bytes: "1.23456789e+307" - -strtoId returns 33, consuming 14 bytes. -fI[0] = #7fb194b1 4bdaecdb = 1.2345678899999998e+307 -fI[1] = #7fb194b1 4bdaecdc = 1.23456789e+307 -fI[1] == strtod - - -Input: 1.23456589e-307 -strtod consumes 15 bytes and returns 17 with f = 1.2345658899999999e-307 = #363196 bb9845fa -g_dfmt(0) gives 15 bytes: "1.23456589e-307" - -strtoId returns 17, consuming 15 bytes. -fI[0] = #363196 bb9845fa = 1.2345658899999999e-307 -fI[1] = #363196 bb9845fb = 1.2345658900000001e-307 -fI[0] == strtod - - -Input: 1.234567890123456789 -strtod consumes 20 bytes and returns 17 with f = 1.2345678901234567 = #3ff3c0ca 428c59fb -g_dfmt(0) gives 18 bytes: "1.2345678901234567" - -strtoId returns 17, consuming 20 bytes. -fI[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -fI[1] = #3ff3c0ca 428c59fc = 1.2345678901234569 -fI[0] == strtod - - -Input: 1.234567890123456789e301 -strtod consumes 24 bytes and returns 17 with f = 1.2345678901234568e+301 = #7e726f51 75f56413 -g_dfmt(0) gives 23 bytes: "1.2345678901234568e+301" - -strtoId returns 17, consuming 24 bytes. -fI[0] = #7e726f51 75f56413 = 1.2345678901234568e+301 -fI[1] = #7e726f51 75f56414 = 1.234567890123457e+301 -fI[0] == strtod - - -Input: 1.234567890123456789e-301 -strtod consumes 25 bytes and returns 17 with f = 1.2345678901234567e-301 = #1752a64 e34ba0d3 -g_dfmt(0) gives 23 bytes: "1.2345678901234567e-301" - -strtoId returns 17, consuming 25 bytes. -fI[0] = #1752a64 e34ba0d3 = 1.2345678901234567e-301 -fI[1] = #1752a64 e34ba0d4 = 1.2345678901234569e-301 -fI[0] == strtod - - -Input: 1.234567890123456789e-321 -strtod consumes 25 bytes and returns 98 with f = 1.2351641146031164e-321 = #0 fa -g_dfmt(0) gives 10 bytes: "1.235e-321" - -strtoId returns 98, consuming 25 bytes. -fI[0] = #0 f9 = 1.2302234581447039e-321 -fI[1] = #0 fa = 1.2351641146031164e-321 -fI[1] == strtod - - -Input: 1e23 -strtod consumes 4 bytes and returns 17 with f = 9.9999999999999992e+22 = #44b52d02 c7e14af6 -g_dfmt(0) gives 5 bytes: "1e+23" - -strtoId returns 17, consuming 4 bytes. -fI[0] = #44b52d02 c7e14af6 = 9.9999999999999992e+22 -fI[1] = #44b52d02 c7e14af7 = 1.0000000000000001e+23 -fI[0] == strtod - - -Input: 1e310 -strtod consumes 5 bytes and returns 163 with f = Infinity = #7ff00000 0 -g_dfmt(0) gives 8 bytes: "Infinity" - -strtoId returns 163, consuming 5 bytes. -fI[0] = #7fefffff ffffffff = 1.7976931348623157e+308 -fI[1] = #7ff00000 0 = Infinity -fI[1] == strtod - - -Input: 9.0259718793241475e-277 -strtod consumes 23 bytes and returns 33 with f = 9.0259718793241479e-277 = #6a00000 0 -g_dfmt(0) gives 22 bytes: "9.025971879324148e-277" - -strtoId returns 33, consuming 23 bytes. -fI[0] = #69fffff ffffffff = 9.0259718793241469e-277 -fI[1] = #6a00000 0 = 9.0259718793241479e-277 -fI[1] == strtod - - -Input: 9.025971879324147880346310405869e-277 -strtod consumes 37 bytes and returns 17 with f = 9.0259718793241479e-277 = #6a00000 0 -g_dfmt(0) gives 22 bytes: "9.025971879324148e-277" - -strtoId returns 17, consuming 37 bytes. -fI[0] = #6a00000 0 = 9.0259718793241479e-277 -fI[1] = #6a00000 1 = 9.0259718793241499e-277 -fI[0] == strtod - - -Input: 9.025971879324147880346310405868e-277 -strtod consumes 37 bytes and returns 33 with f = 9.0259718793241479e-277 = #6a00000 0 -g_dfmt(0) gives 22 bytes: "9.025971879324148e-277" - -strtoId returns 33, consuming 37 bytes. -fI[0] = #69fffff ffffffff = 9.0259718793241469e-277 -fI[1] = #6a00000 0 = 9.0259718793241479e-277 -fI[1] == strtod - - -Input: 2.2250738585072014e-308 -strtod consumes 23 bytes and returns 17 with f = 2.2250738585072014e-308 = #100000 0 -g_dfmt(0) gives 23 bytes: "2.2250738585072014e-308" - -strtoId returns 17, consuming 23 bytes. -fI[0] = #100000 0 = 2.2250738585072014e-308 -fI[1] = #100000 1 = 2.2250738585072019e-308 -fI[0] == strtod - - -Input: 2.2250738585072013e-308 -strtod consumes 23 bytes and returns 33 with f = 2.2250738585072014e-308 = #100000 0 -g_dfmt(0) gives 23 bytes: "2.2250738585072014e-308" - -strtoId returns 33, consuming 23 bytes. -fI[0] = #fffff ffffffff = 2.2250738585072009e-308 -fI[1] = #100000 0 = 2.2250738585072014e-308 -fI[1] == strtod - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 -strtod consumes 3 bytes and returns 17 with f = 1.0999999999999999 = #3ff19999 99999999 -g_dfmt(0) gives 18 bytes: "1.0999999999999999" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff19999 99999999 = 1.0999999999999999 -fI[1] = #3ff19999 9999999a = 1.1000000000000001 -fI[0] == strtod - - -Input: -1.1 -strtod consumes 4 bytes and returns 25 with f = -1.0999999999999999 = #bff19999 99999999 -g_dfmt(0) gives 19 bytes: "-1.0999999999999999" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff19999 9999999a = -1.1000000000000001 -fI[1] = #bff19999 99999999 = -1.0999999999999999 -fI[1] == strtod - - -Input: 1.2 -strtod consumes 3 bytes and returns 17 with f = 1.2 = #3ff33333 33333333 -g_dfmt(0) gives 3 bytes: "1.2" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ff33333 33333333 = 1.2 -fI[1] = #3ff33333 33333334 = 1.2000000000000002 -fI[0] == strtod - - -Input: -1.2 -strtod consumes 4 bytes and returns 25 with f = -1.2 = #bff33333 33333333 -g_dfmt(0) gives 4 bytes: "-1.2" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bff33333 33333334 = -1.2000000000000002 -fI[1] = #bff33333 33333333 = -1.2 -fI[1] == strtod - - -Input: 1.3 -strtod consumes 3 bytes and returns 17 with f = 1.2999999999999998 = #3ff4cccc cccccccc -g_dfmt(0) gives 18 bytes: "1.2999999999999998" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff4cccc cccccccc = 1.2999999999999998 -fI[1] = #3ff4cccc cccccccd = 1.3 -fI[0] == strtod - - -Input: -1.3 -strtod consumes 4 bytes and returns 25 with f = -1.2999999999999998 = #bff4cccc cccccccc -g_dfmt(0) gives 19 bytes: "-1.2999999999999998" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff4cccc cccccccd = -1.3 -fI[1] = #bff4cccc cccccccc = -1.2999999999999998 -fI[1] == strtod - - -Input: 1.4 -strtod consumes 3 bytes and returns 17 with f = 1.3999999999999999 = #3ff66666 66666666 -g_dfmt(0) gives 3 bytes: "1.4" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ff66666 66666666 = 1.3999999999999999 -fI[1] = #3ff66666 66666667 = 1.4000000000000001 -fI[0] == strtod - - -Input: -1.4 -strtod consumes 4 bytes and returns 25 with f = -1.3999999999999999 = #bff66666 66666666 -g_dfmt(0) gives 4 bytes: "-1.4" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bff66666 66666667 = -1.4000000000000001 -fI[1] = #bff66666 66666666 = -1.3999999999999999 -fI[1] == strtod - - -Input: 1.5 -strtod consumes 3 bytes and returns 1 with f = 1.5 = #3ff80000 0 -g_dfmt(0) gives 3 bytes: "1.5" - -strtoId returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtod - - -Input: -1.5 -strtod consumes 4 bytes and returns 9 with f = -1.5 = #bff80000 0 -g_dfmt(0) gives 4 bytes: "-1.5" - -strtoId returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtod - - -Input: 1.6 -strtod consumes 3 bytes and returns 17 with f = 1.5999999999999999 = #3ff99999 99999999 -g_dfmt(0) gives 18 bytes: "1.5999999999999999" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff99999 99999999 = 1.5999999999999999 -fI[1] = #3ff99999 9999999a = 1.6000000000000001 -fI[0] == strtod - - -Input: -1.6 -strtod consumes 4 bytes and returns 25 with f = -1.5999999999999999 = #bff99999 99999999 -g_dfmt(0) gives 19 bytes: "-1.5999999999999999" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff99999 9999999a = -1.6000000000000001 -fI[1] = #bff99999 99999999 = -1.5999999999999999 -fI[1] == strtod - - -Input: 1.7 -strtod consumes 3 bytes and returns 17 with f = 1.7 = #3ffb3333 33333333 -g_dfmt(0) gives 3 bytes: "1.7" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ffb3333 33333333 = 1.7 -fI[1] = #3ffb3333 33333334 = 1.7000000000000002 -fI[0] == strtod - - -Input: -1.7 -strtod consumes 4 bytes and returns 25 with f = -1.7 = #bffb3333 33333333 -g_dfmt(0) gives 4 bytes: "-1.7" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bffb3333 33333334 = -1.7000000000000002 -fI[1] = #bffb3333 33333333 = -1.7 -fI[1] == strtod - - -Input: 1.8 -strtod consumes 3 bytes and returns 17 with f = 1.7999999999999998 = #3ffccccc cccccccc -g_dfmt(0) gives 18 bytes: "1.7999999999999998" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ffccccc cccccccc = 1.7999999999999998 -fI[1] = #3ffccccc cccccccd = 1.8 -fI[0] == strtod - - -Input: -1.8 -strtod consumes 4 bytes and returns 25 with f = -1.7999999999999998 = #bffccccc cccccccc -g_dfmt(0) gives 19 bytes: "-1.7999999999999998" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bffccccc cccccccd = -1.8 -fI[1] = #bffccccc cccccccc = -1.7999999999999998 -fI[1] == strtod - - -Input: 1.9 -strtod consumes 3 bytes and returns 17 with f = 1.8999999999999999 = #3ffe6666 66666666 -g_dfmt(0) gives 3 bytes: "1.9" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ffe6666 66666666 = 1.8999999999999999 -fI[1] = #3ffe6666 66666667 = 1.9000000000000001 -fI[0] == strtod - - -Input: -1.9 -strtod consumes 4 bytes and returns 25 with f = -1.8999999999999999 = #bffe6666 66666666 -g_dfmt(0) gives 4 bytes: "-1.9" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bffe6666 66666667 = -1.9000000000000001 -fI[1] = #bffe6666 66666666 = -1.8999999999999999 -fI[1] == strtod - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 -strtod consumes 3 bytes and returns 33 with f = 1.1000000000000001 = #3ff19999 9999999a -g_dfmt(0) gives 3 bytes: "1.1" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff19999 99999999 = 1.0999999999999999 -fI[1] = #3ff19999 9999999a = 1.1000000000000001 -fI[1] == strtod - - -Input: -1.1 -strtod consumes 4 bytes and returns 41 with f = -1.1000000000000001 = #bff19999 9999999a -g_dfmt(0) gives 4 bytes: "-1.1" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff19999 9999999a = -1.1000000000000001 -fI[1] = #bff19999 99999999 = -1.0999999999999999 -fI[0] == strtod - - -Input: 1.2 -strtod consumes 3 bytes and returns 17 with f = 1.2 = #3ff33333 33333333 -g_dfmt(0) gives 3 bytes: "1.2" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ff33333 33333333 = 1.2 -fI[1] = #3ff33333 33333334 = 1.2000000000000002 -fI[0] == strtod - - -Input: -1.2 -strtod consumes 4 bytes and returns 25 with f = -1.2 = #bff33333 33333333 -g_dfmt(0) gives 4 bytes: "-1.2" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bff33333 33333334 = -1.2000000000000002 -fI[1] = #bff33333 33333333 = -1.2 -fI[1] == strtod - - -Input: 1.3 -strtod consumes 3 bytes and returns 33 with f = 1.3 = #3ff4cccc cccccccd -g_dfmt(0) gives 3 bytes: "1.3" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff4cccc cccccccc = 1.2999999999999998 -fI[1] = #3ff4cccc cccccccd = 1.3 -fI[1] == strtod - - -Input: -1.3 -strtod consumes 4 bytes and returns 41 with f = -1.3 = #bff4cccc cccccccd -g_dfmt(0) gives 4 bytes: "-1.3" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff4cccc cccccccd = -1.3 -fI[1] = #bff4cccc cccccccc = -1.2999999999999998 -fI[0] == strtod - - -Input: 1.4 -strtod consumes 3 bytes and returns 17 with f = 1.3999999999999999 = #3ff66666 66666666 -g_dfmt(0) gives 3 bytes: "1.4" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ff66666 66666666 = 1.3999999999999999 -fI[1] = #3ff66666 66666667 = 1.4000000000000001 -fI[0] == strtod - - -Input: -1.4 -strtod consumes 4 bytes and returns 25 with f = -1.3999999999999999 = #bff66666 66666666 -g_dfmt(0) gives 4 bytes: "-1.4" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bff66666 66666667 = -1.4000000000000001 -fI[1] = #bff66666 66666666 = -1.3999999999999999 -fI[1] == strtod - - -Input: 1.5 -strtod consumes 3 bytes and returns 1 with f = 1.5 = #3ff80000 0 -g_dfmt(0) gives 3 bytes: "1.5" - -strtoId returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtod - - -Input: -1.5 -strtod consumes 4 bytes and returns 9 with f = -1.5 = #bff80000 0 -g_dfmt(0) gives 4 bytes: "-1.5" - -strtoId returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtod - - -Input: 1.6 -strtod consumes 3 bytes and returns 33 with f = 1.6000000000000001 = #3ff99999 9999999a -g_dfmt(0) gives 3 bytes: "1.6" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff99999 99999999 = 1.5999999999999999 -fI[1] = #3ff99999 9999999a = 1.6000000000000001 -fI[1] == strtod - - -Input: -1.6 -strtod consumes 4 bytes and returns 41 with f = -1.6000000000000001 = #bff99999 9999999a -g_dfmt(0) gives 4 bytes: "-1.6" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff99999 9999999a = -1.6000000000000001 -fI[1] = #bff99999 99999999 = -1.5999999999999999 -fI[0] == strtod - - -Input: 1.7 -strtod consumes 3 bytes and returns 17 with f = 1.7 = #3ffb3333 33333333 -g_dfmt(0) gives 3 bytes: "1.7" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ffb3333 33333333 = 1.7 -fI[1] = #3ffb3333 33333334 = 1.7000000000000002 -fI[0] == strtod - - -Input: -1.7 -strtod consumes 4 bytes and returns 25 with f = -1.7 = #bffb3333 33333333 -g_dfmt(0) gives 4 bytes: "-1.7" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bffb3333 33333334 = -1.7000000000000002 -fI[1] = #bffb3333 33333333 = -1.7 -fI[1] == strtod - - -Input: 1.8 -strtod consumes 3 bytes and returns 33 with f = 1.8 = #3ffccccc cccccccd -g_dfmt(0) gives 3 bytes: "1.8" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ffccccc cccccccc = 1.7999999999999998 -fI[1] = #3ffccccc cccccccd = 1.8 -fI[1] == strtod - - -Input: -1.8 -strtod consumes 4 bytes and returns 41 with f = -1.8 = #bffccccc cccccccd -g_dfmt(0) gives 4 bytes: "-1.8" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bffccccc cccccccd = -1.8 -fI[1] = #bffccccc cccccccc = -1.7999999999999998 -fI[0] == strtod - - -Input: 1.9 -strtod consumes 3 bytes and returns 17 with f = 1.8999999999999999 = #3ffe6666 66666666 -g_dfmt(0) gives 3 bytes: "1.9" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ffe6666 66666666 = 1.8999999999999999 -fI[1] = #3ffe6666 66666667 = 1.9000000000000001 -fI[0] == strtod - - -Input: -1.9 -strtod consumes 4 bytes and returns 25 with f = -1.8999999999999999 = #bffe6666 66666666 -g_dfmt(0) gives 4 bytes: "-1.9" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bffe6666 66666667 = -1.9000000000000001 -fI[1] = #bffe6666 66666666 = -1.8999999999999999 -fI[1] == strtod - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 -strtod consumes 3 bytes and returns 33 with f = 1.1000000000000001 = #3ff19999 9999999a -g_dfmt(0) gives 3 bytes: "1.1" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff19999 99999999 = 1.0999999999999999 -fI[1] = #3ff19999 9999999a = 1.1000000000000001 -fI[1] == strtod - - -Input: -1.1 -strtod consumes 4 bytes and returns 25 with f = -1.0999999999999999 = #bff19999 99999999 -g_dfmt(0) gives 19 bytes: "-1.0999999999999999" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff19999 9999999a = -1.1000000000000001 -fI[1] = #bff19999 99999999 = -1.0999999999999999 -fI[1] == strtod - - -Input: 1.2 -strtod consumes 3 bytes and returns 33 with f = 1.2000000000000002 = #3ff33333 33333334 -g_dfmt(0) gives 18 bytes: "1.2000000000000002" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ff33333 33333333 = 1.2 -fI[1] = #3ff33333 33333334 = 1.2000000000000002 -fI[1] == strtod - - -Input: -1.2 -strtod consumes 4 bytes and returns 25 with f = -1.2 = #bff33333 33333333 -g_dfmt(0) gives 4 bytes: "-1.2" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bff33333 33333334 = -1.2000000000000002 -fI[1] = #bff33333 33333333 = -1.2 -fI[1] == strtod - - -Input: 1.3 -strtod consumes 3 bytes and returns 33 with f = 1.3 = #3ff4cccc cccccccd -g_dfmt(0) gives 3 bytes: "1.3" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff4cccc cccccccc = 1.2999999999999998 -fI[1] = #3ff4cccc cccccccd = 1.3 -fI[1] == strtod - - -Input: -1.3 -strtod consumes 4 bytes and returns 25 with f = -1.2999999999999998 = #bff4cccc cccccccc -g_dfmt(0) gives 19 bytes: "-1.2999999999999998" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff4cccc cccccccd = -1.3 -fI[1] = #bff4cccc cccccccc = -1.2999999999999998 -fI[1] == strtod - - -Input: 1.4 -strtod consumes 3 bytes and returns 33 with f = 1.4000000000000001 = #3ff66666 66666667 -g_dfmt(0) gives 18 bytes: "1.4000000000000001" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ff66666 66666666 = 1.3999999999999999 -fI[1] = #3ff66666 66666667 = 1.4000000000000001 -fI[1] == strtod - - -Input: -1.4 -strtod consumes 4 bytes and returns 25 with f = -1.3999999999999999 = #bff66666 66666666 -g_dfmt(0) gives 4 bytes: "-1.4" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bff66666 66666667 = -1.4000000000000001 -fI[1] = #bff66666 66666666 = -1.3999999999999999 -fI[1] == strtod - - -Input: 1.5 -strtod consumes 3 bytes and returns 1 with f = 1.5 = #3ff80000 0 -g_dfmt(0) gives 3 bytes: "1.5" - -strtoId returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtod - - -Input: -1.5 -strtod consumes 4 bytes and returns 9 with f = -1.5 = #bff80000 0 -g_dfmt(0) gives 4 bytes: "-1.5" - -strtoId returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtod - - -Input: 1.6 -strtod consumes 3 bytes and returns 33 with f = 1.6000000000000001 = #3ff99999 9999999a -g_dfmt(0) gives 3 bytes: "1.6" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff99999 99999999 = 1.5999999999999999 -fI[1] = #3ff99999 9999999a = 1.6000000000000001 -fI[1] == strtod - - -Input: -1.6 -strtod consumes 4 bytes and returns 25 with f = -1.5999999999999999 = #bff99999 99999999 -g_dfmt(0) gives 19 bytes: "-1.5999999999999999" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff99999 9999999a = -1.6000000000000001 -fI[1] = #bff99999 99999999 = -1.5999999999999999 -fI[1] == strtod - - -Input: 1.7 -strtod consumes 3 bytes and returns 33 with f = 1.7000000000000002 = #3ffb3333 33333334 -g_dfmt(0) gives 18 bytes: "1.7000000000000002" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ffb3333 33333333 = 1.7 -fI[1] = #3ffb3333 33333334 = 1.7000000000000002 -fI[1] == strtod - - -Input: -1.7 -strtod consumes 4 bytes and returns 25 with f = -1.7 = #bffb3333 33333333 -g_dfmt(0) gives 4 bytes: "-1.7" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bffb3333 33333334 = -1.7000000000000002 -fI[1] = #bffb3333 33333333 = -1.7 -fI[1] == strtod - - -Input: 1.8 -strtod consumes 3 bytes and returns 33 with f = 1.8 = #3ffccccc cccccccd -g_dfmt(0) gives 3 bytes: "1.8" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ffccccc cccccccc = 1.7999999999999998 -fI[1] = #3ffccccc cccccccd = 1.8 -fI[1] == strtod - - -Input: -1.8 -strtod consumes 4 bytes and returns 25 with f = -1.7999999999999998 = #bffccccc cccccccc -g_dfmt(0) gives 19 bytes: "-1.7999999999999998" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bffccccc cccccccd = -1.8 -fI[1] = #bffccccc cccccccc = -1.7999999999999998 -fI[1] == strtod - - -Input: 1.9 -strtod consumes 3 bytes and returns 33 with f = 1.9000000000000001 = #3ffe6666 66666667 -g_dfmt(0) gives 18 bytes: "1.9000000000000001" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ffe6666 66666666 = 1.8999999999999999 -fI[1] = #3ffe6666 66666667 = 1.9000000000000001 -fI[1] == strtod - - -Input: -1.9 -strtod consumes 4 bytes and returns 25 with f = -1.8999999999999999 = #bffe6666 66666666 -g_dfmt(0) gives 4 bytes: "-1.9" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bffe6666 66666667 = -1.9000000000000001 -fI[1] = #bffe6666 66666666 = -1.8999999999999999 -fI[1] == strtod - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 -strtod consumes 3 bytes and returns 17 with f = 1.0999999999999999 = #3ff19999 99999999 -g_dfmt(0) gives 18 bytes: "1.0999999999999999" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff19999 99999999 = 1.0999999999999999 -fI[1] = #3ff19999 9999999a = 1.1000000000000001 -fI[0] == strtod - - -Input: -1.1 -strtod consumes 4 bytes and returns 41 with f = -1.1000000000000001 = #bff19999 9999999a -g_dfmt(0) gives 4 bytes: "-1.1" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff19999 9999999a = -1.1000000000000001 -fI[1] = #bff19999 99999999 = -1.0999999999999999 -fI[0] == strtod - - -Input: 1.2 -strtod consumes 3 bytes and returns 17 with f = 1.2 = #3ff33333 33333333 -g_dfmt(0) gives 3 bytes: "1.2" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ff33333 33333333 = 1.2 -fI[1] = #3ff33333 33333334 = 1.2000000000000002 -fI[0] == strtod - - -Input: -1.2 -strtod consumes 4 bytes and returns 41 with f = -1.2000000000000002 = #bff33333 33333334 -g_dfmt(0) gives 19 bytes: "-1.2000000000000002" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bff33333 33333334 = -1.2000000000000002 -fI[1] = #bff33333 33333333 = -1.2 -fI[0] == strtod - - -Input: 1.3 -strtod consumes 3 bytes and returns 17 with f = 1.2999999999999998 = #3ff4cccc cccccccc -g_dfmt(0) gives 18 bytes: "1.2999999999999998" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff4cccc cccccccc = 1.2999999999999998 -fI[1] = #3ff4cccc cccccccd = 1.3 -fI[0] == strtod - - -Input: -1.3 -strtod consumes 4 bytes and returns 41 with f = -1.3 = #bff4cccc cccccccd -g_dfmt(0) gives 4 bytes: "-1.3" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff4cccc cccccccd = -1.3 -fI[1] = #bff4cccc cccccccc = -1.2999999999999998 -fI[0] == strtod - - -Input: 1.4 -strtod consumes 3 bytes and returns 17 with f = 1.3999999999999999 = #3ff66666 66666666 -g_dfmt(0) gives 3 bytes: "1.4" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ff66666 66666666 = 1.3999999999999999 -fI[1] = #3ff66666 66666667 = 1.4000000000000001 -fI[0] == strtod - - -Input: -1.4 -strtod consumes 4 bytes and returns 41 with f = -1.4000000000000001 = #bff66666 66666667 -g_dfmt(0) gives 19 bytes: "-1.4000000000000001" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bff66666 66666667 = -1.4000000000000001 -fI[1] = #bff66666 66666666 = -1.3999999999999999 -fI[0] == strtod - - -Input: 1.5 -strtod consumes 3 bytes and returns 1 with f = 1.5 = #3ff80000 0 -g_dfmt(0) gives 3 bytes: "1.5" - -strtoId returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtod - - -Input: -1.5 -strtod consumes 4 bytes and returns 9 with f = -1.5 = #bff80000 0 -g_dfmt(0) gives 4 bytes: "-1.5" - -strtoId returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtod - - -Input: 1.6 -strtod consumes 3 bytes and returns 17 with f = 1.5999999999999999 = #3ff99999 99999999 -g_dfmt(0) gives 18 bytes: "1.5999999999999999" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ff99999 99999999 = 1.5999999999999999 -fI[1] = #3ff99999 9999999a = 1.6000000000000001 -fI[0] == strtod - - -Input: -1.6 -strtod consumes 4 bytes and returns 41 with f = -1.6000000000000001 = #bff99999 9999999a -g_dfmt(0) gives 4 bytes: "-1.6" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bff99999 9999999a = -1.6000000000000001 -fI[1] = #bff99999 99999999 = -1.5999999999999999 -fI[0] == strtod - - -Input: 1.7 -strtod consumes 3 bytes and returns 17 with f = 1.7 = #3ffb3333 33333333 -g_dfmt(0) gives 3 bytes: "1.7" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ffb3333 33333333 = 1.7 -fI[1] = #3ffb3333 33333334 = 1.7000000000000002 -fI[0] == strtod - - -Input: -1.7 -strtod consumes 4 bytes and returns 41 with f = -1.7000000000000002 = #bffb3333 33333334 -g_dfmt(0) gives 19 bytes: "-1.7000000000000002" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bffb3333 33333334 = -1.7000000000000002 -fI[1] = #bffb3333 33333333 = -1.7 -fI[0] == strtod - - -Input: 1.8 -strtod consumes 3 bytes and returns 17 with f = 1.7999999999999998 = #3ffccccc cccccccc -g_dfmt(0) gives 18 bytes: "1.7999999999999998" - -strtoId returns 33, consuming 3 bytes. -fI[0] = #3ffccccc cccccccc = 1.7999999999999998 -fI[1] = #3ffccccc cccccccd = 1.8 -fI[0] == strtod - - -Input: -1.8 -strtod consumes 4 bytes and returns 41 with f = -1.8 = #bffccccc cccccccd -g_dfmt(0) gives 4 bytes: "-1.8" - -strtoId returns 41, consuming 4 bytes. -fI[0] = #bffccccc cccccccd = -1.8 -fI[1] = #bffccccc cccccccc = -1.7999999999999998 -fI[0] == strtod - - -Input: 1.9 -strtod consumes 3 bytes and returns 17 with f = 1.8999999999999999 = #3ffe6666 66666666 -g_dfmt(0) gives 3 bytes: "1.9" - -strtoId returns 17, consuming 3 bytes. -fI[0] = #3ffe6666 66666666 = 1.8999999999999999 -fI[1] = #3ffe6666 66666667 = 1.9000000000000001 -fI[0] == strtod - - -Input: -1.9 -strtod consumes 4 bytes and returns 41 with f = -1.9000000000000001 = #bffe6666 66666667 -g_dfmt(0) gives 19 bytes: "-1.9000000000000001" - -strtoId returns 25, consuming 4 bytes. -fI[0] = #bffe6666 66666667 = -1.9000000000000001 -fI[1] = #bffe6666 66666666 = -1.8999999999999999 -fI[0] == strtod - diff --git a/contrib/gdtoa/test/dI.out b/contrib/gdtoa/test/dI.out deleted file mode 100644 index b4070de..0000000 --- a/contrib/gdtoa/test/dI.out +++ /dev/null @@ -1,168 +0,0 @@ - -Input: 1.23 -strtodI consumes 4 bytes and returns 17 -dd[0] = #3ff3ae14 7ae147ae = 1.23 -dd[1] = #3ff3ae14 7ae147af = 1.2300000000000002 - - -Input: 1.23e+20 -strtodI consumes 8 bytes and returns 1 -dd[0] = #441aabdf 2145b430 = 1.23e+20 -dd[1] = #441aabdf 2145b430 = 1.23e+20 - - -Input: 1.23e-20 -strtodI consumes 8 bytes and returns 33 -dd[0] = #3bcd0ae4 cf767530 = 1.2299999999999999e-20 -dd[1] = #3bcd0ae4 cf767531 = 1.23e-20 - - -Input: 1.23456789 -strtodI consumes 10 bytes and returns 17 -dd[0] = #3ff3c0ca 4283de1b = 1.23456789 -dd[1] = #3ff3c0ca 4283de1c = 1.2345678900000001 - - -Input: 1.23456589e+20 -strtodI consumes 14 bytes and returns 17 -dd[0] = #441ac537 a660b997 = 1.23456589e+20 -dd[1] = #441ac537 a660b998 = 123456589000000010000 - - -Input: 1.23e+30 -strtodI consumes 8 bytes and returns 17 -dd[0] = #462f0cb0 4e8fb790 = 1.23e+30 -dd[1] = #462f0cb0 4e8fb791 = 1.2300000000000001e+30 - - -Input: 1.23e-30 -strtodI consumes 8 bytes and returns 33 -dd[0] = #39b8f286 6f5010aa = 1.2299999999999999e-30 -dd[1] = #39b8f286 6f5010ab = 1.23e-30 - - -Input: 1.23456789e-20 -strtodI consumes 14 bytes and returns 17 -dd[0] = #3bcd2681 471e7ada = 1.23456789e-20 -dd[1] = #3bcd2681 471e7adb = 1.2345678900000001e-20 - - -Input: 1.23456789e-30 -strtodI consumes 14 bytes and returns 17 -dd[0] = #39b90a3e 33bbd995 = 1.23456789e-30 -dd[1] = #39b90a3e 33bbd996 = 1.2345678900000002e-30 - - -Input: 1.234567890123456789 -strtodI consumes 20 bytes and returns 17 -dd[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -dd[1] = #3ff3c0ca 428c59fc = 1.234567890123457 - - -Input: 1.23456789012345678901234567890123456789 -strtodI consumes 40 bytes and returns 17 -dd[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -dd[1] = #3ff3c0ca 428c59fc = 1.234567890123457 - - -Input: 1.23e306 -strtodI consumes 8 bytes and returns 33 -dd[0] = #7f7c0676 cd1c61f4 = 1.2299999999999999e+306 -dd[1] = #7f7c0676 cd1c61f5 = 1.23e+306 - - -Input: 1.23e-306 -strtodI consumes 9 bytes and returns 33 -dd[0] = #6ba3b8 5da396e7 = 1.2299999999999999e-306 -dd[1] = #6ba3b8 5da396e8 = 1.23e-306 - - -Input: 1.23e-320 -strtodI consumes 9 bytes and returns 98 -dd[0] = #0 9b9 = 1.2297e-320 -dd[1] = #0 9ba = 1.23e-320 - - -Input: 1.23e-20 -strtodI consumes 8 bytes and returns 33 -dd[0] = #3bcd0ae4 cf767530 = 1.2299999999999999e-20 -dd[1] = #3bcd0ae4 cf767531 = 1.23e-20 - - -Input: 1.23456789e307 -strtodI consumes 14 bytes and returns 33 -dd[0] = #7fb194b1 4bdaecdb = 1.2345678899999998e+307 -dd[1] = #7fb194b1 4bdaecdc = 1.23456789e+307 - - -Input: 1.23456589e-307 -strtodI consumes 15 bytes and returns 17 -dd[0] = #363196 bb9845fa = 1.23456589e-307 -dd[1] = #363196 bb9845fb = 1.2345658900000001e-307 - - -Input: 1.234567890123456789 -strtodI consumes 20 bytes and returns 17 -dd[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -dd[1] = #3ff3c0ca 428c59fc = 1.234567890123457 - - -Input: 1.234567890123456789e301 -strtodI consumes 24 bytes and returns 17 -dd[0] = #7e726f51 75f56413 = 1.2345678901234568e+301 -dd[1] = #7e726f51 75f56414 = 1.234567890123457e+301 - - -Input: 1.234567890123456789e-301 -strtodI consumes 25 bytes and returns 17 -dd[0] = #1752a64 e34ba0d3 = 1.2345678901234567e-301 -dd[1] = #1752a64 e34ba0d4 = 1.234567890123457e-301 - - -Input: 1.234567890123456789e-321 -strtodI consumes 25 bytes and returns 98 -dd[0] = #0 f9 = 1.23e-321 -dd[1] = #0 fa = 1.235e-321 - - -Input: 1e23 -strtodI consumes 4 bytes and returns 17 -dd[0] = #44b52d02 c7e14af6 = 1e+23 -dd[1] = #44b52d02 c7e14af7 = 1.0000000000000001e+23 - - -Input: 1e310 -strtodI consumes 5 bytes and returns 163 -dd[0] = #7fefffff ffffffff = 1.7976931348623157e+308 -dd[1] = #7ff00000 0 = Infinity - - -Input: 9.0259718793241475e-277 -strtodI consumes 23 bytes and returns 33 -dd[0] = #69fffff ffffffff = 9.025971879324147e-277 -dd[1] = #6a00000 0 = 9.025971879324148e-277 - - -Input: 9.025971879324147880346310405869e-277 -strtodI consumes 37 bytes and returns 17 -dd[0] = #6a00000 0 = 9.025971879324148e-277 -dd[1] = #6a00000 1 = 9.02597187932415e-277 - - -Input: 9.025971879324147880346310405868e-277 -strtodI consumes 37 bytes and returns 33 -dd[0] = #69fffff ffffffff = 9.025971879324147e-277 -dd[1] = #6a00000 0 = 9.025971879324148e-277 - - -Input: 2.2250738585072014e-308 -strtodI consumes 23 bytes and returns 17 -dd[0] = #100000 0 = 2.2250738585072014e-308 -dd[1] = #100000 1 = 2.225073858507202e-308 - - -Input: 2.2250738585072013e-308 -strtodI consumes 23 bytes and returns 33 -dd[0] = #fffff ffffffff = 2.225073858507201e-308 -dd[1] = #100000 0 = 2.2250738585072014e-308 - diff --git a/contrib/gdtoa/test/dIsi.out b/contrib/gdtoa/test/dIsi.out deleted file mode 100644 index 3388a1a..0000000 --- a/contrib/gdtoa/test/dIsi.out +++ /dev/null @@ -1,168 +0,0 @@ - -Input: 1.23 -strtodI consumes 4 bytes and returns 17 -dd[0] = #3ff3ae14 7ae147ae = 1.23 -dd[1] = #3ff3ae14 7ae147af = 1.2300000000000002 - - -Input: 1.23e+20 -strtodI consumes 8 bytes and returns 1 -dd[0] = #441aabdf 2145b430 = 1.23e+20 -dd[1] = #441aabdf 2145b430 = 1.23e+20 - - -Input: 1.23e-20 -strtodI consumes 8 bytes and returns 33 -dd[0] = #3bcd0ae4 cf767530 = 1.2299999999999999e-20 -dd[1] = #3bcd0ae4 cf767531 = 1.23e-20 - - -Input: 1.23456789 -strtodI consumes 10 bytes and returns 17 -dd[0] = #3ff3c0ca 4283de1b = 1.23456789 -dd[1] = #3ff3c0ca 4283de1c = 1.2345678900000001 - - -Input: 1.23456589e+20 -strtodI consumes 14 bytes and returns 17 -dd[0] = #441ac537 a660b997 = 1.23456589e+20 -dd[1] = #441ac537 a660b998 = 123456589000000010000 - - -Input: 1.23e+30 -strtodI consumes 8 bytes and returns 17 -dd[0] = #462f0cb0 4e8fb790 = 1.23e+30 -dd[1] = #462f0cb0 4e8fb791 = 1.2300000000000001e+30 - - -Input: 1.23e-30 -strtodI consumes 8 bytes and returns 33 -dd[0] = #39b8f286 6f5010aa = 1.2299999999999999e-30 -dd[1] = #39b8f286 6f5010ab = 1.23e-30 - - -Input: 1.23456789e-20 -strtodI consumes 14 bytes and returns 17 -dd[0] = #3bcd2681 471e7ada = 1.23456789e-20 -dd[1] = #3bcd2681 471e7adb = 1.2345678900000001e-20 - - -Input: 1.23456789e-30 -strtodI consumes 14 bytes and returns 17 -dd[0] = #39b90a3e 33bbd995 = 1.23456789e-30 -dd[1] = #39b90a3e 33bbd996 = 1.2345678900000002e-30 - - -Input: 1.234567890123456789 -strtodI consumes 20 bytes and returns 17 -dd[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -dd[1] = #3ff3c0ca 428c59fc = 1.234567890123457 - - -Input: 1.23456789012345678901234567890123456789 -strtodI consumes 40 bytes and returns 17 -dd[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -dd[1] = #3ff3c0ca 428c59fc = 1.234567890123457 - - -Input: 1.23e306 -strtodI consumes 8 bytes and returns 33 -dd[0] = #7f7c0676 cd1c61f4 = 1.2299999999999999e+306 -dd[1] = #7f7c0676 cd1c61f5 = 1.23e+306 - - -Input: 1.23e-306 -strtodI consumes 9 bytes and returns 33 -dd[0] = #6ba3b8 5da396e7 = 1.2299999999999999e-306 -dd[1] = #6ba3b8 5da396e8 = 1.23e-306 - - -Input: 1.23e-320 -strtodI consumes 9 bytes and returns 80 -dd[0] = #0 0 = 0 -dd[1] = #100000 0 = 2.2250738585072014e-308 - - -Input: 1.23e-20 -strtodI consumes 8 bytes and returns 33 -dd[0] = #3bcd0ae4 cf767530 = 1.2299999999999999e-20 -dd[1] = #3bcd0ae4 cf767531 = 1.23e-20 - - -Input: 1.23456789e307 -strtodI consumes 14 bytes and returns 33 -dd[0] = #7fb194b1 4bdaecdb = 1.2345678899999998e+307 -dd[1] = #7fb194b1 4bdaecdc = 1.23456789e+307 - - -Input: 1.23456589e-307 -strtodI consumes 15 bytes and returns 17 -dd[0] = #363196 bb9845fa = 1.23456589e-307 -dd[1] = #363196 bb9845fb = 1.2345658900000001e-307 - - -Input: 1.234567890123456789 -strtodI consumes 20 bytes and returns 17 -dd[0] = #3ff3c0ca 428c59fb = 1.2345678901234567 -dd[1] = #3ff3c0ca 428c59fc = 1.234567890123457 - - -Input: 1.234567890123456789e301 -strtodI consumes 24 bytes and returns 17 -dd[0] = #7e726f51 75f56413 = 1.2345678901234568e+301 -dd[1] = #7e726f51 75f56414 = 1.234567890123457e+301 - - -Input: 1.234567890123456789e-301 -strtodI consumes 25 bytes and returns 17 -dd[0] = #1752a64 e34ba0d3 = 1.2345678901234567e-301 -dd[1] = #1752a64 e34ba0d4 = 1.234567890123457e-301 - - -Input: 1.234567890123456789e-321 -strtodI consumes 25 bytes and returns 80 -dd[0] = #0 0 = 0 -dd[1] = #100000 0 = 2.2250738585072014e-308 - - -Input: 1e23 -strtodI consumes 4 bytes and returns 17 -dd[0] = #44b52d02 c7e14af6 = 1e+23 -dd[1] = #44b52d02 c7e14af7 = 1.0000000000000001e+23 - - -Input: 1e310 -strtodI consumes 5 bytes and returns 163 -dd[0] = #7fefffff ffffffff = 1.7976931348623157e+308 -dd[1] = #7ff00000 0 = Infinity - - -Input: 9.0259718793241475e-277 -strtodI consumes 23 bytes and returns 33 -dd[0] = #69fffff ffffffff = 9.025971879324147e-277 -dd[1] = #6a00000 0 = 9.025971879324148e-277 - - -Input: 9.025971879324147880346310405869e-277 -strtodI consumes 37 bytes and returns 17 -dd[0] = #6a00000 0 = 9.025971879324148e-277 -dd[1] = #6a00000 1 = 9.02597187932415e-277 - - -Input: 9.025971879324147880346310405868e-277 -strtodI consumes 37 bytes and returns 33 -dd[0] = #69fffff ffffffff = 9.025971879324147e-277 -dd[1] = #6a00000 0 = 9.025971879324148e-277 - - -Input: 2.2250738585072014e-308 -strtodI consumes 23 bytes and returns 17 -dd[0] = #100000 0 = 2.2250738585072014e-308 -dd[1] = #100000 1 = 2.225073858507202e-308 - - -Input: 2.2250738585072013e-308 -strtodI consumes 23 bytes and returns 33 -dd[0] = #0 0 = 0 -dd[1] = #100000 0 = 2.2250738585072014e-308 - diff --git a/contrib/gdtoa/test/dItest.c b/contrib/gdtoa/test/dItest.c deleted file mode 100644 index d9b56d5..0000000 --- a/contrib/gdtoa/test/dItest.c +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998, 2001 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -#include "gdtoaimp.h" -#include -#include - - static char ibuf[2048]; - -#define U (unsigned long) - - static void -#ifdef KR_headers -dshow(what, d) char *what; double d; -#else -dshow(char *what, double d) -#endif -{ - char buf[32]; - g_dfmt(buf, &d, 0, sizeof(buf)); - printf("%s = #%lx %lx = %s\n", what, - U ((ULong*)&d)[_0], U ((ULong*)&d)[_1], buf); - } - - int -main(Void) -{ - /* Input: one number per line */ - - char *s, *se, *se1; - int i, j; - double dd[2], dd1, dd2; - static char cfmt[] = "%s consumes %d bytes and returns %d\n"; - - while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) { - while(*s <= ' ') - if (!*s++) - continue; - printf("\nInput: %s", ibuf); - i = strtodI(ibuf, &se, dd); - printf(cfmt, "strtodI", (int)(se-ibuf), i); - dshow("dd[0]", dd[0]); - dshow("dd[1]", dd[1]); - printf("\n"); - j = strtoId(ibuf, &se1, &dd1, &dd2); - if (j != i || se != se1 - || dd[0] != dd1 || dd[1] != dd2) { - printf(cfmt, "**** strtoId", (int)(se-ibuf), j); - dshow("dd1", dd1); - dshow("dd2", dd2); - } - } - return 0; - } diff --git a/contrib/gdtoa/test/dd.out b/contrib/gdtoa/test/dd.out deleted file mode 100644 index b1d2744..0000000 --- a/contrib/gdtoa/test/dd.out +++ /dev/null @@ -1,1356 +0,0 @@ - -Input: 1.23 -strtopdd consumes 4 bytes and returns 17 -dd[0] = 1.23 = #3ff3ae14 7ae147ae -dd[1] = 1.7763568394002496e-17 = #3c747ae1 47ae1478 -g_ddfmt(0) gives 4 bytes: "1.23" - -strtoIdd returns 17, consuming 4 bytes. -ddI[0] = #3ff3ae14 7ae147ae + 3c747ae1 47ae1478 -= 1.23 + 1.7763568394002496e-17 -ddI[1] = #3ff3ae14 7ae147ae + 3c747ae1 47ae1480 -= 1.23 + 1.776356839400252e-17 -ddI[0] == strtod - - -Input: 1.23e+20 -strtopdd consumes 8 bytes and returns 1 -dd[0] = 1.23e+20 = #441aabdf 2145b430 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 8 bytes: "1.23e+20" - -strtoIdd returns 1, consuming 8 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.23e-20 -strtopdd consumes 8 bytes and returns 33 -dd[0] = 1.2299999999999999e-20 = #3bcd0ae4 cf767530 -dd[1] = 9.304023318521521e-37 = #3873c997 955b2691 -g_ddfmt(0) gives 8 bytes: "1.23e-20" - -strtoIdd returns 33, consuming 8 bytes. -ddI[0] = #3bcd0ae4 cf767530 + 3873c997 955b2690 -= 1.2299999999999999e-20 + 9.3040233185215194e-37 -ddI[1] = #3bcd0ae4 cf767530 + 3873c997 955b2691 -= 1.2299999999999999e-20 + 9.3040233185215211e-37 -ddI[1] == strtod - - -Input: 1.23456789 -strtopdd consumes 10 bytes and returns 17 -dd[0] = 1.23456789 = #3ff3c0ca 4283de1b -dd[1] = 1.0990618193318369e-16 = #3c9fada5 144c1252 -g_ddfmt(0) gives 10 bytes: "1.23456789" - -strtoIdd returns 17, consuming 10 bytes. -ddI[0] = #3ff3c0ca 4283de1b + 3c9fada5 144c1252 -= 1.2345678899999999 + 1.0990618193318369e-16 -ddI[1] = #3ff3c0ca 4283de1b + 3c9fada5 144c1254 -= 1.2345678899999999 + 1.0990618193318371e-16 -ddI[0] == strtod - - -Input: 1.23456589e+20 -strtopdd consumes 14 bytes and returns 1 -dd[0] = 1.23456589e+20 = #441ac537 a660b997 -dd[1] = 4096 = #40b00000 0 -g_ddfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoIdd returns 1, consuming 14 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.23e+30 -strtopdd consumes 8 bytes and returns 1 -dd[0] = 1.23e+30 = #462f0cb0 4e8fb790 -dd[1] = 40281156091904 = #42c25158 0 -g_ddfmt(0) gives 8 bytes: "1.23e+30" - -strtoIdd returns 1, consuming 8 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.23e-30 -strtopdd consumes 8 bytes and returns 17 -dd[0] = 1.2299999999999999e-30 = #39b8f286 6f5010aa -dd[1] = 1.076909723013918e-46 = #3663ac7f 3dafd174 -g_ddfmt(0) gives 8 bytes: "1.23e-30" - -strtoIdd returns 17, consuming 8 bytes. -ddI[0] = #39b8f286 6f5010aa + 3663ac7f 3dafd174 -= 1.2299999999999999e-30 + 1.076909723013918e-46 -ddI[1] = #39b8f286 6f5010aa + 3663ac7f 3dafd175 -= 1.2299999999999999e-30 + 1.0769097230139181e-46 -ddI[0] == strtod - - -Input: 1.23456789e-20 -strtopdd consumes 14 bytes and returns 17 -dd[0] = 1.23456789e-20 = #3bcd2681 471e7ada -dd[1] = 6.247111971663133e-37 = #386a9280 a761b07e -g_ddfmt(0) gives 14 bytes: "1.23456789e-20" - -strtoIdd returns 17, consuming 14 bytes. -ddI[0] = #3bcd2681 471e7ada + 386a9280 a761b07e -= 1.2345678899999999e-20 + 6.2471119716631328e-37 -ddI[1] = #3bcd2681 471e7ada + 386a9280 a761b080 -= 1.2345678899999999e-20 + 6.2471119716631345e-37 -ddI[0] == strtod - - -Input: 1.23456789e-30 -strtopdd consumes 14 bytes and returns 33 -dd[0] = 1.23456789e-30 = #39b90a3e 33bbd995 -dd[1] = 2.1567930523648577e-47 = #363f8585 55a6b1a0 -g_ddfmt(0) gives 14 bytes: "1.23456789e-30" - -strtoIdd returns 33, consuming 14 bytes. -ddI[0] = #39b90a3e 33bbd995 + 363f8585 55a6b198 -= 1.23456789e-30 + 2.1567930523648558e-47 -ddI[1] = #39b90a3e 33bbd995 + 363f8585 55a6b1a0 -= 1.23456789e-30 + 2.1567930523648577e-47 -ddI[1] == strtod - - -Input: 1.234567890123456789 -strtopdd consumes 20 bytes and returns 33 -dd[0] = 1.2345678901234567 = #3ff3c0ca 428c59fb -dd[1] = 9.856786452588859e-17 = #3c9c6906 51a3745e -g_ddfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIdd returns 33, consuming 20 bytes. -ddI[0] = #3ff3c0ca 428c59fb + 3c9c6906 51a3745c -= 1.2345678901234567 + 9.8567864525888563e-17 -ddI[1] = #3ff3c0ca 428c59fb + 3c9c6906 51a3745e -= 1.2345678901234567 + 9.8567864525888588e-17 -ddI[1] == strtod - - -Input: 1.23456789012345678901234567890123456789 -strtopdd consumes 40 bytes and returns 33 -dd[0] = 1.2345678901234567 = #3ff3c0ca 428c59fb -dd[1] = 9.858021020478982e-17 = #3c9c69ef 85adadb6 -g_ddfmt(0) gives 34 bytes: "1.23456789012345678901234567890124" - -strtoIdd returns 33, consuming 40 bytes. -ddI[0] = #3ff3c0ca 428c59fb + 3c9c69ef 85adadb4 -= 1.2345678901234567 + 9.8580210204789798e-17 -ddI[1] = #3ff3c0ca 428c59fb + 3c9c69ef 85adadb6 -= 1.2345678901234567 + 9.8580210204789823e-17 -ddI[1] == strtod - - -Input: 1.23e306 -strtopdd consumes 8 bytes and returns 33 -dd[0] = 1.2299999999999999e+306 = #7f7c0676 cd1c61f4 -dd[1] = 1.3319001448659015e+290 = #7c2b558b e3d3f477 -g_ddfmt(0) gives 9 bytes: "1.23e+306" - -strtoIdd returns 33, consuming 8 bytes. -ddI[0] = #7f7c0676 cd1c61f4 + 7c2b558b e3d3f476 -= 1.2299999999999999e+306 + 1.3319001448659013e+290 -ddI[1] = #7f7c0676 cd1c61f4 + 7c2b558b e3d3f477 -= 1.2299999999999999e+306 + 1.3319001448659015e+290 -ddI[1] == strtod - - -Input: 1.23e-306 -strtopdd consumes 9 bytes and returns 98 -dd[0] = 1.2299999999999999e-306 = #6ba3b8 5da396e7 -dd[1] = 1.43e-322 = #0 1d -g_ddfmt(0) gives 9 bytes: "1.23e-306" - -strtoIdd returns 98, consuming 9 bytes. -ddI[0] = #6ba3b8 5da396e7 + 0 1c -= 1.2299999999999999e-306 + 1.3833838083554903e-322 -ddI[1] = #6ba3b8 5da396e7 + 0 1d -= 1.2299999999999999e-306 + 1.432790372939615e-322 -ddI[1] == strtod - - -Input: 1.23e-320 -strtopdd consumes 9 bytes and returns 98 -dd[0] = 1.23e-320 = #0 9ba -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 9 bytes: "1.23e-320" - -strtoIdd returns 98, consuming 9 bytes. -ddI[0] = #0 9b9 + 0 0 -= 1.2297293924988626e-320 + 0 -ddI[1] = #0 9ba + 0 0 -= 1.2302234581447039e-320 + 0 -ddI[1] == strtod - - -Input: 1.23e-20 -strtopdd consumes 8 bytes and returns 33 -dd[0] = 1.2299999999999999e-20 = #3bcd0ae4 cf767530 -dd[1] = 9.304023318521521e-37 = #3873c997 955b2691 -g_ddfmt(0) gives 8 bytes: "1.23e-20" - -strtoIdd returns 33, consuming 8 bytes. -ddI[0] = #3bcd0ae4 cf767530 + 3873c997 955b2690 -= 1.2299999999999999e-20 + 9.3040233185215194e-37 -ddI[1] = #3bcd0ae4 cf767530 + 3873c997 955b2691 -= 1.2299999999999999e-20 + 9.3040233185215211e-37 -ddI[1] == strtod - - -Input: 1.23456789e307 -strtopdd consumes 14 bytes and returns 33 -dd[0] = 1.2345678899999998e+307 = #7fb194b1 4bdaecdb -dd[1] = 2.0137933598720243e+291 = #7c69d48d 192048ca -g_ddfmt(0) gives 15 bytes: "1.23456789e+307" - -strtoIdd returns 33, consuming 14 bytes. -ddI[0] = #7fb194b1 4bdaecdb + 7c69d48d 192048c9 -= 1.2345678899999998e+307 + 2.013793359872024e+291 -ddI[1] = #7fb194b1 4bdaecdb + 7c69d48d 192048ca -= 1.2345678899999998e+307 + 2.0137933598720243e+291 -ddI[1] == strtod - - -Input: 1.23456589e-307 -strtopdd consumes 15 bytes and returns 98 -dd[0] = 1.23456589e-307 = #363196 bb9845fa -dd[1] = 1e-323 = #0 2 -g_ddfmt(0) gives 15 bytes: "1.23456589e-307" - -strtoIdd returns 98, consuming 15 bytes. -ddI[0] = #363196 bb9845fa + 0 1 -= 1.2345658899999999e-307 + 4.9406564584124654e-324 -ddI[1] = #363196 bb9845fa + 0 2 -= 1.2345658899999999e-307 + 9.8813129168249309e-324 -ddI[1] == strtod - - -Input: 1.234567890123456789 -strtopdd consumes 20 bytes and returns 33 -dd[0] = 1.2345678901234567 = #3ff3c0ca 428c59fb -dd[1] = 9.856786452588859e-17 = #3c9c6906 51a3745e -g_ddfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIdd returns 33, consuming 20 bytes. -ddI[0] = #3ff3c0ca 428c59fb + 3c9c6906 51a3745c -= 1.2345678901234567 + 9.8567864525888563e-17 -ddI[1] = #3ff3c0ca 428c59fb + 3c9c6906 51a3745e -= 1.2345678901234567 + 9.8567864525888588e-17 -ddI[1] == strtod - - -Input: 1.234567890123456789e301 -strtopdd consumes 24 bytes and returns 33 -dd[0] = 1.2345678901234568e+301 = #7e726f51 75f56413 -dd[1] = 1.3892003943918827e+283 = #7ab7ea80 76399100 -g_ddfmt(0) gives 25 bytes: "1.234567890123456789e+301" - -strtoIdd returns 33, consuming 24 bytes. -ddI[0] = #7e726f51 75f56413 + 7ab7ea80 76399080 -= 1.2345678901234568e+301 + 1.3892003943918563e+283 -ddI[1] = #7e726f51 75f56413 + 7ab7ea80 76399100 -= 1.2345678901234568e+301 + 1.3892003943918827e+283 -ddI[1] == strtod - - -Input: 1.234567890123456789e-301 -strtopdd consumes 25 bytes and returns 82 -dd[0] = 1.2345678901234567e-301 = #1752a64 e34ba0d3 -dd[1] = 7.374365e-318 = #0 16c66c -g_ddfmt(0) gives 25 bytes: "1.234567890123456789e-301" - -strtoIdd returns 82, consuming 25 bytes. -ddI[0] = #1752a64 e34ba0d3 + 0 16c66c -= 1.2345678901234567e-301 + 7.374364541948945e-318 -ddI[1] = #1752a64 e34ba0d3 + 0 16c66d -= 1.2345678901234567e-301 + 7.3743694826054034e-318 -ddI[0] == strtod - - -Input: 1.234567890123456789e-321 -strtopdd consumes 25 bytes and returns 98 -dd[0] = 1.235e-321 = #0 fa -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 10 bytes: "1.235e-321" - -strtoIdd returns 98, consuming 25 bytes. -ddI[0] = #0 f9 + 0 0 -= 1.2302234581447039e-321 + 0 -ddI[1] = #0 fa + 0 0 -= 1.2351641146031164e-321 + 0 -ddI[1] == strtod - - -Input: 1e23 -strtopdd consumes 4 bytes and returns 1 -dd[0] = 1e+23 = #44b52d02 c7e14af6 -dd[1] = 8388608 = #41600000 0 -g_ddfmt(0) gives 5 bytes: "1e+23" - -strtoIdd returns 1, consuming 4 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1e310 -strtopdd consumes 5 bytes and returns 163 -dd[0] = Infinity = #7ff00000 0 -dd[1] = Infinity = #7ff00000 0 -g_ddfmt(0) gives 8 bytes: "Infinity" - -strtoIdd returns 163, consuming 5 bytes. -ddI[0] = #7fefffff ffffffff + 7c9fffff ffffffff -= 1.7976931348623157e+308 + 1.9958403095347196e+292 -ddI[1] = #7ff00000 0 + 7ff00000 0 -= Infinity + Infinity -ddI[1] == strtod - - -Input: 9.0259718793241475e-277 -strtopdd consumes 23 bytes and returns 33 -dd[0] = 9.025971879324147e-277 = #69fffff ffffffff -dd[1] = 6.217378695986177e-293 = #343daae f3582320 -g_ddfmt(0) gives 23 bytes: "9.0259718793241475e-277" - -strtoIdd returns 33, consuming 23 bytes. -ddI[0] = #69fffff ffffffff + 343daae f358231f -= 9.0259718793241469e-277 + 6.2173786959861757e-293 -ddI[1] = #69fffff ffffffff + 343daae f3582320 -= 9.0259718793241469e-277 + 6.2173786959861768e-293 -ddI[1] == strtod - - -Input: 9.025971879324147880346310405869e-277 -strtopdd consumes 37 bytes and returns 17 -dd[0] = 9.025971879324148e-277 = #6a00000 0 -dd[1] = 2.2250738585072014e-308 = #100000 0 -g_ddfmt(0) gives 37 bytes: "9.025971879324147880346310405869e-277" - -strtoIdd returns 17, consuming 37 bytes. -ddI[0] = #6a00000 0 + 100000 0 -= 9.0259718793241479e-277 + 2.2250738585072014e-308 -ddI[1] = #6a00000 0 + 200000 0 -= 9.0259718793241479e-277 + 4.4501477170144028e-308 -ddI[0] == strtod - - -Input: 9.025971879324147880346310405868e-277 -strtopdd consumes 37 bytes and returns 17 -dd[0] = 9.025971879324147e-277 = #69fffff ffffffff -dd[1] = 1.0020841800044856e-292 = #34fffff fffffff9 -g_ddfmt(0) gives 37 bytes: "9.025971879324147880346310405868e-277" - -strtoIdd returns 17, consuming 37 bytes. -ddI[0] = #69fffff ffffffff + 34fffff fffffff9 -= 9.0259718793241469e-277 + 1.0020841800044856e-292 -ddI[1] = #69fffff ffffffff + 34fffff fffffffa -= 9.0259718793241469e-277 + 1.0020841800044857e-292 -ddI[0] == strtod - - -Input: 2.2250738585072014e-308 -strtopdd consumes 23 bytes and returns 82 -dd[0] = 2.2250738585072014e-308 = #100000 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 23 bytes: "2.2250738585072014e-308" - -strtoIdd returns 82, consuming 23 bytes. -ddI[0] = #100000 0 + 0 0 -= 2.2250738585072014e-308 + 0 -ddI[1] = #100000 1 + 0 0 -= 2.2250738585072019e-308 + 0 -ddI[0] == strtod - - -Input: 2.2250738585072013e-308 -strtopdd consumes 23 bytes and returns 98 -dd[0] = 2.2250738585072014e-308 = #100000 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 23 bytes: "2.2250738585072014e-308" - -strtoIdd returns 98, consuming 23 bytes. -ddI[0] = #fffff ffffffff + 0 0 -= 2.2250738585072009e-308 + 0 -ddI[1] = #100000 0 + 0 0 -= 2.2250738585072014e-308 + 0 -ddI[1] == strtod - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.0999999999999999 = #3ff19999 99999999 -dd[1] = 1.3322676295501878e-16 = #3ca33333 33333333 -g_ddfmt(0) gives 3 bytes: "1.1" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff19999 99999999 + 3ca33333 33333333 -= 1.0999999999999999 + 1.3322676295501878e-16 -ddI[1] = #3ff19999 99999999 + 3ca33333 33333334 -= 1.0999999999999999 + 1.332267629550188e-16 -ddI[0] == strtod - - -Input: -1.1 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.0999999999999999 = #bff19999 99999999 -dd[1] = -1.3322676295501878e-16 = #bca33333 33333333 -g_ddfmt(0) gives 4 bytes: "-1.1" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff19999 99999999 + bca33333 33333334 -= -1.0999999999999999 + -1.332267629550188e-16 -ddI[1] = #bff19999 99999999 + bca33333 33333333 -= -1.0999999999999999 + -1.3322676295501878e-16 -ddI[1] == strtod - - -Input: 1.2 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.2 = #3ff33333 33333333 -dd[1] = 4.440892098500625e-17 = #3c899999 99999998 -g_ddfmt(0) gives 3 bytes: "1.2" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff33333 33333333 + 3c899999 99999998 -= 1.2 + 4.4408920985006252e-17 -ddI[1] = #3ff33333 33333333 + 3c899999 9999999c -= 1.2 + 4.4408920985006276e-17 -ddI[0] == strtod - - -Input: -1.2 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.2 = #bff33333 33333333 -dd[1] = -4.440892098500625e-17 = #bc899999 99999998 -g_ddfmt(0) gives 4 bytes: "-1.2" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff33333 33333333 + bc899999 9999999c -= -1.2 + -4.4408920985006276e-17 -ddI[1] = #bff33333 33333333 + bc899999 99999998 -= -1.2 + -4.4408920985006252e-17 -ddI[1] == strtod - - -Input: 1.3 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.2999999999999998 = #3ff4cccc cccccccc -dd[1] = 1.7763568394002503e-16 = #3ca99999 99999999 -g_ddfmt(0) gives 34 bytes: "1.29999999999999999999999999999999" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ff4cccc cccccccc + 3ca99999 99999999 -= 1.2999999999999998 + 1.7763568394002503e-16 -ddI[1] = #3ff4cccc cccccccc + 3ca99999 9999999a -= 1.2999999999999998 + 1.7763568394002506e-16 -ddI[0] == strtod - - -Input: -1.3 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.2999999999999998 = #bff4cccc cccccccc -dd[1] = -1.7763568394002503e-16 = #bca99999 99999999 -g_ddfmt(0) gives 35 bytes: "-1.29999999999999999999999999999999" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bff4cccc cccccccc + bca99999 9999999a -= -1.2999999999999998 + -1.7763568394002506e-16 -ddI[1] = #bff4cccc cccccccc + bca99999 99999999 -= -1.2999999999999998 + -1.7763568394002503e-16 -ddI[1] == strtod - - -Input: 1.4 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.4 = #3ff66666 66666666 -dd[1] = 8.88178419700125e-17 = #3c999999 99999998 -g_ddfmt(0) gives 34 bytes: "1.39999999999999999999999999999998" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ff66666 66666666 + 3c999999 99999998 -= 1.3999999999999999 + 8.8817841970012504e-17 -ddI[1] = #3ff66666 66666666 + 3c999999 9999999a -= 1.3999999999999999 + 8.8817841970012528e-17 -ddI[0] == strtod - - -Input: -1.4 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.4 = #bff66666 66666666 -dd[1] = -8.88178419700125e-17 = #bc999999 99999998 -g_ddfmt(0) gives 35 bytes: "-1.39999999999999999999999999999998" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bff66666 66666666 + bc999999 9999999a -= -1.3999999999999999 + -8.8817841970012528e-17 -ddI[1] = #bff66666 66666666 + bc999999 99999998 -= -1.3999999999999999 + -8.8817841970012504e-17 -ddI[1] == strtod - - -Input: 1.5 -strtopdd consumes 3 bytes and returns 1 -dd[0] = 1.5 = #3ff80000 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 3 bytes: "1.5" - -strtoIdd returns 1, consuming 3 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: -1.5 -strtopdd consumes 4 bytes and returns 9 -dd[0] = -1.5 = #bff80000 0 -dd[1] = -0 = #80000000 0 -g_ddfmt(0) gives 3 bytes: "1.5" - -strtoIdd returns 9, consuming 4 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.6 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.5999999999999999 = #3ff99999 99999999 -dd[1] = 1.3322676295501878e-16 = #3ca33333 33333333 -g_ddfmt(0) gives 3 bytes: "1.6" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff99999 99999999 + 3ca33333 33333333 -= 1.5999999999999999 + 1.3322676295501878e-16 -ddI[1] = #3ff99999 99999999 + 3ca33333 33333334 -= 1.5999999999999999 + 1.332267629550188e-16 -ddI[0] == strtod - - -Input: -1.6 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.5999999999999999 = #bff99999 99999999 -dd[1] = -1.3322676295501878e-16 = #bca33333 33333333 -g_ddfmt(0) gives 4 bytes: "-1.6" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff99999 99999999 + bca33333 33333334 -= -1.5999999999999999 + -1.332267629550188e-16 -ddI[1] = #bff99999 99999999 + bca33333 33333333 -= -1.5999999999999999 + -1.3322676295501878e-16 -ddI[1] == strtod - - -Input: 1.7 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.7 = #3ffb3333 33333333 -dd[1] = 4.440892098500625e-17 = #3c899999 99999998 -g_ddfmt(0) gives 3 bytes: "1.7" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ffb3333 33333333 + 3c899999 99999998 -= 1.7 + 4.4408920985006252e-17 -ddI[1] = #3ffb3333 33333333 + 3c899999 9999999c -= 1.7 + 4.4408920985006276e-17 -ddI[0] == strtod - - -Input: -1.7 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.7 = #bffb3333 33333333 -dd[1] = -4.440892098500625e-17 = #bc899999 99999998 -g_ddfmt(0) gives 4 bytes: "-1.7" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bffb3333 33333333 + bc899999 9999999c -= -1.7 + -4.4408920985006276e-17 -ddI[1] = #bffb3333 33333333 + bc899999 99999998 -= -1.7 + -4.4408920985006252e-17 -ddI[1] == strtod - - -Input: 1.8 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.7999999999999998 = #3ffccccc cccccccc -dd[1] = 1.7763568394002503e-16 = #3ca99999 99999999 -g_ddfmt(0) gives 34 bytes: "1.79999999999999999999999999999999" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ffccccc cccccccc + 3ca99999 99999999 -= 1.7999999999999998 + 1.7763568394002503e-16 -ddI[1] = #3ffccccc cccccccc + 3ca99999 9999999a -= 1.7999999999999998 + 1.7763568394002506e-16 -ddI[0] == strtod - - -Input: -1.8 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.7999999999999998 = #bffccccc cccccccc -dd[1] = -1.7763568394002503e-16 = #bca99999 99999999 -g_ddfmt(0) gives 35 bytes: "-1.79999999999999999999999999999999" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bffccccc cccccccc + bca99999 9999999a -= -1.7999999999999998 + -1.7763568394002506e-16 -ddI[1] = #bffccccc cccccccc + bca99999 99999999 -= -1.7999999999999998 + -1.7763568394002503e-16 -ddI[1] == strtod - - -Input: 1.9 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.9 = #3ffe6666 66666666 -dd[1] = 8.88178419700125e-17 = #3c999999 99999998 -g_ddfmt(0) gives 34 bytes: "1.89999999999999999999999999999998" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ffe6666 66666666 + 3c999999 99999998 -= 1.8999999999999999 + 8.8817841970012504e-17 -ddI[1] = #3ffe6666 66666666 + 3c999999 9999999a -= 1.8999999999999999 + 8.8817841970012528e-17 -ddI[0] == strtod - - -Input: -1.9 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.9 = #bffe6666 66666666 -dd[1] = -8.88178419700125e-17 = #bc999999 99999998 -g_ddfmt(0) gives 35 bytes: "-1.89999999999999999999999999999998" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bffe6666 66666666 + bc999999 9999999a -= -1.8999999999999999 + -8.8817841970012528e-17 -ddI[1] = #bffe6666 66666666 + bc999999 99999998 -= -1.8999999999999999 + -8.8817841970012504e-17 -ddI[1] == strtod - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.0999999999999999 = #3ff19999 99999999 -dd[1] = 1.3322676295501878e-16 = #3ca33333 33333333 -g_ddfmt(0) gives 3 bytes: "1.1" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff19999 99999999 + 3ca33333 33333333 -= 1.0999999999999999 + 1.3322676295501878e-16 -ddI[1] = #3ff19999 99999999 + 3ca33333 33333334 -= 1.0999999999999999 + 1.332267629550188e-16 -ddI[0] == strtod - - -Input: -1.1 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.0999999999999999 = #bff19999 99999999 -dd[1] = -1.3322676295501878e-16 = #bca33333 33333333 -g_ddfmt(0) gives 4 bytes: "-1.1" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff19999 99999999 + bca33333 33333334 -= -1.0999999999999999 + -1.332267629550188e-16 -ddI[1] = #bff19999 99999999 + bca33333 33333333 -= -1.0999999999999999 + -1.3322676295501878e-16 -ddI[1] == strtod - - -Input: 1.2 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.2 = #3ff33333 33333333 -dd[1] = 4.440892098500625e-17 = #3c899999 99999998 -g_ddfmt(0) gives 3 bytes: "1.2" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff33333 33333333 + 3c899999 99999998 -= 1.2 + 4.4408920985006252e-17 -ddI[1] = #3ff33333 33333333 + 3c899999 9999999c -= 1.2 + 4.4408920985006276e-17 -ddI[0] == strtod - - -Input: -1.2 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.2 = #bff33333 33333333 -dd[1] = -4.440892098500625e-17 = #bc899999 99999998 -g_ddfmt(0) gives 4 bytes: "-1.2" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff33333 33333333 + bc899999 9999999c -= -1.2 + -4.4408920985006276e-17 -ddI[1] = #bff33333 33333333 + bc899999 99999998 -= -1.2 + -4.4408920985006252e-17 -ddI[1] == strtod - - -Input: 1.3 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.2999999999999998 = #3ff4cccc cccccccc -dd[1] = 1.7763568394002506e-16 = #3ca99999 9999999a -g_ddfmt(0) gives 3 bytes: "1.3" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ff4cccc cccccccc + 3ca99999 99999999 -= 1.2999999999999998 + 1.7763568394002503e-16 -ddI[1] = #3ff4cccc cccccccc + 3ca99999 9999999a -= 1.2999999999999998 + 1.7763568394002506e-16 -ddI[1] == strtod - - -Input: -1.3 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.2999999999999998 = #bff4cccc cccccccc -dd[1] = -1.7763568394002506e-16 = #bca99999 9999999a -g_ddfmt(0) gives 4 bytes: "-1.3" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bff4cccc cccccccc + bca99999 9999999a -= -1.2999999999999998 + -1.7763568394002506e-16 -ddI[1] = #bff4cccc cccccccc + bca99999 99999999 -= -1.2999999999999998 + -1.7763568394002503e-16 -ddI[0] == strtod - - -Input: 1.4 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.4 = #3ff66666 66666666 -dd[1] = 8.881784197001253e-17 = #3c999999 9999999a -g_ddfmt(0) gives 3 bytes: "1.4" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ff66666 66666666 + 3c999999 99999998 -= 1.3999999999999999 + 8.8817841970012504e-17 -ddI[1] = #3ff66666 66666666 + 3c999999 9999999a -= 1.3999999999999999 + 8.8817841970012528e-17 -ddI[1] == strtod - - -Input: -1.4 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.4 = #bff66666 66666666 -dd[1] = -8.881784197001253e-17 = #bc999999 9999999a -g_ddfmt(0) gives 4 bytes: "-1.4" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bff66666 66666666 + bc999999 9999999a -= -1.3999999999999999 + -8.8817841970012528e-17 -ddI[1] = #bff66666 66666666 + bc999999 99999998 -= -1.3999999999999999 + -8.8817841970012504e-17 -ddI[0] == strtod - - -Input: 1.5 -strtopdd consumes 3 bytes and returns 1 -dd[0] = 1.5 = #3ff80000 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 3 bytes: "1.5" - -strtoIdd returns 1, consuming 3 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: -1.5 -strtopdd consumes 4 bytes and returns 9 -dd[0] = -1.5 = #bff80000 0 -dd[1] = -0 = #80000000 0 -g_ddfmt(0) gives 3 bytes: "1.5" - -strtoIdd returns 9, consuming 4 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.6 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.5999999999999999 = #3ff99999 99999999 -dd[1] = 1.3322676295501878e-16 = #3ca33333 33333333 -g_ddfmt(0) gives 3 bytes: "1.6" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff99999 99999999 + 3ca33333 33333333 -= 1.5999999999999999 + 1.3322676295501878e-16 -ddI[1] = #3ff99999 99999999 + 3ca33333 33333334 -= 1.5999999999999999 + 1.332267629550188e-16 -ddI[0] == strtod - - -Input: -1.6 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.5999999999999999 = #bff99999 99999999 -dd[1] = -1.3322676295501878e-16 = #bca33333 33333333 -g_ddfmt(0) gives 4 bytes: "-1.6" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff99999 99999999 + bca33333 33333334 -= -1.5999999999999999 + -1.332267629550188e-16 -ddI[1] = #bff99999 99999999 + bca33333 33333333 -= -1.5999999999999999 + -1.3322676295501878e-16 -ddI[1] == strtod - - -Input: 1.7 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.7 = #3ffb3333 33333333 -dd[1] = 4.440892098500625e-17 = #3c899999 99999998 -g_ddfmt(0) gives 3 bytes: "1.7" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ffb3333 33333333 + 3c899999 99999998 -= 1.7 + 4.4408920985006252e-17 -ddI[1] = #3ffb3333 33333333 + 3c899999 9999999c -= 1.7 + 4.4408920985006276e-17 -ddI[0] == strtod - - -Input: -1.7 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.7 = #bffb3333 33333333 -dd[1] = -4.440892098500625e-17 = #bc899999 99999998 -g_ddfmt(0) gives 4 bytes: "-1.7" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bffb3333 33333333 + bc899999 9999999c -= -1.7 + -4.4408920985006276e-17 -ddI[1] = #bffb3333 33333333 + bc899999 99999998 -= -1.7 + -4.4408920985006252e-17 -ddI[1] == strtod - - -Input: 1.8 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.7999999999999998 = #3ffccccc cccccccc -dd[1] = 1.7763568394002506e-16 = #3ca99999 9999999a -g_ddfmt(0) gives 3 bytes: "1.8" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ffccccc cccccccc + 3ca99999 99999999 -= 1.7999999999999998 + 1.7763568394002503e-16 -ddI[1] = #3ffccccc cccccccc + 3ca99999 9999999a -= 1.7999999999999998 + 1.7763568394002506e-16 -ddI[1] == strtod - - -Input: -1.8 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.7999999999999998 = #bffccccc cccccccc -dd[1] = -1.7763568394002506e-16 = #bca99999 9999999a -g_ddfmt(0) gives 4 bytes: "-1.8" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bffccccc cccccccc + bca99999 9999999a -= -1.7999999999999998 + -1.7763568394002506e-16 -ddI[1] = #bffccccc cccccccc + bca99999 99999999 -= -1.7999999999999998 + -1.7763568394002503e-16 -ddI[0] == strtod - - -Input: 1.9 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.9 = #3ffe6666 66666666 -dd[1] = 8.881784197001253e-17 = #3c999999 9999999a -g_ddfmt(0) gives 3 bytes: "1.9" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ffe6666 66666666 + 3c999999 99999998 -= 1.8999999999999999 + 8.8817841970012504e-17 -ddI[1] = #3ffe6666 66666666 + 3c999999 9999999a -= 1.8999999999999999 + 8.8817841970012528e-17 -ddI[1] == strtod - - -Input: -1.9 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.9 = #bffe6666 66666666 -dd[1] = -8.881784197001253e-17 = #bc999999 9999999a -g_ddfmt(0) gives 4 bytes: "-1.9" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bffe6666 66666666 + bc999999 9999999a -= -1.8999999999999999 + -8.8817841970012528e-17 -ddI[1] = #bffe6666 66666666 + bc999999 99999998 -= -1.8999999999999999 + -8.8817841970012504e-17 -ddI[0] == strtod - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.0999999999999999 = #3ff19999 99999999 -dd[1] = 1.332267629550188e-16 = #3ca33333 33333334 -g_ddfmt(0) gives 34 bytes: "1.10000000000000000000000000000002" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff19999 99999999 + 3ca33333 33333333 -= 1.0999999999999999 + 1.3322676295501878e-16 -ddI[1] = #3ff19999 99999999 + 3ca33333 33333334 -= 1.0999999999999999 + 1.332267629550188e-16 -ddI[1] == strtod - - -Input: -1.1 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.0999999999999999 = #bff19999 99999999 -dd[1] = -1.3322676295501878e-16 = #bca33333 33333333 -g_ddfmt(0) gives 4 bytes: "-1.1" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff19999 99999999 + bca33333 33333334 -= -1.0999999999999999 + -1.332267629550188e-16 -ddI[1] = #bff19999 99999999 + bca33333 33333333 -= -1.0999999999999999 + -1.3322676295501878e-16 -ddI[1] == strtod - - -Input: 1.2 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.2 = #3ff33333 33333333 -dd[1] = 4.4408920985006276e-17 = #3c899999 9999999c -g_ddfmt(0) gives 34 bytes: "1.20000000000000000000000000000001" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff33333 33333333 + 3c899999 99999998 -= 1.2 + 4.4408920985006252e-17 -ddI[1] = #3ff33333 33333333 + 3c899999 9999999c -= 1.2 + 4.4408920985006276e-17 -ddI[1] == strtod - - -Input: -1.2 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.2 = #bff33333 33333333 -dd[1] = -4.440892098500625e-17 = #bc899999 99999998 -g_ddfmt(0) gives 4 bytes: "-1.2" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff33333 33333333 + bc899999 9999999c -= -1.2 + -4.4408920985006276e-17 -ddI[1] = #bff33333 33333333 + bc899999 99999998 -= -1.2 + -4.4408920985006252e-17 -ddI[1] == strtod - - -Input: 1.3 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.2999999999999998 = #3ff4cccc cccccccc -dd[1] = 1.7763568394002506e-16 = #3ca99999 9999999a -g_ddfmt(0) gives 3 bytes: "1.3" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ff4cccc cccccccc + 3ca99999 99999999 -= 1.2999999999999998 + 1.7763568394002503e-16 -ddI[1] = #3ff4cccc cccccccc + 3ca99999 9999999a -= 1.2999999999999998 + 1.7763568394002506e-16 -ddI[1] == strtod - - -Input: -1.3 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.2999999999999998 = #bff4cccc cccccccc -dd[1] = -1.7763568394002503e-16 = #bca99999 99999999 -g_ddfmt(0) gives 35 bytes: "-1.29999999999999999999999999999999" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bff4cccc cccccccc + bca99999 9999999a -= -1.2999999999999998 + -1.7763568394002506e-16 -ddI[1] = #bff4cccc cccccccc + bca99999 99999999 -= -1.2999999999999998 + -1.7763568394002503e-16 -ddI[1] == strtod - - -Input: 1.4 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.4 = #3ff66666 66666666 -dd[1] = 8.881784197001253e-17 = #3c999999 9999999a -g_ddfmt(0) gives 3 bytes: "1.4" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ff66666 66666666 + 3c999999 99999998 -= 1.3999999999999999 + 8.8817841970012504e-17 -ddI[1] = #3ff66666 66666666 + 3c999999 9999999a -= 1.3999999999999999 + 8.8817841970012528e-17 -ddI[1] == strtod - - -Input: -1.4 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.4 = #bff66666 66666666 -dd[1] = -8.88178419700125e-17 = #bc999999 99999998 -g_ddfmt(0) gives 35 bytes: "-1.39999999999999999999999999999998" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bff66666 66666666 + bc999999 9999999a -= -1.3999999999999999 + -8.8817841970012528e-17 -ddI[1] = #bff66666 66666666 + bc999999 99999998 -= -1.3999999999999999 + -8.8817841970012504e-17 -ddI[1] == strtod - - -Input: 1.5 -strtopdd consumes 3 bytes and returns 1 -dd[0] = 1.5 = #3ff80000 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 3 bytes: "1.5" - -strtoIdd returns 1, consuming 3 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: -1.5 -strtopdd consumes 4 bytes and returns 9 -dd[0] = -1.5 = #bff80000 0 -dd[1] = -0 = #80000000 0 -g_ddfmt(0) gives 3 bytes: "1.5" - -strtoIdd returns 9, consuming 4 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.6 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.5999999999999999 = #3ff99999 99999999 -dd[1] = 1.332267629550188e-16 = #3ca33333 33333334 -g_ddfmt(0) gives 34 bytes: "1.60000000000000000000000000000002" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff99999 99999999 + 3ca33333 33333333 -= 1.5999999999999999 + 1.3322676295501878e-16 -ddI[1] = #3ff99999 99999999 + 3ca33333 33333334 -= 1.5999999999999999 + 1.332267629550188e-16 -ddI[1] == strtod - - -Input: -1.6 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.5999999999999999 = #bff99999 99999999 -dd[1] = -1.3322676295501878e-16 = #bca33333 33333333 -g_ddfmt(0) gives 4 bytes: "-1.6" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff99999 99999999 + bca33333 33333334 -= -1.5999999999999999 + -1.332267629550188e-16 -ddI[1] = #bff99999 99999999 + bca33333 33333333 -= -1.5999999999999999 + -1.3322676295501878e-16 -ddI[1] == strtod - - -Input: 1.7 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.7 = #3ffb3333 33333333 -dd[1] = 4.4408920985006276e-17 = #3c899999 9999999c -g_ddfmt(0) gives 34 bytes: "1.70000000000000000000000000000001" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ffb3333 33333333 + 3c899999 99999998 -= 1.7 + 4.4408920985006252e-17 -ddI[1] = #3ffb3333 33333333 + 3c899999 9999999c -= 1.7 + 4.4408920985006276e-17 -ddI[1] == strtod - - -Input: -1.7 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.7 = #bffb3333 33333333 -dd[1] = -4.440892098500625e-17 = #bc899999 99999998 -g_ddfmt(0) gives 4 bytes: "-1.7" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bffb3333 33333333 + bc899999 9999999c -= -1.7 + -4.4408920985006276e-17 -ddI[1] = #bffb3333 33333333 + bc899999 99999998 -= -1.7 + -4.4408920985006252e-17 -ddI[1] == strtod - - -Input: 1.8 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.7999999999999998 = #3ffccccc cccccccc -dd[1] = 1.7763568394002506e-16 = #3ca99999 9999999a -g_ddfmt(0) gives 3 bytes: "1.8" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ffccccc cccccccc + 3ca99999 99999999 -= 1.7999999999999998 + 1.7763568394002503e-16 -ddI[1] = #3ffccccc cccccccc + 3ca99999 9999999a -= 1.7999999999999998 + 1.7763568394002506e-16 -ddI[1] == strtod - - -Input: -1.8 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.7999999999999998 = #bffccccc cccccccc -dd[1] = -1.7763568394002503e-16 = #bca99999 99999999 -g_ddfmt(0) gives 35 bytes: "-1.79999999999999999999999999999999" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bffccccc cccccccc + bca99999 9999999a -= -1.7999999999999998 + -1.7763568394002506e-16 -ddI[1] = #bffccccc cccccccc + bca99999 99999999 -= -1.7999999999999998 + -1.7763568394002503e-16 -ddI[1] == strtod - - -Input: 1.9 -strtopdd consumes 3 bytes and returns 33 -dd[0] = 1.9 = #3ffe6666 66666666 -dd[1] = 8.881784197001253e-17 = #3c999999 9999999a -g_ddfmt(0) gives 3 bytes: "1.9" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ffe6666 66666666 + 3c999999 99999998 -= 1.8999999999999999 + 8.8817841970012504e-17 -ddI[1] = #3ffe6666 66666666 + 3c999999 9999999a -= 1.8999999999999999 + 8.8817841970012528e-17 -ddI[1] == strtod - - -Input: -1.9 -strtopdd consumes 4 bytes and returns 25 -dd[0] = -1.9 = #bffe6666 66666666 -dd[1] = -8.88178419700125e-17 = #bc999999 99999998 -g_ddfmt(0) gives 35 bytes: "-1.89999999999999999999999999999998" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bffe6666 66666666 + bc999999 9999999a -= -1.8999999999999999 + -8.8817841970012528e-17 -ddI[1] = #bffe6666 66666666 + bc999999 99999998 -= -1.8999999999999999 + -8.8817841970012504e-17 -ddI[1] == strtod - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.0999999999999999 = #3ff19999 99999999 -dd[1] = 1.3322676295501878e-16 = #3ca33333 33333333 -g_ddfmt(0) gives 3 bytes: "1.1" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff19999 99999999 + 3ca33333 33333333 -= 1.0999999999999999 + 1.3322676295501878e-16 -ddI[1] = #3ff19999 99999999 + 3ca33333 33333334 -= 1.0999999999999999 + 1.332267629550188e-16 -ddI[0] == strtod - - -Input: -1.1 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.0999999999999999 = #bff19999 99999999 -dd[1] = -1.332267629550188e-16 = #bca33333 33333334 -g_ddfmt(0) gives 35 bytes: "-1.10000000000000000000000000000002" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff19999 99999999 + bca33333 33333334 -= -1.0999999999999999 + -1.332267629550188e-16 -ddI[1] = #bff19999 99999999 + bca33333 33333333 -= -1.0999999999999999 + -1.3322676295501878e-16 -ddI[0] == strtod - - -Input: 1.2 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.2 = #3ff33333 33333333 -dd[1] = 4.440892098500625e-17 = #3c899999 99999998 -g_ddfmt(0) gives 3 bytes: "1.2" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff33333 33333333 + 3c899999 99999998 -= 1.2 + 4.4408920985006252e-17 -ddI[1] = #3ff33333 33333333 + 3c899999 9999999c -= 1.2 + 4.4408920985006276e-17 -ddI[0] == strtod - - -Input: -1.2 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.2 = #bff33333 33333333 -dd[1] = -4.4408920985006276e-17 = #bc899999 9999999c -g_ddfmt(0) gives 35 bytes: "-1.20000000000000000000000000000001" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff33333 33333333 + bc899999 9999999c -= -1.2 + -4.4408920985006276e-17 -ddI[1] = #bff33333 33333333 + bc899999 99999998 -= -1.2 + -4.4408920985006252e-17 -ddI[0] == strtod - - -Input: 1.3 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.2999999999999998 = #3ff4cccc cccccccc -dd[1] = 1.7763568394002503e-16 = #3ca99999 99999999 -g_ddfmt(0) gives 34 bytes: "1.29999999999999999999999999999999" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ff4cccc cccccccc + 3ca99999 99999999 -= 1.2999999999999998 + 1.7763568394002503e-16 -ddI[1] = #3ff4cccc cccccccc + 3ca99999 9999999a -= 1.2999999999999998 + 1.7763568394002506e-16 -ddI[0] == strtod - - -Input: -1.3 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.2999999999999998 = #bff4cccc cccccccc -dd[1] = -1.7763568394002506e-16 = #bca99999 9999999a -g_ddfmt(0) gives 4 bytes: "-1.3" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bff4cccc cccccccc + bca99999 9999999a -= -1.2999999999999998 + -1.7763568394002506e-16 -ddI[1] = #bff4cccc cccccccc + bca99999 99999999 -= -1.2999999999999998 + -1.7763568394002503e-16 -ddI[0] == strtod - - -Input: 1.4 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.4 = #3ff66666 66666666 -dd[1] = 8.88178419700125e-17 = #3c999999 99999998 -g_ddfmt(0) gives 34 bytes: "1.39999999999999999999999999999998" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ff66666 66666666 + 3c999999 99999998 -= 1.3999999999999999 + 8.8817841970012504e-17 -ddI[1] = #3ff66666 66666666 + 3c999999 9999999a -= 1.3999999999999999 + 8.8817841970012528e-17 -ddI[0] == strtod - - -Input: -1.4 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.4 = #bff66666 66666666 -dd[1] = -8.881784197001253e-17 = #bc999999 9999999a -g_ddfmt(0) gives 4 bytes: "-1.4" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bff66666 66666666 + bc999999 9999999a -= -1.3999999999999999 + -8.8817841970012528e-17 -ddI[1] = #bff66666 66666666 + bc999999 99999998 -= -1.3999999999999999 + -8.8817841970012504e-17 -ddI[0] == strtod - - -Input: 1.5 -strtopdd consumes 3 bytes and returns 1 -dd[0] = 1.5 = #3ff80000 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 3 bytes: "1.5" - -strtoIdd returns 1, consuming 3 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: -1.5 -strtopdd consumes 4 bytes and returns 9 -dd[0] = -1.5 = #bff80000 0 -dd[1] = -0 = #80000000 0 -g_ddfmt(0) gives 3 bytes: "1.5" - -strtoIdd returns 9, consuming 4 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.6 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.5999999999999999 = #3ff99999 99999999 -dd[1] = 1.3322676295501878e-16 = #3ca33333 33333333 -g_ddfmt(0) gives 3 bytes: "1.6" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ff99999 99999999 + 3ca33333 33333333 -= 1.5999999999999999 + 1.3322676295501878e-16 -ddI[1] = #3ff99999 99999999 + 3ca33333 33333334 -= 1.5999999999999999 + 1.332267629550188e-16 -ddI[0] == strtod - - -Input: -1.6 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.5999999999999999 = #bff99999 99999999 -dd[1] = -1.332267629550188e-16 = #bca33333 33333334 -g_ddfmt(0) gives 35 bytes: "-1.60000000000000000000000000000002" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bff99999 99999999 + bca33333 33333334 -= -1.5999999999999999 + -1.332267629550188e-16 -ddI[1] = #bff99999 99999999 + bca33333 33333333 -= -1.5999999999999999 + -1.3322676295501878e-16 -ddI[0] == strtod - - -Input: 1.7 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.7 = #3ffb3333 33333333 -dd[1] = 4.440892098500625e-17 = #3c899999 99999998 -g_ddfmt(0) gives 3 bytes: "1.7" - -strtoIdd returns 17, consuming 3 bytes. -ddI[0] = #3ffb3333 33333333 + 3c899999 99999998 -= 1.7 + 4.4408920985006252e-17 -ddI[1] = #3ffb3333 33333333 + 3c899999 9999999c -= 1.7 + 4.4408920985006276e-17 -ddI[0] == strtod - - -Input: -1.7 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.7 = #bffb3333 33333333 -dd[1] = -4.4408920985006276e-17 = #bc899999 9999999c -g_ddfmt(0) gives 35 bytes: "-1.70000000000000000000000000000001" - -strtoIdd returns 25, consuming 4 bytes. -ddI[0] = #bffb3333 33333333 + bc899999 9999999c -= -1.7 + -4.4408920985006276e-17 -ddI[1] = #bffb3333 33333333 + bc899999 99999998 -= -1.7 + -4.4408920985006252e-17 -ddI[0] == strtod - - -Input: 1.8 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.7999999999999998 = #3ffccccc cccccccc -dd[1] = 1.7763568394002503e-16 = #3ca99999 99999999 -g_ddfmt(0) gives 34 bytes: "1.79999999999999999999999999999999" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ffccccc cccccccc + 3ca99999 99999999 -= 1.7999999999999998 + 1.7763568394002503e-16 -ddI[1] = #3ffccccc cccccccc + 3ca99999 9999999a -= 1.7999999999999998 + 1.7763568394002506e-16 -ddI[0] == strtod - - -Input: -1.8 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.7999999999999998 = #bffccccc cccccccc -dd[1] = -1.7763568394002506e-16 = #bca99999 9999999a -g_ddfmt(0) gives 4 bytes: "-1.8" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bffccccc cccccccc + bca99999 9999999a -= -1.7999999999999998 + -1.7763568394002506e-16 -ddI[1] = #bffccccc cccccccc + bca99999 99999999 -= -1.7999999999999998 + -1.7763568394002503e-16 -ddI[0] == strtod - - -Input: 1.9 -strtopdd consumes 3 bytes and returns 17 -dd[0] = 1.9 = #3ffe6666 66666666 -dd[1] = 8.88178419700125e-17 = #3c999999 99999998 -g_ddfmt(0) gives 34 bytes: "1.89999999999999999999999999999998" - -strtoIdd returns 33, consuming 3 bytes. -ddI[0] = #3ffe6666 66666666 + 3c999999 99999998 -= 1.8999999999999999 + 8.8817841970012504e-17 -ddI[1] = #3ffe6666 66666666 + 3c999999 9999999a -= 1.8999999999999999 + 8.8817841970012528e-17 -ddI[0] == strtod - - -Input: -1.9 -strtopdd consumes 4 bytes and returns 41 -dd[0] = -1.9 = #bffe6666 66666666 -dd[1] = -8.881784197001253e-17 = #bc999999 9999999a -g_ddfmt(0) gives 4 bytes: "-1.9" - -strtoIdd returns 41, consuming 4 bytes. -ddI[0] = #bffe6666 66666666 + bc999999 9999999a -= -1.8999999999999999 + -8.8817841970012528e-17 -ddI[1] = #bffe6666 66666666 + bc999999 99999998 -= -1.8999999999999999 + -8.8817841970012504e-17 -ddI[0] == strtod - diff --git a/contrib/gdtoa/test/ddsi.out b/contrib/gdtoa/test/ddsi.out deleted file mode 100644 index 1677707..0000000 --- a/contrib/gdtoa/test/ddsi.out +++ /dev/null @@ -1,376 +0,0 @@ - -Input: 1.23 -strtopdd consumes 4 bytes and returns 17 -dd[0] = 1.23 = #3ff3ae14 7ae147ae -dd[1] = 1.7763568394002496e-17 = #3c747ae1 47ae1478 -g_ddfmt(0) gives 4 bytes: "1.23" - -strtoIdd returns 17, consuming 4 bytes. -ddI[0] = #3ff3ae14 7ae147ae + 3c747ae1 47ae1478 -= 1.23 + 1.7763568394002496e-17 -ddI[1] = #3ff3ae14 7ae147ae + 3c747ae1 47ae1480 -= 1.23 + 1.776356839400252e-17 -ddI[0] == strtod - - -Input: 1.23e+20 -strtopdd consumes 8 bytes and returns 1 -dd[0] = 1.23e+20 = #441aabdf 2145b430 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 8 bytes: "1.23e+20" - -strtoIdd returns 1, consuming 8 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.23e-20 -strtopdd consumes 8 bytes and returns 33 -dd[0] = 1.2299999999999999e-20 = #3bcd0ae4 cf767530 -dd[1] = 9.304023318521521e-37 = #3873c997 955b2691 -g_ddfmt(0) gives 8 bytes: "1.23e-20" - -strtoIdd returns 33, consuming 8 bytes. -ddI[0] = #3bcd0ae4 cf767530 + 3873c997 955b2690 -= 1.2299999999999999e-20 + 9.3040233185215194e-37 -ddI[1] = #3bcd0ae4 cf767530 + 3873c997 955b2691 -= 1.2299999999999999e-20 + 9.3040233185215211e-37 -ddI[1] == strtod - - -Input: 1.23456789 -strtopdd consumes 10 bytes and returns 17 -dd[0] = 1.23456789 = #3ff3c0ca 4283de1b -dd[1] = 1.0990618193318369e-16 = #3c9fada5 144c1252 -g_ddfmt(0) gives 10 bytes: "1.23456789" - -strtoIdd returns 17, consuming 10 bytes. -ddI[0] = #3ff3c0ca 4283de1b + 3c9fada5 144c1252 -= 1.2345678899999999 + 1.0990618193318369e-16 -ddI[1] = #3ff3c0ca 4283de1b + 3c9fada5 144c1254 -= 1.2345678899999999 + 1.0990618193318371e-16 -ddI[0] == strtod - - -Input: 1.23456589e+20 -strtopdd consumes 14 bytes and returns 1 -dd[0] = 1.23456589e+20 = #441ac537 a660b997 -dd[1] = 4096 = #40b00000 0 -g_ddfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoIdd returns 1, consuming 14 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.23e+30 -strtopdd consumes 8 bytes and returns 1 -dd[0] = 1.23e+30 = #462f0cb0 4e8fb790 -dd[1] = 40281156091904 = #42c25158 0 -g_ddfmt(0) gives 8 bytes: "1.23e+30" - -strtoIdd returns 1, consuming 8 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1.23e-30 -strtopdd consumes 8 bytes and returns 17 -dd[0] = 1.2299999999999999e-30 = #39b8f286 6f5010aa -dd[1] = 1.076909723013918e-46 = #3663ac7f 3dafd174 -g_ddfmt(0) gives 8 bytes: "1.23e-30" - -strtoIdd returns 17, consuming 8 bytes. -ddI[0] = #39b8f286 6f5010aa + 3663ac7f 3dafd174 -= 1.2299999999999999e-30 + 1.076909723013918e-46 -ddI[1] = #39b8f286 6f5010aa + 3663ac7f 3dafd175 -= 1.2299999999999999e-30 + 1.0769097230139181e-46 -ddI[0] == strtod - - -Input: 1.23456789e-20 -strtopdd consumes 14 bytes and returns 17 -dd[0] = 1.23456789e-20 = #3bcd2681 471e7ada -dd[1] = 6.247111971663133e-37 = #386a9280 a761b07e -g_ddfmt(0) gives 14 bytes: "1.23456789e-20" - -strtoIdd returns 17, consuming 14 bytes. -ddI[0] = #3bcd2681 471e7ada + 386a9280 a761b07e -= 1.2345678899999999e-20 + 6.2471119716631328e-37 -ddI[1] = #3bcd2681 471e7ada + 386a9280 a761b080 -= 1.2345678899999999e-20 + 6.2471119716631345e-37 -ddI[0] == strtod - - -Input: 1.23456789e-30 -strtopdd consumes 14 bytes and returns 33 -dd[0] = 1.23456789e-30 = #39b90a3e 33bbd995 -dd[1] = 2.1567930523648577e-47 = #363f8585 55a6b1a0 -g_ddfmt(0) gives 14 bytes: "1.23456789e-30" - -strtoIdd returns 33, consuming 14 bytes. -ddI[0] = #39b90a3e 33bbd995 + 363f8585 55a6b198 -= 1.23456789e-30 + 2.1567930523648558e-47 -ddI[1] = #39b90a3e 33bbd995 + 363f8585 55a6b1a0 -= 1.23456789e-30 + 2.1567930523648577e-47 -ddI[1] == strtod - - -Input: 1.234567890123456789 -strtopdd consumes 20 bytes and returns 33 -dd[0] = 1.2345678901234567 = #3ff3c0ca 428c59fb -dd[1] = 9.856786452588859e-17 = #3c9c6906 51a3745e -g_ddfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIdd returns 33, consuming 20 bytes. -ddI[0] = #3ff3c0ca 428c59fb + 3c9c6906 51a3745c -= 1.2345678901234567 + 9.8567864525888563e-17 -ddI[1] = #3ff3c0ca 428c59fb + 3c9c6906 51a3745e -= 1.2345678901234567 + 9.8567864525888588e-17 -ddI[1] == strtod - - -Input: 1.23456789012345678901234567890123456789 -strtopdd consumes 40 bytes and returns 33 -dd[0] = 1.2345678901234567 = #3ff3c0ca 428c59fb -dd[1] = 9.858021020478982e-17 = #3c9c69ef 85adadb6 -g_ddfmt(0) gives 34 bytes: "1.23456789012345678901234567890124" - -strtoIdd returns 33, consuming 40 bytes. -ddI[0] = #3ff3c0ca 428c59fb + 3c9c69ef 85adadb4 -= 1.2345678901234567 + 9.8580210204789798e-17 -ddI[1] = #3ff3c0ca 428c59fb + 3c9c69ef 85adadb6 -= 1.2345678901234567 + 9.8580210204789823e-17 -ddI[1] == strtod - - -Input: 1.23e306 -strtopdd consumes 8 bytes and returns 33 -dd[0] = 1.2299999999999999e+306 = #7f7c0676 cd1c61f4 -dd[1] = 1.3319001448659015e+290 = #7c2b558b e3d3f477 -g_ddfmt(0) gives 9 bytes: "1.23e+306" - -strtoIdd returns 33, consuming 8 bytes. -ddI[0] = #7f7c0676 cd1c61f4 + 7c2b558b e3d3f476 -= 1.2299999999999999e+306 + 1.3319001448659013e+290 -ddI[1] = #7f7c0676 cd1c61f4 + 7c2b558b e3d3f477 -= 1.2299999999999999e+306 + 1.3319001448659015e+290 -ddI[1] == strtod - - -Input: 1.23e-306 -strtopdd consumes 9 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 9 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - - -Input: 1.23e-320 -strtopdd consumes 9 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 9 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - - -Input: 1.23e-20 -strtopdd consumes 8 bytes and returns 33 -dd[0] = 1.2299999999999999e-20 = #3bcd0ae4 cf767530 -dd[1] = 9.304023318521521e-37 = #3873c997 955b2691 -g_ddfmt(0) gives 8 bytes: "1.23e-20" - -strtoIdd returns 33, consuming 8 bytes. -ddI[0] = #3bcd0ae4 cf767530 + 3873c997 955b2690 -= 1.2299999999999999e-20 + 9.3040233185215194e-37 -ddI[1] = #3bcd0ae4 cf767530 + 3873c997 955b2691 -= 1.2299999999999999e-20 + 9.3040233185215211e-37 -ddI[1] == strtod - - -Input: 1.23456789e307 -strtopdd consumes 14 bytes and returns 33 -dd[0] = 1.2345678899999998e+307 = #7fb194b1 4bdaecdb -dd[1] = 2.0137933598720243e+291 = #7c69d48d 192048ca -g_ddfmt(0) gives 15 bytes: "1.23456789e+307" - -strtoIdd returns 33, consuming 14 bytes. -ddI[0] = #7fb194b1 4bdaecdb + 7c69d48d 192048c9 -= 1.2345678899999998e+307 + 2.013793359872024e+291 -ddI[1] = #7fb194b1 4bdaecdb + 7c69d48d 192048ca -= 1.2345678899999998e+307 + 2.0137933598720243e+291 -ddI[1] == strtod - - -Input: 1.23456589e-307 -strtopdd consumes 15 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 15 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - - -Input: 1.234567890123456789 -strtopdd consumes 20 bytes and returns 33 -dd[0] = 1.2345678901234567 = #3ff3c0ca 428c59fb -dd[1] = 9.856786452588859e-17 = #3c9c6906 51a3745e -g_ddfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIdd returns 33, consuming 20 bytes. -ddI[0] = #3ff3c0ca 428c59fb + 3c9c6906 51a3745c -= 1.2345678901234567 + 9.8567864525888563e-17 -ddI[1] = #3ff3c0ca 428c59fb + 3c9c6906 51a3745e -= 1.2345678901234567 + 9.8567864525888588e-17 -ddI[1] == strtod - - -Input: 1.234567890123456789e301 -strtopdd consumes 24 bytes and returns 33 -dd[0] = 1.2345678901234568e+301 = #7e726f51 75f56413 -dd[1] = 1.3892003943918827e+283 = #7ab7ea80 76399100 -g_ddfmt(0) gives 25 bytes: "1.234567890123456789e+301" - -strtoIdd returns 33, consuming 24 bytes. -ddI[0] = #7e726f51 75f56413 + 7ab7ea80 76399080 -= 1.2345678901234568e+301 + 1.3892003943918563e+283 -ddI[1] = #7e726f51 75f56413 + 7ab7ea80 76399100 -= 1.2345678901234568e+301 + 1.3892003943918827e+283 -ddI[1] == strtod - - -Input: 1.234567890123456789e-301 -strtopdd consumes 25 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 25 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - - -Input: 1.234567890123456789e-321 -strtopdd consumes 25 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 25 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - - -Input: 1e23 -strtopdd consumes 4 bytes and returns 1 -dd[0] = 1e+23 = #44b52d02 c7e14af6 -dd[1] = 8388608 = #41600000 0 -g_ddfmt(0) gives 5 bytes: "1e+23" - -strtoIdd returns 1, consuming 4 bytes. -ddI[0] == ddI[1] == strtopdd - - -Input: 1e310 -strtopdd consumes 5 bytes and returns 163 -dd[0] = Infinity = #7ff00000 0 -dd[1] = Infinity = #7ff00000 0 -g_ddfmt(0) gives 8 bytes: "Infinity" - -strtoIdd returns 163, consuming 5 bytes. -ddI[0] = #7fefffff ffffffff + 7c9fffff ffffffff -= 1.7976931348623157e+308 + 1.9958403095347196e+292 -ddI[1] = #7ff00000 0 + 7ff00000 0 -= Infinity + Infinity -ddI[1] == strtod - - -Input: 9.0259718793241475e-277 -strtopdd consumes 23 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 23 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - - -Input: 9.025971879324147880346310405869e-277 -strtopdd consumes 37 bytes and returns 17 -dd[0] = 9.025971879324148e-277 = #6a00000 0 -dd[1] = 2.2250738585072014e-308 = #100000 0 -g_ddfmt(0) gives 37 bytes: "9.025971879324147880346310405869e-277" - -strtoIdd returns 17, consuming 37 bytes. -ddI[0] = #6a00000 0 + 100000 0 -= 9.0259718793241479e-277 + 2.2250738585072014e-308 -ddI[1] = #6a00000 0 + 200000 0 -= 9.0259718793241479e-277 + 4.4501477170144028e-308 -ddI[0] == strtod - - -Input: 9.025971879324147880346310405868e-277 -strtopdd consumes 37 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 37 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - - -Input: 2.2250738585072014e-308 -strtopdd consumes 23 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 23 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - - -Input: 2.2250738585072013e-308 -strtopdd consumes 23 bytes and returns 80 -dd[0] = 0 = #0 0 -dd[1] = 0 = #0 0 -g_ddfmt(0) gives 1 bytes: "0" - -strtoIdd returns 80, consuming 23 bytes. -ddI[0] = #0 0 + 0 0 -= 0 + 0 -ddI[1] = #6a00000 0 + 0 0 -= 9.0259718793241479e-277 + 0 -ddI[0] == strtod - diff --git a/contrib/gdtoa/test/ddtest.c b/contrib/gdtoa/test/ddtest.c deleted file mode 100644 index aa32e92..0000000 --- a/contrib/gdtoa/test/ddtest.c +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998-2001 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -/* Test program for g_ddfmt, strtoIdd, strtopdd, and strtordd. - * - * Inputs (on stdin): - * r rounding_mode - * n ndig - * number - * #hex0 hex1 hex2 hex3 - * - * rounding_mode values: - * 0 = toward zero - * 1 = nearest - * 2 = toward +Infinity - * 3 = toward -Infinity - * - * where number is a decimal floating-point number, - * hex0 is a string of <= 8 Hex digits for the most significant - * word of the number, hex1 is a similar string for the next - * word, etc., and ndig is a parameters to g_ddfmt. - */ - -#include "gdtoaimp.h" -#include -#include - - extern int getround ANSI((int,char*)); - - static char ibuf[2048], obuf[1024]; - -#define U (unsigned long) - - static void -#ifdef KR_headers -dprint(what, d) char *what; double d; -#else -dprint(char *what, double d) -#endif -{ - char buf[32]; - ULong *L = (ULong*)&d; - - g_dfmt(buf,&d,0,sizeof(buf)); - printf("%s = %s = #%lx %lx\n", what, buf, U L[_0], 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]; - long LL[4]; - - L = (ULong*)&dd[0]; - while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) { - while(*s <= ' ') - if (!*s++) - continue; - dItry = 0; - switch(*s) { - case 'r': - r = getround(r, s); - continue; - case 'n': - i = s[1]; - if (i <= ' ' || i >= '0' && i <= '9') { - ndig = atoi(s+1); - continue; - } - break; /* nan? */ - case '#': - LL[0] = L[_0]; - LL[1] = L[_1]; - LL[2] = L[2+_0]; - LL[3] = 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]; - printf("\nInput: %s", ibuf); - printf(" --> f = #%lx %lx %lx %lx\n", - LL[0],LL[1],LL[2],LL[3]); - goto fmt_test; - } - printf("\nInput: %s", ibuf); - for(s1 = s; *s1 > ' '; s1++){}; - while(*s1 <= ' ' && *s1) s1++; - if (!*s1) { - dItry = 1; - i = strtordd(ibuf, &se, r, dd); - if (r == 1) { - j = strtopdd(ibuf, &se1, ddI); - if (i != j || dd[0] != ddI[0] - || 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); - } - fmt_test: - dprint("dd[0]", dd[0]); - dprint("dd[1]", dd[1]); - se = g_ddfmt(obuf, dd, ndig, sizeof(obuf)); - printf("g_ddfmt(%d) gives %d bytes: \"%s\"\n\n", - ndig, (int)(se-obuf), se ? obuf : ""); - if (!dItry) - continue; - 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]) - printf("ddI[0] == ddI[1] == strtopdd\n"); - else - printf("ddI[0] == ddI[1] = #%lx %lx + %lx %lx\n= %.17g + %17.g\n", - U ((ULong*)ddI)[_0], - U ((ULong*)ddI)[_1], - U ((ULong*)ddI)[2+_0], - U ((ULong*)ddI)[2+_1], - ddI[0], ddI[1]); - } - else { - printf("ddI[0] = #%lx %lx + %lx %lx\n= %.17g + %.17g\n", - U ((ULong*)ddI)[_0], U ((ULong*)ddI)[_1], - U ((ULong*)ddI)[2+_0], U ((ULong*)ddI)[2+_1], - ddI[0], ddI[1]); - printf("ddI[1] = #%lx %lx + %lx %lx\n= %.17g + %.17g\n", - 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]) - printf("ddI[0] == strtod\n"); - else if (ddI[2] == dd[0] && ddI[3] == dd[1]) - printf("ddI[1] == strtod\n"); - else - printf("**** Both differ from strtopdd ****\n"); - } - printf("\n"); - } - return 0; - } diff --git a/contrib/gdtoa/test/dt.c b/contrib/gdtoa/test/dt.c deleted file mode 100644 index 1a86ba3..0000000 --- a/contrib/gdtoa/test/dt.c +++ /dev/null @@ -1,275 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -/* Test program for strtod and dtoa. - * - * Inputs (on stdin): - * number[: mode [ndigits]] - * or - * #hex0 hex1[: mode [ndigits]] - * where number is a decimal floating-point number, - * hex0 is a string of Hex digits for the most significant - * word of the number, hex1 is a similar string for the other - * (least significant) word, and mode and ndigits are - * parameters to dtoa. - */ - -#include -#include "gdtoa.h" -#ifdef KR_headers -#define Void /*void*/ -#else -#define Void void -#endif - -#ifdef __STDC__ -#include -#else -#ifdef __cplusplus -extern "C" double atof(const char*); -#else -extern double atof ANSI((char*)); -#endif -#endif -#ifdef IEEE_8087 -#define word0(x) ((ULong *)&x)[1] -#define word1(x) ((ULong *)&x)[0] -#else -#define word0(x) ((ULong *)&x)[0] -#define word1(x) ((ULong *)&x)[1] -#endif -#include "errno.h" - -#ifdef __cplusplus -extern "C" char *dtoa(double, int, int, int*, int*, char **); -#else -extern char *dtoa ANSI((double, int, int, int*, int*, char **)); -#endif - - static void -#ifdef KR_headers -g_fmt(b, x) char *b; double x; -#else -g_fmt(char *b, double x) -#endif -{ - char *s, *se; - int decpt, i, j, k, sign; - - if (!x) { - *b++ = '0'; - *b = 0; - return; - } - s = dtoa(x, 0, 0, &decpt, &sign, &se); - if (sign) - *b++ = '-'; - if (decpt == 9999) /* Infinity or Nan */ { - while(*b++ = *s++); - return; - } - if (decpt <= -4 || decpt > se - s + 5) { - *b++ = *s++; - if (*s) { - *b++ = '.'; - while(*b = *s++) - b++; - } - *b++ = 'e'; - /* sprintf(b, "%+.2d", decpt - 1); */ - if (--decpt < 0) { - *b++ = '-'; - decpt = -decpt; - } - else - *b++ = '+'; - for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10){}; - for(;;) { - i = decpt / k; - *b++ = i + '0'; - if (--j <= 0) - break; - decpt -= i*k; - decpt *= 10; - } - *b = 0; - } - else if (decpt <= 0) { - *b++ = '.'; - for(; decpt < 0; decpt++) - *b++ = '0'; - while(*b++ = *s++); - } - else { - while(*b = *s++) { - b++; - if (--decpt == 0 && *s) - *b++ = '.'; - } - for(; decpt > 0; decpt--) - *b++ = '0'; - *b = 0; - } - } - - static void -baderrno(Void) -{ - fflush(stdout); - perror("\nerrno strtod"); - fflush(stderr); - } - -#define U (unsigned long) - - static void -#ifdef KR_headers -check(d) double d; -#else -check(double d) -#endif -{ - char buf[64]; - int decpt, sign; - char *s, *se; - double d1; - - s = dtoa(d, 0, 0, &decpt, &sign, &se); - sprintf(buf, "%s.%se%d", sign ? "-" : "", s, decpt); - errno = 0; - d1 = strtod(buf, (char **)0); - if (errno) - baderrno(); - if (d != d1) { - printf("sent d = %.17g = 0x%lx %lx, buf = %s\n", - d, U word0(d), U word1(d), buf); - printf("got d1 = %.17g = 0x%lx %lx\n", - d1, U word0(d1), U word1(d1)); - } - } - -main(Void){ - char buf[2048], buf1[32]; - char *fmt, *s, *se; - double d, d1; - int decpt, sign; - int mode = 0, ndigits = 17; - ULong x, y; -#ifdef VAX - ULong z; -#endif - - while(fgets(buf, sizeof(buf), stdin)) { - if (*buf == '*') { - printf("%s", buf); - continue; - } - printf("Input: %s", buf); - if (*buf == '#') { - x = word0(d); - y = word1(d); - sscanf(buf+1, "%lx %lx:%d %d", &x, &y, &mode, &ndigits); - word0(d) = x; - word1(d) = y; - fmt = "Output: d =\n%.17g = 0x%lx %lx\n"; - } - else { - errno = 0; - d = strtod(buf,&se); - if (*se == ':') - sscanf(se+1,"%d %d", &mode, &ndigits); - d1 = atof(buf); - fmt = "Output: d =\n%.17g = 0x%lx %lx, se = %s"; - if (errno) - baderrno(); - } - printf(fmt, d, U word0(d), U word1(d), se); - g_fmt(buf1, d); - printf("\tg_fmt gives \"%s\"\n", buf1); - if (*buf != '#' && d != d1) - printf("atof gives\n\ - d1 = %.17g = 0x%lx %lx\nversus\n\ - d = %.17g = 0x%lx %lx\n", d1, U word0(d1), U word1(d1), - d, U word0(d), U word1(d)); - check(d); - s = dtoa(d, mode, ndigits, &decpt, &sign, &se); - printf("\tdtoa(mode = %d, ndigits = %d):\n", mode, ndigits); - printf("\tdtoa returns sign = %d, decpt = %d, %d digits:\n%s\n", - sign, decpt, se-s, s); - x = word1(d); - if (x != 0xffffffff - && (word0(d) & 0x7ff00000) != 0x7ff00000) { -#ifdef VAX - z = x << 16 | x >> 16; - z++; - z = z << 16 | z >> 16; - word1(d) = z; -#else - word1(d) = x + 1; -#endif - printf("\tnextafter(d,+Inf) = %.17g = 0x%lx %lx:\n", - d, U word0(d), U word1(d)); - g_fmt(buf1, d); - printf("\tg_fmt gives \"%s\"\n", buf1); - s = dtoa(d, mode, ndigits, &decpt, &sign, &se); - printf( - "\tdtoa returns sign = %d, decpt = %d, %d digits:\n%s\n", - sign, decpt, se-s, s); - check(d); - } - if (x) { -#ifdef VAX - z = x << 16 | x >> 16; - z--; - z = z << 16 | z >> 16; - word1(d) = z; -#else - word1(d) = x - 1; -#endif - printf("\tnextafter(d,-Inf) = %.17g = 0x%lx %lx:\n", - d, U word0(d), U word1(d)); - g_fmt(buf1, d); - printf("\tg_fmt gives \"%s\"\n", buf1); - s = dtoa(d, mode, ndigits, &decpt, &sign, &se); - printf( - "\tdtoa returns sign = %d, decpt = %d, %d digits:\n%s\n", - sign, decpt, se-s, s); - check(d); - } - } - return 0; - } diff --git a/contrib/gdtoa/test/dtest.c b/contrib/gdtoa/test/dtest.c deleted file mode 100644 index e07b1a8..0000000 --- a/contrib/gdtoa/test/dtest.c +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998-2001 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -/* Test program for g_dfmt, strtoId, strtod, strtopd, and strtord. - * - * Inputs (on stdin): - * r rounding_mode - * n ndig - * number - * #hex0 hex1 - * - * rounding_mode values: - * 0 = toward zero - * 1 = nearest - * 2 = toward +Infinity - * 3 = toward -Infinity - * - * where number is a decimal floating-point number, - * hex0 is a string of Hex <= 8 digits for the most significant - * word of the number, hex1 is a similar string for the other - * (least significant) word, and ndig is a parameters to g_dfmt. - */ - -#include "gdtoaimp.h" -#include -#include - - extern int getround ANSI((int,char*)); - - static char ibuf[2048], obuf[1024]; - -#define U (unsigned long) - - int -main(Void) -{ - ULong *L; - char *s, *se, *se1; - double f, f1, fI[2]; - int i, i1, ndig = 0, r = 1; - long LL[2]; - - L = (ULong*)&f; - while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) { - while(*s <= ' ') - if (!*s++) - continue; - switch(*s) { - case 'r': - r = getround(r, s); - continue; - case 'n': - i = s[1]; - if (i <= ' ' || i >= '0' && i <= '9') { - ndig = atoi(s+1); - continue; - } - break; /* nan? */ - case '#': - LL[0] = L[_0]; - LL[1] = L[_1]; - sscanf(s+1, "%lx %lx", &LL[0], &LL[1]); - L[_0] = LL[0]; - L[_1] = LL[1]; - printf("\nInput: %s", ibuf); - printf("--> f = #%lx %lx\n", (long)L[_0], (long)L[_1]); - goto fmt_test; - } - printf("\nInput: %s", ibuf); - i = strtord(ibuf, &se, r, &f); - if (r == 1) { - if ((f != strtod(ibuf, &se1) || se1 != se)) - printf("***strtod and strtord disagree!!\n"); - i1 = strtopd(ibuf, &se, &f1); - if (i != i1 || 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]); - fmt_test: - se = g_dfmt(obuf, &f, ndig, sizeof(obuf)); - printf("g_dfmt(%d) gives %d bytes: \"%s\"\n\n", - ndig, (int)(se-obuf), se ? obuf : ""); - if (*s == '#') - continue; - 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) - printf("fI[0] == fI[1] == strtod\n"); - else - printf("fI[0] == fI[1] = #%lx %lx = %.17g\n", - U ((ULong*)fI)[_0], U ((ULong*)fI)[_1], - fI[0]); - } - else { - printf("fI[0] = #%lx %lx = %.17g\n", - U ((ULong*)fI)[_0], U ((ULong*)fI)[_1], fI[0]); - printf("fI[1] = #%lx %lx = %.17g\n", - U ((ULong*)&fI[1])[_0], U ((ULong*)&fI[1])[_1], - fI[1]); - if (fI[0] == f) - printf("fI[0] == strtod\n"); - else if (fI[1] == f) - printf("fI[1] == strtod\n"); - else - printf("**** Both differ from strtod ****\n"); - } - printf("\n"); - } - return 0; - } diff --git a/contrib/gdtoa/test/dtst.out b/contrib/gdtoa/test/dtst.out deleted file mode 100644 index 1ec70ab..0000000 --- a/contrib/gdtoa/test/dtst.out +++ /dev/null @@ -1,686 +0,0 @@ -Input: 1.23 -Output: d = -1.23 = 0x3ff3ae14 7ae147ae, se = - g_fmt gives "1.23" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 1, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999998" - dtoa returns sign = 0, decpt = 1, 17 digits: -12299999999999998 -Input: 1.23e+20 -Output: d = -1.23e+20 = 0x441aabdf 2145b430, se = - g_fmt gives "1.23e+20" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 21, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "122999999999999980000" - dtoa returns sign = 0, decpt = 21, 17 digits: -12299999999999998 -Input: 1.23e-20 -Output: d = -1.2300000000000001e-20 = 0x3bcd0ae4 cf767531, se = - g_fmt gives "1.23e-20" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -19, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999999e-20" - dtoa returns sign = 0, decpt = -19, 17 digits: -12299999999999999 -Input: 1.23456789 -Output: d = -1.2345678899999999 = 0x3ff3c0ca 4283de1b, se = - g_fmt gives "1.23456789" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 1, 9 digits: -123456789 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678899999997" - dtoa returns sign = 0, decpt = 1, 17 digits: -12345678899999997 -Input: 1.23456589e+20 -Output: d = -1.23456589e+20 = 0x441ac537 a660b997, se = - g_fmt gives "1.23456589e+20" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 21, 9 digits: -123456589 - nextafter(d,+Inf) = 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: - g_fmt gives "123456588999999980000" - dtoa returns sign = 0, decpt = 21, 17 digits: -12345658899999998 -Input: 1.23e+30 -Output: d = -1.23e+30 = 0x462f0cb0 4e8fb790, se = - g_fmt gives "1.23e+30" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 31, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999998e+30" - dtoa returns sign = 0, decpt = 31, 17 digits: -12299999999999998 -Input: 1.23e-30 -Output: d = -1.2300000000000001e-30 = 0x39b8f286 6f5010ab, se = - g_fmt gives "1.23e-30" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -29, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999999e-30" - dtoa returns sign = 0, decpt = -29, 17 digits: -12299999999999999 -Input: 1.23456789e-20 -Output: d = -1.2345678899999999e-20 = 0x3bcd2681 471e7ada, se = - g_fmt gives "1.23456789e-20" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -19, 9 digits: -123456789 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678899999998e-20" - dtoa returns sign = 0, decpt = -19, 17 digits: -12345678899999998 -Input: 1.23456789e-30 -Output: d = -1.23456789e-30 = 0x39b90a3e 33bbd995, se = - g_fmt gives "1.23456789e-30" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -29, 9 digits: -123456789 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678899999998e-30" - dtoa returns sign = 0, decpt = -29, 17 digits: -12345678899999998 -Input: 1.234567890123456789 -Output: d = -1.2345678901234567 = 0x3ff3c0ca 428c59fb, se = - g_fmt gives "1.2345678901234567" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 1, 17 digits: -12345678901234567 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678901234565" - dtoa returns sign = 0, decpt = 1, 17 digits: -12345678901234565 -Input: 1.23456789012345678901234567890123456789 -Output: d = -1.2345678901234567 = 0x3ff3c0ca 428c59fb, se = - g_fmt gives "1.2345678901234567" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 1, 17 digits: -12345678901234567 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678901234565" - dtoa returns sign = 0, decpt = 1, 17 digits: -12345678901234565 -Input: 1.23e306 -Output: d = -1.23e+306 = 0x7f7c0676 cd1c61f5, se = - g_fmt gives "1.23e+306" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 307, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999999e+306" - dtoa returns sign = 0, decpt = 307, 17 digits: -12299999999999999 -Input: 1.23e-306 -Output: d = -1.23e-306 = 0x6ba3b8 5da396e8, se = - g_fmt gives "1.23e-306" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -305, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999999e-306" - dtoa returns sign = 0, decpt = -305, 17 digits: -12299999999999999 -Input: 1.23e-320 -Output: d = -1.2302234581447039e-320 = 0x0 9ba, se = - g_fmt gives "1.23e-320" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -319, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2297e-320" - dtoa returns sign = 0, decpt = -319, 5 digits: -12297 -Input: 1.23e-20 -Output: d = -1.2300000000000001e-20 = 0x3bcd0ae4 cf767531, se = - g_fmt gives "1.23e-20" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -19, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999999e-20" - dtoa returns sign = 0, decpt = -19, 17 digits: -12299999999999999 -Input: 1.23456789e307 -Output: d = -1.23456789e+307 = 0x7fb194b1 4bdaecdc, se = - g_fmt gives "1.23456789e+307" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 308, 9 digits: -123456789 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678899999998e+307" - dtoa returns sign = 0, decpt = 308, 17 digits: -12345678899999998 -Input: 1.23456589e-307 -Output: d = -1.2345658899999999e-307 = 0x363196 bb9845fa, se = - g_fmt gives "1.23456589e-307" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -306, 9 digits: -123456589 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345658899999997e-307" - dtoa returns sign = 0, decpt = -306, 17 digits: -12345658899999997 -Input: 1.234567890123456789 -Output: d = -1.2345678901234567 = 0x3ff3c0ca 428c59fb, se = - g_fmt gives "1.2345678901234567" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 1, 17 digits: -12345678901234567 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678901234565" - dtoa returns sign = 0, decpt = 1, 17 digits: -12345678901234565 -Input: 1.234567890123456789e301 -Output: d = -1.2345678901234568e+301 = 0x7e726f51 75f56413, se = - g_fmt gives "1.2345678901234568e+301" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 302, 17 digits: -12345678901234568 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678901234565e+301" - dtoa returns sign = 0, decpt = 302, 17 digits: -12345678901234565 -Input: 1.234567890123456789e-301 -Output: d = -1.2345678901234567e-301 = 0x1752a64 e34ba0d3, se = - g_fmt gives "1.2345678901234567e-301" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -300, 17 digits: -12345678901234567 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678901234565e-301" - dtoa returns sign = 0, decpt = -300, 17 digits: -12345678901234565 -Input: 1.234567890123456789e-321 -Output: d = -1.2351641146031164e-321 = 0x0 fa, se = - g_fmt gives "1.235e-321" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -320, 4 digits: -1235 - nextafter(d,+Inf) = 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: - g_fmt gives "1.23e-321" - dtoa returns sign = 0, decpt = -320, 3 digits: -123 -Input: 1e23 -Output: d = -9.9999999999999992e+22 = 0x44b52d02 c7e14af6, se = - g_fmt gives "1e+23" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 24, 1 digits: -1 - nextafter(d,+Inf) = 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: - 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" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = 9999, 8 digits: -Infinity -Input: 9.0259718793241475e-277 -Output: d = -9.0259718793241479e-277 = 0x6a00000 0, se = - g_fmt gives "9.025971879324148e-277" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -276, 16 digits: -9025971879324148 - nextafter(d,+Inf) = 9.0259718793241499e-277 = 0x6a00000 1: - g_fmt gives "9.02597187932415e-277" - dtoa returns sign = 0, decpt = -276, 15 digits: -902597187932415 -Input: 9.025971879324147880346310405869e-277 -Output: d = -9.0259718793241479e-277 = 0x6a00000 0, se = - g_fmt gives "9.025971879324148e-277" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -276, 16 digits: -9025971879324148 - nextafter(d,+Inf) = 9.0259718793241499e-277 = 0x6a00000 1: - g_fmt gives "9.02597187932415e-277" - dtoa returns sign = 0, decpt = -276, 15 digits: -902597187932415 -Input: 9.025971879324147880346310405868e-277 -Output: d = -9.0259718793241479e-277 = 0x6a00000 0, se = - g_fmt gives "9.025971879324148e-277" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -276, 16 digits: -9025971879324148 - nextafter(d,+Inf) = 9.0259718793241499e-277 = 0x6a00000 1: - g_fmt gives "9.02597187932415e-277" - dtoa returns sign = 0, decpt = -276, 15 digits: -902597187932415 -Input: 2.2250738585072014e-308 -Output: d = -2.2250738585072014e-308 = 0x100000 0, se = - g_fmt gives "2.2250738585072014e-308" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -307, 17 digits: -22250738585072014 - nextafter(d,+Inf) = 2.2250738585072019e-308 = 0x100000 1: - g_fmt gives "2.225073858507202e-308" - dtoa returns sign = 0, decpt = -307, 16 digits: -2225073858507202 -Input: 2.2250738585072013e-308 -Output: d = -2.2250738585072014e-308 = 0x100000 0, se = - g_fmt gives "2.2250738585072014e-308" - dtoa(mode = 0, ndigits = 17): - dtoa returns sign = 0, decpt = -307, 17 digits: -22250738585072014 - nextafter(d,+Inf) = 2.2250738585072019e-308 = 0x100000 1: - g_fmt gives "2.225073858507202e-308" - dtoa returns sign = 0, decpt = -307, 16 digits: -2225073858507202 -Input: 1.23:2 6 -Output: d = -1.23 = 0x3ff3ae14 7ae147ae, se = :2 6 - g_fmt gives "1.23" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = 1, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999998" - dtoa returns sign = 0, decpt = 1, 3 digits: -123 -Input: 1.23:4 6 -Output: d = -1.23 = 0x3ff3ae14 7ae147ae, se = :4 6 - g_fmt gives "1.23" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = 1, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999998" - dtoa returns sign = 0, decpt = 1, 3 digits: -123 -Input: 1.23e+20:2 6 -Output: d = -1.23e+20 = 0x441aabdf 2145b430, se = :2 6 - g_fmt gives "1.23e+20" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = 21, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "122999999999999980000" - dtoa returns sign = 0, decpt = 21, 3 digits: -123 -Input: 1.23e+20:4 6 -Output: d = -1.23e+20 = 0x441aabdf 2145b430, se = :4 6 - g_fmt gives "1.23e+20" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = 21, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "122999999999999980000" - dtoa returns sign = 0, decpt = 21, 3 digits: -123 -Input: 1.23e-20:2 6 -Output: d = -1.2300000000000001e-20 = 0x3bcd0ae4 cf767531, se = :2 6 - g_fmt gives "1.23e-20" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = -19, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999999e-20" - dtoa returns sign = 0, decpt = -19, 3 digits: -123 -Input: 1.23e-20:4 6 -Output: d = -1.2300000000000001e-20 = 0x3bcd0ae4 cf767531, se = :4 6 - g_fmt gives "1.23e-20" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = -19, 3 digits: -123 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2299999999999999e-20" - dtoa returns sign = 0, decpt = -19, 3 digits: -123 -Input: 1.23456789:2 6 -Output: d = -1.2345678899999999 = 0x3ff3c0ca 4283de1b, se = :2 6 - g_fmt gives "1.23456789" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = 1, 6 digits: -123457 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678899999997" - dtoa returns sign = 0, decpt = 1, 6 digits: -123457 -Input: 1.23456789:4 6 -Output: d = -1.2345678899999999 = 0x3ff3c0ca 4283de1b, se = :4 6 - g_fmt gives "1.23456789" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = 1, 6 digits: -123457 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678899999997" - dtoa returns sign = 0, decpt = 1, 6 digits: -123457 -Input: 1.23456589e+20:2 6 -Output: d = -1.23456589e+20 = 0x441ac537 a660b997, se = :2 6 - g_fmt gives "1.23456589e+20" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = 21, 6 digits: -123457 - nextafter(d,+Inf) = 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: - g_fmt gives "123456588999999980000" - dtoa returns sign = 0, decpt = 21, 6 digits: -123457 -Input: 1.23456589e+20:4 6 -Output: d = -1.23456589e+20 = 0x441ac537 a660b997, se = :4 6 - g_fmt gives "1.23456589e+20" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = 21, 6 digits: -123457 - nextafter(d,+Inf) = 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: - g_fmt gives "123456588999999980000" - dtoa returns sign = 0, decpt = 21, 6 digits: -123457 -Input: 1.23456789e-20:2 6 -Output: d = -1.2345678899999999e-20 = 0x3bcd2681 471e7ada, se = :2 6 - g_fmt gives "1.23456789e-20" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = -19, 6 digits: -123457 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678899999998e-20" - dtoa returns sign = 0, decpt = -19, 6 digits: -123457 -Input: 1.23456789e-20:4 6 -Output: d = -1.2345678899999999e-20 = 0x3bcd2681 471e7ada, se = :4 6 - g_fmt gives "1.23456789e-20" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = -19, 6 digits: -123457 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345678899999998e-20" - dtoa returns sign = 0, decpt = -19, 6 digits: -123457 -Input: 1234565:2 6 -Output: d = -1234565 = 0x4132d685 0, se = :2 6 - g_fmt gives "1234565" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = 7, 6 digits: -123456 - nextafter(d,+Inf) = 1234565.0000000002 = 0x4132d685 1: - g_fmt gives "1234565.0000000002" - dtoa returns sign = 0, decpt = 7, 6 digits: -123457 -Input: 1234565:4 6 -Output: d = -1234565 = 0x4132d685 0, se = :4 6 - g_fmt gives "1234565" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = 7, 6 digits: -123456 - nextafter(d,+Inf) = 1234565.0000000002 = 0x4132d685 1: - g_fmt gives "1234565.0000000002" - dtoa returns sign = 0, decpt = 7, 6 digits: -123457 -Input: 1.234565:2 6 -Output: d = -1.2345649999999999 = 0x3ff3c0c7 3abc9470, se = :2 6 - g_fmt gives "1.234565" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = 1, 6 digits: -123456 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345649999999997" - dtoa returns sign = 0, decpt = 1, 6 digits: -123456 -Input: 1.234565:4 6 -Output: d = -1.2345649999999999 = 0x3ff3c0c7 3abc9470, se = :4 6 - g_fmt gives "1.234565" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = 1, 6 digits: -123456 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345649999999997" - dtoa returns sign = 0, decpt = 1, 6 digits: -123456 -Input: 1.234565e+20:2 6 -Output: d = -1.234565e+20 = 0x441ac536 6299040d, se = :2 6 - g_fmt gives "1.234565e+20" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = 21, 6 digits: -123456 - nextafter(d,+Inf) = 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: - g_fmt gives "123456499999999980000" - dtoa returns sign = 0, decpt = 21, 6 digits: -123456 -Input: 1.234565e+20:4 6 -Output: d = -1.234565e+20 = 0x441ac536 6299040d, se = :4 6 - g_fmt gives "1.234565e+20" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = 21, 6 digits: -123456 - nextafter(d,+Inf) = 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: - g_fmt gives "123456499999999980000" - dtoa returns sign = 0, decpt = 21, 6 digits: -123456 -Input: 1.234565e-20:2 6 -Output: d = -1.234565e-20 = 0x3bcd267c ce45a93f, se = :2 6 - g_fmt gives "1.234565e-20" - dtoa(mode = 2, ndigits = 6): - dtoa returns sign = 0, decpt = -19, 6 digits: -123456 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345649999999998e-20" - dtoa returns sign = 0, decpt = -19, 6 digits: -123456 -Input: 1.234565e-20:4 6 -Output: d = -1.234565e-20 = 0x3bcd267c ce45a93f, se = :4 6 - g_fmt gives "1.234565e-20" - dtoa(mode = 4, ndigits = 6): - dtoa returns sign = 0, decpt = -19, 6 digits: -123456 - nextafter(d,+Inf) = 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: - g_fmt gives "1.2345649999999998e-20" - dtoa returns sign = 0, decpt = -19, 6 digits: -123456 diff --git a/contrib/gdtoa/test/f.out b/contrib/gdtoa/test/f.out deleted file mode 100644 index ca8d6eb..0000000 --- a/contrib/gdtoa/test/f.out +++ /dev/null @@ -1,968 +0,0 @@ - -Input: 1.23 -strtof consumes 4 bytes and returns 1.23 = #3f9d70a4 -g_ffmt(0) gives 4 bytes: "1.23" - -strtoIf returns 33, consuming 4 bytes. -fI[0] = #3f9d70a3 = 1.2299999 -fI[1] = #3f9d70a4 = 1.23 -fI[1] == strtof - - -Input: 1.23e+20 -strtof consumes 8 bytes and returns 1.23e+20 = #60d55ef9 -g_ffmt(0) gives 8 bytes: "1.23e+20" - -strtoIf returns 17, consuming 8 bytes. -fI[0] = #60d55ef9 = 1.23e+20 -fI[1] = #60d55efa = 1.2300001e+20 -fI[0] == strtof - - -Input: 1.23e-20 -strtof consumes 8 bytes and returns 1.23e-20 = #1e685726 -g_ffmt(0) gives 8 bytes: "1.23e-20" - -strtoIf returns 17, consuming 8 bytes. -fI[0] = #1e685726 = 1.23e-20 -fI[1] = #1e685727 = 1.23e-20 -fI[0] == strtof - - -Input: 1.23456789 -strtof consumes 10 bytes and returns 1.2345679 = #3f9e0652 -g_ffmt(0) gives 9 bytes: "1.2345679" - -strtoIf returns 17, consuming 10 bytes. -fI[0] = #3f9e0652 = 1.2345679 -fI[1] = #3f9e0653 = 1.234568 -fI[0] == strtof - - -Input: 1.23456589e+20 -strtof consumes 14 bytes and returns 1.2345659e+20 = #60d629bd -g_ffmt(0) gives 13 bytes: "1.2345659e+20" - -strtoIf returns 17, consuming 14 bytes. -fI[0] = #60d629bd = 1.2345659e+20 -fI[1] = #60d629be = 1.234566e+20 -fI[0] == strtof - - -Input: 1.23e+30 -strtof consumes 8 bytes and returns 1.23e+30 = #71786582 -g_ffmt(0) gives 8 bytes: "1.23e+30" - -strtoIf returns 17, consuming 8 bytes. -fI[0] = #71786582 = 1.23e+30 -fI[1] = #71786583 = 1.23e+30 -fI[0] == strtof - - -Input: 1.23e-30 -strtof consumes 8 bytes and returns 1.23e-30 = #dc79433 -g_ffmt(0) gives 8 bytes: "1.23e-30" - -strtoIf returns 17, consuming 8 bytes. -fI[0] = #dc79433 = 1.23e-30 -fI[1] = #dc79434 = 1.23e-30 -fI[0] == strtof - - -Input: 1.23456789e-20 -strtof consumes 14 bytes and returns 1.2345679e-20 = #1e69340a -g_ffmt(0) gives 13 bytes: "1.2345679e-20" - -strtoIf returns 17, consuming 14 bytes. -fI[0] = #1e69340a = 1.2345679e-20 -fI[1] = #1e69340b = 1.234568e-20 -fI[0] == strtof - - -Input: 1.23456789e-30 -strtof consumes 14 bytes and returns 1.2345679e-30 = #dc851f2 -g_ffmt(0) gives 13 bytes: "1.2345679e-30" - -strtoIf returns 33, consuming 14 bytes. -fI[0] = #dc851f1 = 1.2345678e-30 -fI[1] = #dc851f2 = 1.2345679e-30 -fI[1] == strtof - - -Input: 1.234567890123456789 -strtof consumes 20 bytes and returns 1.2345679 = #3f9e0652 -g_ffmt(0) gives 9 bytes: "1.2345679" - -strtoIf returns 17, consuming 20 bytes. -fI[0] = #3f9e0652 = 1.2345679 -fI[1] = #3f9e0653 = 1.234568 -fI[0] == strtof - - -Input: 1.23456789012345678901234567890123456789 -strtof consumes 40 bytes and returns 1.2345679 = #3f9e0652 -g_ffmt(0) gives 9 bytes: "1.2345679" - -strtoIf returns 17, consuming 40 bytes. -fI[0] = #3f9e0652 = 1.2345679 -fI[1] = #3f9e0653 = 1.234568 -fI[0] == strtof - - -Input: 1.23e306 -strtof consumes 8 bytes and returns Infinity = #7f800000 -g_ffmt(0) gives 8 bytes: "Infinity" - -strtoIf returns 163, consuming 8 bytes. -fI[0] = #7f7fffff = 3.4028235e+38 -fI[1] = #7f800000 = Infinity -fI[1] == strtof - - -Input: 1.23e-306 -strtof consumes 9 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 9 bytes. -fI[0] == fI[1] == strtof - - -Input: 1.23e-320 -strtof consumes 9 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 9 bytes. -fI[0] == fI[1] == strtof - - -Input: 1.23e-20 -strtof consumes 8 bytes and returns 1.23e-20 = #1e685726 -g_ffmt(0) gives 8 bytes: "1.23e-20" - -strtoIf returns 17, consuming 8 bytes. -fI[0] = #1e685726 = 1.23e-20 -fI[1] = #1e685727 = 1.23e-20 -fI[0] == strtof - - -Input: 1.23456789e307 -strtof consumes 14 bytes and returns Infinity = #7f800000 -g_ffmt(0) gives 8 bytes: "Infinity" - -strtoIf returns 163, consuming 14 bytes. -fI[0] = #7f7fffff = 3.4028235e+38 -fI[1] = #7f800000 = Infinity -fI[1] == strtof - - -Input: 1.23456589e-307 -strtof consumes 15 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 15 bytes. -fI[0] == fI[1] == strtof - - -Input: 1.234567890123456789 -strtof consumes 20 bytes and returns 1.2345679 = #3f9e0652 -g_ffmt(0) gives 9 bytes: "1.2345679" - -strtoIf returns 17, consuming 20 bytes. -fI[0] = #3f9e0652 = 1.2345679 -fI[1] = #3f9e0653 = 1.234568 -fI[0] == strtof - - -Input: 1.234567890123456789e301 -strtof consumes 24 bytes and returns Infinity = #7f800000 -g_ffmt(0) gives 8 bytes: "Infinity" - -strtoIf returns 163, consuming 24 bytes. -fI[0] = #7f7fffff = 3.4028235e+38 -fI[1] = #7f800000 = Infinity -fI[1] == strtof - - -Input: 1.234567890123456789e-301 -strtof consumes 25 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 25 bytes. -fI[0] == fI[1] == strtof - - -Input: 1.234567890123456789e-321 -strtof consumes 25 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 25 bytes. -fI[0] == fI[1] == strtof - - -Input: 1e23 -strtof consumes 4 bytes and returns 9.9999998e+22 = #65a96816 -g_ffmt(0) gives 5 bytes: "1e+23" - -strtoIf returns 17, consuming 4 bytes. -fI[0] = #65a96816 = 9.9999998e+22 -fI[1] = #65a96817 = 1.0000001e+23 -fI[0] == strtof - - -Input: 1e310 -strtof consumes 5 bytes and returns Infinity = #7f800000 -g_ffmt(0) gives 8 bytes: "Infinity" - -strtoIf returns 163, consuming 5 bytes. -fI[0] = #7f7fffff = 3.4028235e+38 -fI[1] = #7f800000 = Infinity -fI[1] == strtof - - -Input: 9.0259718793241475e-277 -strtof consumes 23 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 23 bytes. -fI[0] == fI[1] == strtof - - -Input: 9.025971879324147880346310405869e-277 -strtof consumes 37 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 37 bytes. -fI[0] == fI[1] == strtof - - -Input: 9.025971879324147880346310405868e-277 -strtof consumes 37 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 37 bytes. -fI[0] == fI[1] == strtof - - -Input: 2.2250738585072014e-308 -strtof consumes 23 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 23 bytes. -fI[0] == fI[1] == strtof - - -Input: 2.2250738585072013e-308 -strtof consumes 23 bytes and returns 0 = #0 -g_ffmt(0) gives 1 bytes: "0" - -strtoIf returns 80, consuming 23 bytes. -fI[0] == fI[1] == strtof - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 -strtof consumes 3 bytes and returns 1.0999999 = #3f8ccccc -g_ffmt(0) gives 9 bytes: "1.0999999" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3f8ccccc = 1.0999999 -fI[1] = #3f8ccccd = 1.1 -fI[0] == strtof - - -Input: -1.1 -strtof consumes 4 bytes and returns -1.0999999 = #bf8ccccc -g_ffmt(0) gives 10 bytes: "-1.0999999" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bf8ccccd = -1.1 -fI[1] = #bf8ccccc = -1.0999999 -fI[1] == strtof - - -Input: 1.2 -strtof consumes 3 bytes and returns 1.1999999 = #3f999999 -g_ffmt(0) gives 9 bytes: "1.1999999" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3f999999 = 1.1999999 -fI[1] = #3f99999a = 1.2 -fI[0] == strtof - - -Input: -1.2 -strtof consumes 4 bytes and returns -1.1999999 = #bf999999 -g_ffmt(0) gives 10 bytes: "-1.1999999" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bf99999a = -1.2 -fI[1] = #bf999999 = -1.1999999 -fI[1] == strtof - - -Input: 1.3 -strtof consumes 3 bytes and returns 1.3 = #3fa66666 -g_ffmt(0) gives 3 bytes: "1.3" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fa66666 = 1.3 -fI[1] = #3fa66667 = 1.3000001 -fI[0] == strtof - - -Input: -1.3 -strtof consumes 4 bytes and returns -1.3 = #bfa66666 -g_ffmt(0) gives 4 bytes: "-1.3" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfa66667 = -1.3000001 -fI[1] = #bfa66666 = -1.3 -fI[1] == strtof - - -Input: 1.4 -strtof consumes 3 bytes and returns 1.4 = #3fb33333 -g_ffmt(0) gives 3 bytes: "1.4" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fb33333 = 1.4 -fI[1] = #3fb33334 = 1.4000001 -fI[0] == strtof - - -Input: -1.4 -strtof consumes 4 bytes and returns -1.4 = #bfb33333 -g_ffmt(0) gives 4 bytes: "-1.4" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfb33334 = -1.4000001 -fI[1] = #bfb33333 = -1.4 -fI[1] == strtof - - -Input: 1.5 -strtof consumes 3 bytes and returns 1.5 = #3fc00000 -g_ffmt(0) gives 3 bytes: "1.5" - -strtoIf returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtof - - -Input: -1.5 -strtof consumes 4 bytes and returns -1.5 = #bfc00000 -g_ffmt(0) gives 4 bytes: "-1.5" - -strtoIf returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtof - - -Input: 1.6 -strtof consumes 3 bytes and returns 1.5999999 = #3fcccccc -g_ffmt(0) gives 9 bytes: "1.5999999" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3fcccccc = 1.5999999 -fI[1] = #3fcccccd = 1.6 -fI[0] == strtof - - -Input: -1.6 -strtof consumes 4 bytes and returns -1.5999999 = #bfcccccc -g_ffmt(0) gives 10 bytes: "-1.5999999" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bfcccccd = -1.6 -fI[1] = #bfcccccc = -1.5999999 -fI[1] == strtof - - -Input: 1.7 -strtof consumes 3 bytes and returns 1.6999999 = #3fd99999 -g_ffmt(0) gives 9 bytes: "1.6999999" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3fd99999 = 1.6999999 -fI[1] = #3fd9999a = 1.7 -fI[0] == strtof - - -Input: -1.7 -strtof consumes 4 bytes and returns -1.6999999 = #bfd99999 -g_ffmt(0) gives 10 bytes: "-1.6999999" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bfd9999a = -1.7 -fI[1] = #bfd99999 = -1.6999999 -fI[1] == strtof - - -Input: 1.8 -strtof consumes 3 bytes and returns 1.8 = #3fe66666 -g_ffmt(0) gives 3 bytes: "1.8" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fe66666 = 1.8 -fI[1] = #3fe66667 = 1.8000001 -fI[0] == strtof - - -Input: -1.8 -strtof consumes 4 bytes and returns -1.8 = #bfe66666 -g_ffmt(0) gives 4 bytes: "-1.8" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfe66667 = -1.8000001 -fI[1] = #bfe66666 = -1.8 -fI[1] == strtof - - -Input: 1.9 -strtof consumes 3 bytes and returns 1.9 = #3ff33333 -g_ffmt(0) gives 3 bytes: "1.9" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3ff33333 = 1.9 -fI[1] = #3ff33334 = 1.9000001 -fI[0] == strtof - - -Input: -1.9 -strtof consumes 4 bytes and returns -1.9 = #bff33333 -g_ffmt(0) gives 4 bytes: "-1.9" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bff33334 = -1.9000001 -fI[1] = #bff33333 = -1.9 -fI[1] == strtof - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 -strtof consumes 3 bytes and returns 1.1 = #3f8ccccd -g_ffmt(0) gives 3 bytes: "1.1" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3f8ccccc = 1.0999999 -fI[1] = #3f8ccccd = 1.1 -fI[1] == strtof - - -Input: -1.1 -strtof consumes 4 bytes and returns -1.1 = #bf8ccccd -g_ffmt(0) gives 4 bytes: "-1.1" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bf8ccccd = -1.1 -fI[1] = #bf8ccccc = -1.0999999 -fI[0] == strtof - - -Input: 1.2 -strtof consumes 3 bytes and returns 1.2 = #3f99999a -g_ffmt(0) gives 3 bytes: "1.2" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3f999999 = 1.1999999 -fI[1] = #3f99999a = 1.2 -fI[1] == strtof - - -Input: -1.2 -strtof consumes 4 bytes and returns -1.2 = #bf99999a -g_ffmt(0) gives 4 bytes: "-1.2" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bf99999a = -1.2 -fI[1] = #bf999999 = -1.1999999 -fI[0] == strtof - - -Input: 1.3 -strtof consumes 3 bytes and returns 1.3 = #3fa66666 -g_ffmt(0) gives 3 bytes: "1.3" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fa66666 = 1.3 -fI[1] = #3fa66667 = 1.3000001 -fI[0] == strtof - - -Input: -1.3 -strtof consumes 4 bytes and returns -1.3 = #bfa66666 -g_ffmt(0) gives 4 bytes: "-1.3" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfa66667 = -1.3000001 -fI[1] = #bfa66666 = -1.3 -fI[1] == strtof - - -Input: 1.4 -strtof consumes 3 bytes and returns 1.4 = #3fb33333 -g_ffmt(0) gives 3 bytes: "1.4" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fb33333 = 1.4 -fI[1] = #3fb33334 = 1.4000001 -fI[0] == strtof - - -Input: -1.4 -strtof consumes 4 bytes and returns -1.4 = #bfb33333 -g_ffmt(0) gives 4 bytes: "-1.4" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfb33334 = -1.4000001 -fI[1] = #bfb33333 = -1.4 -fI[1] == strtof - - -Input: 1.5 -strtof consumes 3 bytes and returns 1.5 = #3fc00000 -g_ffmt(0) gives 3 bytes: "1.5" - -strtoIf returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtof - - -Input: -1.5 -strtof consumes 4 bytes and returns -1.5 = #bfc00000 -g_ffmt(0) gives 4 bytes: "-1.5" - -strtoIf returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtof - - -Input: 1.6 -strtof consumes 3 bytes and returns 1.6 = #3fcccccd -g_ffmt(0) gives 3 bytes: "1.6" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3fcccccc = 1.5999999 -fI[1] = #3fcccccd = 1.6 -fI[1] == strtof - - -Input: -1.6 -strtof consumes 4 bytes and returns -1.6 = #bfcccccd -g_ffmt(0) gives 4 bytes: "-1.6" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bfcccccd = -1.6 -fI[1] = #bfcccccc = -1.5999999 -fI[0] == strtof - - -Input: 1.7 -strtof consumes 3 bytes and returns 1.7 = #3fd9999a -g_ffmt(0) gives 3 bytes: "1.7" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3fd99999 = 1.6999999 -fI[1] = #3fd9999a = 1.7 -fI[1] == strtof - - -Input: -1.7 -strtof consumes 4 bytes and returns -1.7 = #bfd9999a -g_ffmt(0) gives 4 bytes: "-1.7" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bfd9999a = -1.7 -fI[1] = #bfd99999 = -1.6999999 -fI[0] == strtof - - -Input: 1.8 -strtof consumes 3 bytes and returns 1.8 = #3fe66666 -g_ffmt(0) gives 3 bytes: "1.8" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fe66666 = 1.8 -fI[1] = #3fe66667 = 1.8000001 -fI[0] == strtof - - -Input: -1.8 -strtof consumes 4 bytes and returns -1.8 = #bfe66666 -g_ffmt(0) gives 4 bytes: "-1.8" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfe66667 = -1.8000001 -fI[1] = #bfe66666 = -1.8 -fI[1] == strtof - - -Input: 1.9 -strtof consumes 3 bytes and returns 1.9 = #3ff33333 -g_ffmt(0) gives 3 bytes: "1.9" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3ff33333 = 1.9 -fI[1] = #3ff33334 = 1.9000001 -fI[0] == strtof - - -Input: -1.9 -strtof consumes 4 bytes and returns -1.9 = #bff33333 -g_ffmt(0) gives 4 bytes: "-1.9" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bff33334 = -1.9000001 -fI[1] = #bff33333 = -1.9 -fI[1] == strtof - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 -strtof consumes 3 bytes and returns 1.1 = #3f8ccccd -g_ffmt(0) gives 3 bytes: "1.1" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3f8ccccc = 1.0999999 -fI[1] = #3f8ccccd = 1.1 -fI[1] == strtof - - -Input: -1.1 -strtof consumes 4 bytes and returns -1.0999999 = #bf8ccccc -g_ffmt(0) gives 10 bytes: "-1.0999999" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bf8ccccd = -1.1 -fI[1] = #bf8ccccc = -1.0999999 -fI[1] == strtof - - -Input: 1.2 -strtof consumes 3 bytes and returns 1.2 = #3f99999a -g_ffmt(0) gives 3 bytes: "1.2" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3f999999 = 1.1999999 -fI[1] = #3f99999a = 1.2 -fI[1] == strtof - - -Input: -1.2 -strtof consumes 4 bytes and returns -1.1999999 = #bf999999 -g_ffmt(0) gives 10 bytes: "-1.1999999" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bf99999a = -1.2 -fI[1] = #bf999999 = -1.1999999 -fI[1] == strtof - - -Input: 1.3 -strtof consumes 3 bytes and returns 1.3000001 = #3fa66667 -g_ffmt(0) gives 9 bytes: "1.3000001" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fa66666 = 1.3 -fI[1] = #3fa66667 = 1.3000001 -fI[1] == strtof - - -Input: -1.3 -strtof consumes 4 bytes and returns -1.3 = #bfa66666 -g_ffmt(0) gives 4 bytes: "-1.3" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfa66667 = -1.3000001 -fI[1] = #bfa66666 = -1.3 -fI[1] == strtof - - -Input: 1.4 -strtof consumes 3 bytes and returns 1.4000001 = #3fb33334 -g_ffmt(0) gives 9 bytes: "1.4000001" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fb33333 = 1.4 -fI[1] = #3fb33334 = 1.4000001 -fI[1] == strtof - - -Input: -1.4 -strtof consumes 4 bytes and returns -1.4 = #bfb33333 -g_ffmt(0) gives 4 bytes: "-1.4" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfb33334 = -1.4000001 -fI[1] = #bfb33333 = -1.4 -fI[1] == strtof - - -Input: 1.5 -strtof consumes 3 bytes and returns 1.5 = #3fc00000 -g_ffmt(0) gives 3 bytes: "1.5" - -strtoIf returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtof - - -Input: -1.5 -strtof consumes 4 bytes and returns -1.5 = #bfc00000 -g_ffmt(0) gives 4 bytes: "-1.5" - -strtoIf returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtof - - -Input: 1.6 -strtof consumes 3 bytes and returns 1.6 = #3fcccccd -g_ffmt(0) gives 3 bytes: "1.6" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3fcccccc = 1.5999999 -fI[1] = #3fcccccd = 1.6 -fI[1] == strtof - - -Input: -1.6 -strtof consumes 4 bytes and returns -1.5999999 = #bfcccccc -g_ffmt(0) gives 10 bytes: "-1.5999999" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bfcccccd = -1.6 -fI[1] = #bfcccccc = -1.5999999 -fI[1] == strtof - - -Input: 1.7 -strtof consumes 3 bytes and returns 1.7 = #3fd9999a -g_ffmt(0) gives 3 bytes: "1.7" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3fd99999 = 1.6999999 -fI[1] = #3fd9999a = 1.7 -fI[1] == strtof - - -Input: -1.7 -strtof consumes 4 bytes and returns -1.6999999 = #bfd99999 -g_ffmt(0) gives 10 bytes: "-1.6999999" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bfd9999a = -1.7 -fI[1] = #bfd99999 = -1.6999999 -fI[1] == strtof - - -Input: 1.8 -strtof consumes 3 bytes and returns 1.8000001 = #3fe66667 -g_ffmt(0) gives 9 bytes: "1.8000001" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fe66666 = 1.8 -fI[1] = #3fe66667 = 1.8000001 -fI[1] == strtof - - -Input: -1.8 -strtof consumes 4 bytes and returns -1.8 = #bfe66666 -g_ffmt(0) gives 4 bytes: "-1.8" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfe66667 = -1.8000001 -fI[1] = #bfe66666 = -1.8 -fI[1] == strtof - - -Input: 1.9 -strtof consumes 3 bytes and returns 1.9000001 = #3ff33334 -g_ffmt(0) gives 9 bytes: "1.9000001" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3ff33333 = 1.9 -fI[1] = #3ff33334 = 1.9000001 -fI[1] == strtof - - -Input: -1.9 -strtof consumes 4 bytes and returns -1.9 = #bff33333 -g_ffmt(0) gives 4 bytes: "-1.9" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bff33334 = -1.9000001 -fI[1] = #bff33333 = -1.9 -fI[1] == strtof - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 -strtof consumes 3 bytes and returns 1.0999999 = #3f8ccccc -g_ffmt(0) gives 9 bytes: "1.0999999" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3f8ccccc = 1.0999999 -fI[1] = #3f8ccccd = 1.1 -fI[0] == strtof - - -Input: -1.1 -strtof consumes 4 bytes and returns -1.1 = #bf8ccccd -g_ffmt(0) gives 4 bytes: "-1.1" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bf8ccccd = -1.1 -fI[1] = #bf8ccccc = -1.0999999 -fI[0] == strtof - - -Input: 1.2 -strtof consumes 3 bytes and returns 1.1999999 = #3f999999 -g_ffmt(0) gives 9 bytes: "1.1999999" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3f999999 = 1.1999999 -fI[1] = #3f99999a = 1.2 -fI[0] == strtof - - -Input: -1.2 -strtof consumes 4 bytes and returns -1.2 = #bf99999a -g_ffmt(0) gives 4 bytes: "-1.2" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bf99999a = -1.2 -fI[1] = #bf999999 = -1.1999999 -fI[0] == strtof - - -Input: 1.3 -strtof consumes 3 bytes and returns 1.3 = #3fa66666 -g_ffmt(0) gives 3 bytes: "1.3" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fa66666 = 1.3 -fI[1] = #3fa66667 = 1.3000001 -fI[0] == strtof - - -Input: -1.3 -strtof consumes 4 bytes and returns -1.3000001 = #bfa66667 -g_ffmt(0) gives 10 bytes: "-1.3000001" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfa66667 = -1.3000001 -fI[1] = #bfa66666 = -1.3 -fI[0] == strtof - - -Input: 1.4 -strtof consumes 3 bytes and returns 1.4 = #3fb33333 -g_ffmt(0) gives 3 bytes: "1.4" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fb33333 = 1.4 -fI[1] = #3fb33334 = 1.4000001 -fI[0] == strtof - - -Input: -1.4 -strtof consumes 4 bytes and returns -1.4000001 = #bfb33334 -g_ffmt(0) gives 10 bytes: "-1.4000001" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfb33334 = -1.4000001 -fI[1] = #bfb33333 = -1.4 -fI[0] == strtof - - -Input: 1.5 -strtof consumes 3 bytes and returns 1.5 = #3fc00000 -g_ffmt(0) gives 3 bytes: "1.5" - -strtoIf returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtof - - -Input: -1.5 -strtof consumes 4 bytes and returns -1.5 = #bfc00000 -g_ffmt(0) gives 4 bytes: "-1.5" - -strtoIf returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtof - - -Input: 1.6 -strtof consumes 3 bytes and returns 1.5999999 = #3fcccccc -g_ffmt(0) gives 9 bytes: "1.5999999" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3fcccccc = 1.5999999 -fI[1] = #3fcccccd = 1.6 -fI[0] == strtof - - -Input: -1.6 -strtof consumes 4 bytes and returns -1.6 = #bfcccccd -g_ffmt(0) gives 4 bytes: "-1.6" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bfcccccd = -1.6 -fI[1] = #bfcccccc = -1.5999999 -fI[0] == strtof - - -Input: 1.7 -strtof consumes 3 bytes and returns 1.6999999 = #3fd99999 -g_ffmt(0) gives 9 bytes: "1.6999999" - -strtoIf returns 33, consuming 3 bytes. -fI[0] = #3fd99999 = 1.6999999 -fI[1] = #3fd9999a = 1.7 -fI[0] == strtof - - -Input: -1.7 -strtof consumes 4 bytes and returns -1.7 = #bfd9999a -g_ffmt(0) gives 4 bytes: "-1.7" - -strtoIf returns 41, consuming 4 bytes. -fI[0] = #bfd9999a = -1.7 -fI[1] = #bfd99999 = -1.6999999 -fI[0] == strtof - - -Input: 1.8 -strtof consumes 3 bytes and returns 1.8 = #3fe66666 -g_ffmt(0) gives 3 bytes: "1.8" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3fe66666 = 1.8 -fI[1] = #3fe66667 = 1.8000001 -fI[0] == strtof - - -Input: -1.8 -strtof consumes 4 bytes and returns -1.8000001 = #bfe66667 -g_ffmt(0) gives 10 bytes: "-1.8000001" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bfe66667 = -1.8000001 -fI[1] = #bfe66666 = -1.8 -fI[0] == strtof - - -Input: 1.9 -strtof consumes 3 bytes and returns 1.9 = #3ff33333 -g_ffmt(0) gives 3 bytes: "1.9" - -strtoIf returns 17, consuming 3 bytes. -fI[0] = #3ff33333 = 1.9 -fI[1] = #3ff33334 = 1.9000001 -fI[0] == strtof - - -Input: -1.9 -strtof consumes 4 bytes and returns -1.9000001 = #bff33334 -g_ffmt(0) gives 10 bytes: "-1.9000001" - -strtoIf returns 25, consuming 4 bytes. -fI[0] = #bff33334 = -1.9000001 -fI[1] = #bff33333 = -1.9 -fI[0] == strtof - diff --git a/contrib/gdtoa/test/ftest.c b/contrib/gdtoa/test/ftest.c deleted file mode 100644 index afafe85..0000000 --- a/contrib/gdtoa/test/ftest.c +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998-2001 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -/* Test program for g_ffmt, strtof, strtoIf, strtopf, and strtorf. - * - * Inputs (on stdin): - * r rounding_mode - * n ndig - * number - * #hex - * - * rounding_mode values: - * 0 = toward zero - * 1 = nearest - * 2 = toward +Infinity - * 3 = toward -Infinity - * - * where number is a decimal floating-point number, - * hex is a string of <= 8 Hex digits for the internal representation - * of the number, and ndig is a parameters to g_ffmt. - */ - -#include "gdtoa.h" -#include -#include - - extern int getround ANSI((int,char*)); - - static char ibuf[2048], obuf[1024]; - -#define U (unsigned long) - - int -main(Void) -{ - ULong *L; - char *s, *se, *se1; - int dItry, i, i1, ndig = 0, r = 1; - float f, f1, fI[2]; - - L = (ULong*)&f; - while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) { - while(*s <= ' ') - if (!*s++) - continue; - dItry = 0; - switch(*s) { - case 'r': - r = getround(r, s); - continue; - case 'n': - i = s[1]; - if (i <= ' ' || i >= '0' && i <= '9') { - ndig = atoi(s+1); - continue; - } - break; /* nan? */ - case '#': - sscanf(s+1, "%lx", &L[0]); - printf("\nInput: %s", ibuf); - printf(" --> f = #%lx\n", L[0]); - goto fmt_test; - } - dItry = 1; - printf("\nInput: %s", ibuf); - i = strtorf(ibuf, &se, r, &f); - if (r == 1) { - if (f != (i1 = strtopf(ibuf, &se1, &f1), f1) - || se != se1 || i != i1) { - printf("***strtopf and strtorf disagree!!\n"); - if (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) - printf("***strtof and strtorf disagree!\n"); - } - printf("strtof consumes %d bytes and returns %.8g = #%lx\n", - (int)(se-ibuf), f, U *(ULong*)&f); - fmt_test: - se = g_ffmt(obuf, &f, ndig, sizeof(obuf)); - printf("g_ffmt(%d) gives %d bytes: \"%s\"\n\n", - ndig, (int)(se-obuf), se ? obuf : ""); - if (!dItry) - continue; - 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) - printf("fI[0] == fI[1] == strtof\n"); - else - printf("fI[0] == fI[1] = #%lx = %.8g\n", - U *(ULong*)fI, fI[0]); - } - else { - 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) - printf("fI[0] == strtof\n"); - else if (fI[1] == f) - printf("fI[1] == strtof\n"); - else - printf("**** Both differ from strtof ****\n"); - } - printf("\n"); - } - return 0; - } diff --git a/contrib/gdtoa/test/getround.c b/contrib/gdtoa/test/getround.c deleted file mode 100644 index ec1ca11..0000000 --- a/contrib/gdtoa/test/getround.c +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -#include -#include - -static char *dir[4] = { "toward zero", "nearest", "toward +Infinity", - "toward -Infinity" }; - - int -#ifdef KR_headers -getround(r, s) int r; char *s; -#else -getround(int r, char *s) -#endif -{ - int i; - - i = atoi(s+1); - if (i >= 0 && i < 4) { - printf("Rounding mode for strtor... "); - if (i == r) - printf("was and is %d (%s)\n", i, dir[i]); - else - printf("changed from %d (%s) to %d (%s)\n", - r, dir[r], i, dir[i]); - return i; - } - printf("Bad rounding direction %d: choose among\n", i); - for(i = 0; i < 4; i++) - printf("\t%d (%s)\n", i, dir[i]); - printf("Leaving rounding mode for strtor... at %d (%s)\n", r, dir[r]); - return r; - } diff --git a/contrib/gdtoa/test/makefile b/contrib/gdtoa/test/makefile deleted file mode 100644 index 7e48915..0000000 --- a/contrib/gdtoa/test/makefile +++ /dev/null @@ -1,135 +0,0 @@ -# /**************************************************************** -# Copyright (C) 1998, 2000 by Lucent Technologies -# 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 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. -# -# ****************************************************************/ - -.SUFFIXES: .c .o -CC = cc -CFLAGS = -g -I.. -A = ../gdtoa.a - -.c.o: - $(CC) -c $(CFLAGS) $*.c - -all: dt dItest ddtest dtest ftest Qtest xLtest xtest ddtestsi dItestsi tests - -dt = dt.o $A -dt: $(dt) - $(CC) -o dt $(dt) - -dItest = dItest.o getround.o $A -dItest: $(dItest) - $(CC) -o dItest $(dItest) - -ddtest = ddtest.o getround.o $A -ddtest: $(ddtest) - $(CC) -o ddtest $(ddtest) - -dtest = dtest.o getround.o $A -dtest: $(dtest) - $(CC) -o dtest $(dtest) - -ftest = ftest.o getround.o $A -ftest: $(ftest) - $(CC) -o ftest $(ftest) - -Qtest = Qtest.o getround.o $A -Qtest: $(Qtest) - $(CC) -o Qtest $(Qtest) - -xtest = xtest.o getround.o $A -xtest: $(xtest) - $(CC) -o xtest $(xtest) - -xLtest = xLtest.o getround.o $A -xLtest: $(xLtest) - $(CC) -o xLtest $(xLtest) - -strtopddSI.o: strtopddSI.c ../strtopdd.c - -strtorddSI.o: strtorddSI.c ../strtordd.c - -strtodISI.o: strtodISI.c ../strtodI.c - -strtoIddSI.o: strtoIddSI.c ../strtoIdd.c - -strtoIdSI.o: strtoIdSI.c ../strtoId.c - -ddtestsi = ddtest.o strtopddSI.o strtorddSI.o strtoIddSI.o getround.o $A -ddtestsi: $(ddtestsi) - $(CC) -o ddtestsi $(ddtestsi) - -dItestsi = dItest.o strtodISI.o strtoIdSI.o getround.o $A -dItestsi: $(dItestsi) - $(CC) -o dItestsi $(dItestsi) - -strtodt = strtodt.o $A -strtodt: $(strtodt) - $(CC) -o strtodt $(strtodt) - -# xQtest generates cp commands that depend on sizeof(long double). -# See the source for details. If you know better, create Q.out, -# x.out and xL.out by copying the relevant *.ou0 or *.ou1 files -# to the corresponding .out files. In short, the *.ou0 files are -# for long double == double; x.ou1 and xL.ou1 are for -# long double == extended (a la 80x87 and MC680x0), and Q.ou1 is -# for long double == quad. - -Q.out x.out xL.out: - $(CC) -o xQtest xQtest.c - ./xQtest | sh - rm -f xQtest xQtest.o - -## 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 - mkdir bad - cat testnos testnos1 | ./dt >zap 2>&1 - cmp dtst.out zap || mv zap bad/dtst.out - ./dItest zap 2>&1 - cmp dI.out zap || mv zap bad/dI.out - ./dItestsi zap 2>&1 - cmp dIsi.out zap || mv zap bad/dIsi.out - ./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;\ - cmp $$i.out zap || mv zap bad/$$i.out; done - ./strtodt testnos3 >bad/strtodt.out && rm bad/strtodt.out || \ - cat bad/strtodt.out - rmdir bad - touch tests - -xs0 = README Qtest.c dItest.c ddtest.c dtest.c dt.c ftest.c getround.c \ - strtoIdSI.c strtoIddSI.c strtodISI.c strtodt.c strtopddSI.c \ - strtorddSI.c xLtest.c xQtest.c xtest.c rtestnos testnos testnos1 \ - testnos3 dI.out dIsi.out ddsi.out dd.out dtst.out d.out f.out \ - x.ou0 xL.ou0 x.ou1 xL.ou1 Q.ou0 Q.ou1 makefile - -xsum.out: xsum0.out $(xs0) - xsum $(xs0) >xsum1.out - 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 -rf bad diff --git a/contrib/gdtoa/test/rtestnos b/contrib/gdtoa/test/rtestnos deleted file mode 100644 index cde95b7..0000000 --- a/contrib/gdtoa/test/rtestnos +++ /dev/null @@ -1,76 +0,0 @@ -r0 -1.1 --1.1 -1.2 --1.2 -1.3 --1.3 -1.4 --1.4 -1.5 --1.5 -1.6 --1.6 -1.7 --1.7 -1.8 --1.8 -1.9 --1.9 -r1 -1.1 --1.1 -1.2 --1.2 -1.3 --1.3 -1.4 --1.4 -1.5 --1.5 -1.6 --1.6 -1.7 --1.7 -1.8 --1.8 -1.9 --1.9 -r2 -1.1 --1.1 -1.2 --1.2 -1.3 --1.3 -1.4 --1.4 -1.5 --1.5 -1.6 --1.6 -1.7 --1.7 -1.8 --1.8 -1.9 --1.9 -r3 -1.1 --1.1 -1.2 --1.2 -1.3 --1.3 -1.4 --1.4 -1.5 --1.5 -1.6 --1.6 -1.7 --1.7 -1.8 --1.8 -1.9 --1.9 diff --git a/contrib/gdtoa/test/strtoIdSI.c b/contrib/gdtoa/test/strtoIdSI.c deleted file mode 100644 index c5342ed..0000000 --- a/contrib/gdtoa/test/strtoIdSI.c +++ /dev/null @@ -1,2 +0,0 @@ -#define Sudden_Underflow -#include "../strtoId.c" diff --git a/contrib/gdtoa/test/strtoIddSI.c b/contrib/gdtoa/test/strtoIddSI.c deleted file mode 100644 index 2966259..0000000 --- a/contrib/gdtoa/test/strtoIddSI.c +++ /dev/null @@ -1,2 +0,0 @@ -#define Sudden_Underflow -#include "../strtoIdd.c" diff --git a/contrib/gdtoa/test/strtodISI.c b/contrib/gdtoa/test/strtodISI.c deleted file mode 100644 index 66d2add..0000000 --- a/contrib/gdtoa/test/strtodISI.c +++ /dev/null @@ -1,2 +0,0 @@ -#define Sudden_Underflow -#include "../strtodI.c" diff --git a/contrib/gdtoa/test/strtodt.c b/contrib/gdtoa/test/strtodt.c deleted file mode 100644 index da74660..0000000 --- a/contrib/gdtoa/test/strtodt.c +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 2001 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -/* Test strtod. */ - -/* On stdin, read triples: d x y: - * d = decimal string - * x = high-order Hex value expected from strtod - * y = low-order Hex value - * Complain about errors. - */ - -#include -#include -#include - - static int W0, W1; - typedef union { - double d; - long L[2]; - } U; - - static int -process(char *fname, FILE *f) -{ - U a, b; - char buf[2048]; - double d; - char *s; - int line, n; - - line = n = 0; - - top: - while(fgets(s = buf, sizeof(buf), f)) { - line++; - while(*s <= ' ') - if (!*s++) - goto top; /* break 2 */ - if (*s == '#') - continue; - while(*s > ' ') - s++; - if (sscanf(s,"\t%lx\t%lx", &a.L[0], &a.L[1]) != 2) { - printf("Badly formatted line %d of %s\n", - line, fname); - n++; - continue; - } - b.d = strtod(buf,0); - if (b.L[W0] != a.L[0] || b.L[W1] != a.L[1]) { - n++; - printf("Line %d of %s: got %lx %lx; expected %lx %lx\n", - line, fname, b.L[W0], b.L[W1], a.L[0], a.L[1]); - } - } - return n; - } - - int -main(int argc, char **argv) -{ - FILE *f; - char *prog, *s; - int n, rc; - U u; - - prog = argv[0]; - if (argc == 2 && !strcmp(argv[1],"-?")) { - fprintf(stderr, "Usage: %s [file [file...]]\n" - "\tto read data file(s) of tab-separated triples d x y with\n" - "\t\td decimal string\n" - "\t\tx = high-order Hex value expected from strtod\n" - "\t\ty = low-order Hex value\n" - "\tComplain about errors by strtod.\n" - "\tIf no files, read triples from stdin.\n", - prog); - return 0; - } - - /* determine endian-ness */ - - u.d = 1.; - W0 = u.L[0] == 0; - W1 = 1 - W0; - - /* test */ - - n = rc = 0; - if (argc <= 1) - n = process("", stdin); - else - while(s = *++argv) - if (f = fopen(s,"r")) { - n += process(s, f); - fclose(f); - } - else { - rc = 2; - fprintf(stderr, "Cannot open %s\n", s); - } - printf("%d bad conversions\n", n); - if (n) - rc |= 1; - return rc; - } diff --git a/contrib/gdtoa/test/strtopddSI.c b/contrib/gdtoa/test/strtopddSI.c deleted file mode 100644 index d2004e5..0000000 --- a/contrib/gdtoa/test/strtopddSI.c +++ /dev/null @@ -1,2 +0,0 @@ -#define Sudden_Underflow -#include "../strtopdd.c" diff --git a/contrib/gdtoa/test/strtorddSI.c b/contrib/gdtoa/test/strtorddSI.c deleted file mode 100644 index dd6a381..0000000 --- a/contrib/gdtoa/test/strtorddSI.c +++ /dev/null @@ -1,2 +0,0 @@ -#define Sudden_Underflow -#include "../strtordd.c" diff --git a/contrib/gdtoa/test/testnos b/contrib/gdtoa/test/testnos deleted file mode 100644 index a36a986..0000000 --- a/contrib/gdtoa/test/testnos +++ /dev/null @@ -1,28 +0,0 @@ -1.23 -1.23e+20 -1.23e-20 -1.23456789 -1.23456589e+20 -1.23e+30 -1.23e-30 -1.23456789e-20 -1.23456789e-30 -1.234567890123456789 -1.23456789012345678901234567890123456789 -1.23e306 -1.23e-306 -1.23e-320 -1.23e-20 -1.23456789e307 -1.23456589e-307 -1.234567890123456789 -1.234567890123456789e301 -1.234567890123456789e-301 -1.234567890123456789e-321 -1e23 -1e310 -9.0259718793241475e-277 -9.025971879324147880346310405869e-277 -9.025971879324147880346310405868e-277 -2.2250738585072014e-308 -2.2250738585072013e-308 diff --git a/contrib/gdtoa/test/testnos1 b/contrib/gdtoa/test/testnos1 deleted file mode 100644 index d734b35..0000000 --- a/contrib/gdtoa/test/testnos1 +++ /dev/null @@ -1,20 +0,0 @@ -1.23:2 6 -1.23:4 6 -1.23e+20:2 6 -1.23e+20:4 6 -1.23e-20:2 6 -1.23e-20:4 6 -1.23456789:2 6 -1.23456789:4 6 -1.23456589e+20:2 6 -1.23456589e+20:4 6 -1.23456789e-20:2 6 -1.23456789e-20:4 6 -1234565:2 6 -1234565:4 6 -1.234565:2 6 -1.234565:4 6 -1.234565e+20:2 6 -1.234565e+20:4 6 -1.234565e-20:2 6 -1.234565e-20:4 6 diff --git a/contrib/gdtoa/test/testnos3 b/contrib/gdtoa/test/testnos3 deleted file mode 100644 index be48902..0000000 --- a/contrib/gdtoa/test/testnos3 +++ /dev/null @@ -1,328 +0,0 @@ -# Test triples for strtodt, derived from Fred Tydeman's posting -# of 26 February 1996 to comp.arch.arithmetic. - -9e0306 7fa9a202 8368022e -4e-079 2fa7b6d7 1d20b96c -7e-261 9eb8d7e 32be6396 -6e-025 3ae7361c b863de62 -7e-161 1eaf7e0d b3799aa3 -7e0289 7c1cbb54 7777a285 -5e0079 507afcef 51f0fb5f -1e0080 508afcef 51f0fb5f -7e-303 1333391 31c46f8b -5e0152 5fa317e5 ef3ab327 -5e0125 5a07a2ec c414a03f -2e0126 5a27a2ec c414a03f -7e-141 22d5570f 59bd178c -4e-192 18323ff0 6eea847a -9e0043 49102498 ea6df0c4 -1e0303 7ed754e3 1cd072da -95e-089 2dde3cbc 9907fdc8 -85e0194 689d1c26 db7d0dae -69e0267 77c0b7cb 60c994da -97e-019 3c665dde 8e688ba6 -37e0046 49d033d7 eca0adef -74e0046 49e033d7 eca0adef -61e-099 2bc0ad83 6f269a17 -53e-208 151b39ae 1909c31b -93e-234 fc27b2e 4f210075 -79e-095 2c9a5db8 12948281 -87e-274 772d36c f48e7abd -83e0025 4585747a b143e353 -17e-036 38b698cc dc60015a -53e0033 47246a34 18629ef6 -51e-074 30ecd5be e57763e6 -63e-022 3bbdc03b 8fd7016a -839e0143 5e3ae03f 245703e2 -749e-182 1abf1472 7744c63e -999e-026 3b282782 afe1869e -345e0266 77b0b7cb 60c994da -914e-102 2b5ffc81 bc29f02b -829e0102 55b7221a 79cdd1d9 -307e0090 5322d6b1 83fe4b55 -859e0182 6654374d 8b87ac63 -283e0085 5216c309 24bab4b -589e0187 675526be 9c22eb17 -302e0176 64fdcf7d f8f573b7 -604e0176 650dcf7d f8f573b7 -761e-244 de03cea 3586452e -647e0230 7044d64d 4079150c -755e0174 64a7d931 93f78fc6 -255e-075 30dcd5be e57763e6 -3391e0055 4c159bd3 ad46e346 -4147e-015 3d923d1b 5eb1d778 -3996e-026 3b482782 afe1869e -1998e-026 3b382782 afe1869e -3338e-296 335519a c5142aab -1669e-296 325519a c5142aab -8699e-276 772d2df 246ecd2d -5311e0243 73284e91 f4aa0fdb -7903e-096 2cd07c2d 27a5b989 -7611e-226 11d19b87 44033457 -3257e0058 4cb444b3 4a6fb3eb -6514e0058 4cc444b3 4a6fb3eb -3571e0263 77462644 c61d41aa -7142e0263 77562644 c61d41aa -5311e0242 72f3720e 5d54d97c -1617e-063 3384c98f ce16152e -51881e0037 4897d295 dc76da4 -31441e-118 285ef890 f5de4c86 -30179e0079 5143e272 a77478e8 -60358e0079 5153e272 a77478e8 -63876e-020 3cc70385 6844bdbf -31938e-020 3cb70385 6844bdbf -46073e-032 3a42405b 773fbdf3 -32941e0051 4b757eb8 ad52a5c9 -82081e0041 49770105 df3d47cb -38701e-215 1440492a 4a8a37fd -62745e0047 4ab0c52f e6dc6a1b -12549e0048 4ac0c52f e6dc6a1b -64009e-183 1af099b3 93b84832 -89275e0261 77262644 c61d41aa -75859e0025 46232645 e1ba93f0 -57533e0287 7c8272ed 2307f56a -584169e0229 70ad6570 59dc79aa -940189e-112 29eb99d6 240c1a28 -416121e0197 6a00fd07 ed297f80 -832242e0197 6a10fd07 ed297f80 -584738e0076 50e8a85e b277e645 -933587e-140 241b2487 28b9c117 -252601e0121 5a2dda59 2e398dd7 -358423e0274 79f9463b 59b8f2bd -892771e-213 14f25818 c7294f27 -410405e0040 49670105 df3d47cb -928609e-261 afbe2dd 66200bef -302276e-254 c55a462 d91c6ab3 -920657e-023 3c653a99 85dbde6c -609019e-025 3bf1f99e 11ea0a24 -252601e0120 59f7e1e0 f1c7a4ac -654839e-060 34b00e7d b3b3f242 -8823691e0130 5c5e597c b94b7ae -2920845e0228 709d6570 59dc79aa -9210917e0080 51fda232 347e6032 -5800419e-303 26e58ff a48f4fce -6119898e-243 ee3ecf2 2ea07863 -3059949e-243 ed3ecf2 2ea07863 -2572231e0223 6f90f73b e1dff9ad -5444097e-021 3cf8849d d33c95af -5783893e-127 26f7e590 2ce0e151 -3865421e-225 1295d4fe 53afec65 -4590831e0156 61b4689b 4a5fa201 -9181662e0156 61c4689b 4a5fa201 -5906361e-027 3bbbe45a 312d08a0 -7315057e0235 7225f0d4 8362a72 -9088115e0106 5762e51a 84a3c6a0 -1817623e0107 5772e51a 84a3c6a0 -44118455e0129 5c4e597c b94b7ae -35282041e0293 7e5512d5 273e62e8 -31279898e-291 5129b01 b6885d36 -15639949e-291 5029b01 b6885d36 -27966061e0145 5f955bcf 72fd10f9 -55932122e0145 5fa55bcf 72fd10f9 -70176353e-053 36900683 a21de855 -40277543e-032 3adf29ca ff893b1 -50609263e0157 622193af f1f1c8e3 -66094077e0077 518b37c4 b7928317 -84863171e0114 59406e98 f5ec8f37 -89396333e0264 786526f0 61ca9053 -87575437e-309 16e0732 602056c -78693511e-044 3870bc7b 7603a2ca -90285923e-206 16d14700 83f89d48 -30155207e-030 3b423a4a d20748a2 -245540327e0121 5acc569e 968e0944 -263125459e0287 7d44997a 298b2f2e -566446538e-257 c64472b a9550e86 -283223269e-257 c54472b a9550e86 -245540327e0122 5b01b623 1e18c5cb -491080654e0122 5b11b623 1e18c5cb -971212611e-126 27a397d3 c9745d2f -229058583e0052 4c76ce94 febdc7a5 -325270231e0039 49cc7ccf 90c9f8ab -989648089e-035 3a8880a3 d515e849 -653777767e0273 7a720223 f2b3a881 -923091487e0209 6d30bc60 e6896717 -526250918e0288 7d89bfd8 b3edfafa -350301748e-309 18e0732 602056c -741111169e-203 17a14fe7 daf8f3ae -667284113e-240 ff09355 f8050c02 -1227701635e0120 5abc569e 968e0944 -9981396317e-182 1c38afe1 a2a66aa -5232604057e-298 41465b8 96c24520 -5572170023e-088 2fb08478 22f765b2 -1964322616e0122 5b31b623 1e18c5cb -3928645232e0122 5b41b623 1e18c5cb -8715380633e-058 35f4614c 3219891f -4856063055e-127 279397d3 c9745d2f -8336960483e-153 223a06a1 24b95e1 -1007046393e-155 21a01891 fc4717fd -5378822089e-176 1d695fd4 c88d4b1b -5981342308e-190 1a83db11 ac608107 -7214782613e-086 3020b552 d2edcdea -5458466829e0142 5f70acde 6a98eb4c -9078555839e-109 2b5fc575 867314ee -6418488827e0079 526021f1 4ed7b3fa -65325840981e0069 5081a151 ddbd3c4a -49573485983e0089 54a221bd 871d2cf4 -46275205733e0074 51830e6c 7d4e3480 -92550411466e0074 51930e6c 7d4e3480 -41129842097e-202 1832c3e7 2d179607 -93227267727e-049 380960fe 8d5847f -41297294357e0185 688c4943 7fccfadb -41534892987e-067 343a1266 6477886d -42333842451e0201 6be0189a 26df575f -78564021519e-227 13115551 5fd37265 -53587107423e-061 35800a19 a3ffd981 -53827010643e-200 18a32fa6 9a69bd6d -83356057653e0193 6a4544e6 daee2a18 -45256834646e-118 29a541ec dfd48694 -45392779195e-110 2b4fc575 867314ee -23934638219e0291 7e81deaf 40ead9a0 -995779191233e0113 59e2d44e dcc51304 -997422852243e-265 b676688 faee99bc -653532977297e-123 28d925a0 aabcdc68 -938885684947e0147 60f11894 b202e9f4 -619534293513e0124 5c210c20 303fe0f1 -539879452414e-042 39a5e66d c3d6bdb5 -742522891517e0259 782c1c35 2fc3c309 -254901016865e-022 3dbc06d3 66394441 -685763015669e0280 7c85fd7a a44d9477 -384865004907e-285 72aa65b 58639e69 -286556458711e0081 5321958b 36c5102b -573112917422e0081 5331958b 36c5102b -769525178383e-150 234253ec e161420 -416780288265e0192 6a3544e6 daee2a18 -226963895975e-111 2b3fc575 867314ee -665592809339e0063 4f778b65 16c2b478 -3891901811465e0217 6f99ab82 61990292 -4764593340755e0069 50e4177a 9915fbf8 -6336156586177e0269 7a7173f7 6c63b792 -8233559360849e0095 56566fee 5649a7a -3662265515198e-107 2c538e6e dd48f2a3 -1831132757599e-107 2c438e6e dd48f2a3 -7812878489261e-179 1d726dae 7bbeda75 -6363857920591e0145 60b28a61 cf9483b7 -8811915538555e0082 53a51f50 8b287ae7 -9997878507563e-195 1a253db2 fea1ea31 -9224786422069e-291 634ee5d 56b32957 -6284426329974e-294 58d3409 dfbca26f -9199302046091e-062 35c13597 2630774c -6070482281213e-122 29423fa9 e6fcf47e -2780161250963e-301 405acc2 53064c2 -8233559360849e0094 5621f324 d11d4862 -72027097041701e0206 6d946778 12d3a606 -97297545286625e0215 6f79ab82 61990292 -99021992302453e-025 3da5c671 4def374c -54104687080198e-022 3e373cdf 8db7a7bc -33519685743233e0089 5537f203 339c9629 -67039371486466e0089 5547f203 339c9629 -39064392446305e-180 1d626dae 7bbeda75 -17796979903653e0261 78e072f3 819c1321 -28921916763211e0038 4a9eebab e0957af3 -87605699161665e0155 6302920f 96e7f9ef -41921560615349e-067 34d9b2a5 c4041e4b -80527976643809e0061 4f7c7c5a ea080a49 -72335858886654e-159 21cce77c 2b3328fc -52656615219377e0102 57f561de f4a9ee32 -15400733123779e-072 33b8bf7e 7fa6f02a -77003665618895e-073 33a8bf7e 7fa6f02a -475603213226859e-042 3a42d730 88f4050a -972708181182949e0116 5b218a7f 36172332 -246411729980464e-071 342eef5e 1f90ac34 -123205864990232e-071 341eef5e 1f90ac34 -609610927149051e-255 e104273 b18918b1 -475603213226859e-041 3a778cfc ab31064d -672574798934795e0065 508226c6 84c87261 -134514959786959e0066 509226c6 84c87261 -294897574603217e-151 2395f2df 5e675a0f -723047919080275e0036 4a7eebab e0957af3 -660191429952702e-088 30bddc7e 975c5045 -330095714976351e-088 30addc7e 975c5045 -578686871093232e-159 21fce77c 2b3328fc -144671717773308e-159 21dce77c 2b3328fc -385018328094475e-074 3398bf7e 7fa6f02a -330095714976351e-089 3077e398 7916a69e -2215901545757777e-212 171a80a6 e566428c -1702061899637397e-276 9cacc46 749dccfe -1864950924021923e0213 6f53ae60 753af6ca -3729901848043846e0213 6f63ae60 753af6ca -7487252720986826e-165 20f8823a 57adbef9 -3743626360493413e-165 20e8823a 57adbef9 -4988915232824583e0119 5be5f6de 9d5d6b5b -3771476185376383e0277 7cae3c14 d6916ce9 -6182410494241627e-119 2a81b964 58445d07 -2572981889477453e0142 609dfc11 fbf46087 -7793560217139653e0051 4dd28046 1b856ec5 -9163942927285259e-202 194fe601 457dce4d -6353227084707473e0155 63650aff 653ffe8a -4431803091515554e-211 17609068 4f5fe998 -9324754620109615e0211 6f0f7d67 21f7f144 -8870461176410409e0263 79d90529 a37b7e22 -90372559027740405e0143 612491da ad0ba280 -18074511805548081e0146 61a011f2 d73116f4 -54897030182071313e0029 496ec556 66d8f9ec -76232626624829156e-032 3ccb7738 11e75fe -59898021767894608e-165 2128823a 57adbef9 -29949010883947304e-165 2118823a 57adbef9 -26153245263757307e0049 4d83de00 5bd620df -27176258005319167e-261 d27c074 7bd76fa1 -18074511805548081e0147 61d4166f 8cfd5cb1 -24691002732654881e-115 2b759a27 83ce70ab -58483921078398283e0057 4f408ce4 99519ce3 -64409240769861689e-159 22692238 f7987779 -94080055902682397e-242 11364981 e39e66ca -31766135423537365e0154 63550aff 653ffe8a -68985865317742005e0164 657a999d dec72aca -13797173063548401e0165 658a999d dec72aca -902042358290366539e-281 9522dc0 1ca1cb8c -238296178309629163e0272 7c038fd9 3f1f5342 -783308178698887621e0226 72925ae6 2cb346d8 -439176241456570504e0029 499ec556 66d8f9ec -899810892172646163e0283 7e6adf51 fa055e03 -926145344610700019e-225 14f307a6 7f1f69ff -653831131593932675e0047 4d63de00 5bd620df -130766226318786535e0048 4d73de00 5bd620df -557035730189854663e-294 693bfac 6bc4767b -902042358290366539e-280 986b930 23ca3e6f -272104041512242479e0200 6d13bbb4 bf05f087 -544208083024484958e0200 6d23bbb4 bf05f087 -680429695511221511e0192 6b808ebc 116f8a20 -308975121073410857e0236 7490db75 cc001072 -792644927852378159e0078 53d7bff3 36d8ff06 -783308178698887621e0223 71f2cbac 35f71140 -8396094300569779681e-252 f8ab223 efcee35a -3507665085003296281e-074 346b85c0 26a264e4 -7322325862592278999e0074 5336775b 6caa5ae0 -6014546754280072926e0209 6f396397 b06732a4 -7120190517612959703e0120 5cc3220d cd5899fd -3507665085003296281e-073 34a13398 18257f0f -4345544743100783551e-218 168a9c42 e5b6d89f -9778613303868468131e-090 313146fe 1075e1ef -7539204280836061195e-082 32d3d969 e3dbe723 -7862637540082247119e-202 19eaba32 62ee707b -2176832332097939832e0200 6d43bbb4 bf05f087 -8643988913946659879e0115 5bbe71ec 1ed0a4f9 -5529436763613147623e0138 6079c677 be6f236e -6764958008109694533e-173 1fed0669 2e6f5ef6 -6802601037806061975e0197 6cbf92ba cb3cb40c -1360520207561212395e0198 6ccf92ba cb3cb40c -62259110684423957791e0047 4dcd8f2c fc20d6e8 -88800290202542652011e-226 1526cec5 1a43f41a -41010852717673354694e-221 16201295 4b6aabba -20505426358836677347e-221 16101295 4b6aabba -66102447903809911604e0055 4f776206 8a24fd55 -35600952588064798515e0119 5cb3220d cd5899fd -14371240869903838702e0205 6e78d92d 2bcc7a81 -57500690832492901689e0043 4cf65d3e 2acd616b -23432630639573022093e-107 2dbdd54c 40a2f25f -62259110684423957791e0048 4e02797c 1d948651 -35620497849450218807e-306 475b220 82529425 -69658634627134074624e0200 6d93bbb4 bf05f087 -99440755792436956989e-062 37362d10 462a26f4 -55277197169490210673e0081 54d945bf a911e32a -36992084760177624177e-318 1f8c5f9 551c2f9a -30888265282878466443e-111 2cf01b8e f28251fc - -# examples of bugs introduced 20001113, fixed 20010207 -# first is 2^-1075 (half the smallest denormal) -2.4703282292062327208828439643411068618252990130716238221279284125033775363510437593264991818081799618989828234772285886546332835517796989819938739800539093906315035659515570226392290858392449105184435931802849936536152500319370457678249219365623669863658480757001585769269903706311928279558551332927834338409351978015531246597263579574622766465272827220056374006485499977096599470454020828166226237857393450736339007967761930577506740176324673600968951340535537458516661134223766678604162159680461914467291840300530057530849048765391711386591646239524912623653881879636239373280423891018672348497668235089863388587925628302755995657524455507255189313690836254779186948667994968324049705821028513185451396213837722826145437693412532098591327667236328125e-324 0 0 -2.47032822920623272e-324 0 0 diff --git a/contrib/gdtoa/test/x.ou0 b/contrib/gdtoa/test/x.ou0 deleted file mode 100644 index 83daa47..0000000 --- a/contrib/gdtoa/test/x.ou0 +++ /dev/null @@ -1,1182 +0,0 @@ - -Input: 1.23 - -strtox consumes 4 bytes and returns 33 -with bits = #3fff 9d70 a3d7 a3d 70a4 -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] == strtox - - -Input: 1.23e+20 - -strtox consumes 8 bytes and returns 1 -with bits = #4041 d55e f90a 2da1 8000 -g_xfmt(0) gives 8 bytes: "1.23e+20" - -strtoIx returns 1, consuming 8 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.23e-20 - -strtox consumes 8 bytes and returns 17 -with bits = #3fbc e857 267b b3a9 84f2 -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[0] == strtox - - -Input: 1.23456789 - -strtox consumes 10 bytes and returns 33 -with bits = #3fff 9e06 5214 1ef0 dbf6 -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] == strtox - - -Input: 1.23456589e+20 - -strtox consumes 14 bytes and returns 1 -with bits = #4041 d629 bd33 5cc ba00 -g_xfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoIx returns 1, consuming 14 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.23e+30 - -strtox consumes 8 bytes and returns 17 -with bits = #4062 f865 8274 7dbc 824a -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[0] == strtox - - -Input: 1.23e-30 - -strtox consumes 8 bytes and returns 17 -with bits = #3f9b c794 337a 8085 54eb -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[0] == strtox - - -Input: 1.23456789e-20 - -strtox consumes 14 bytes and returns 17 -with bits = #3fbc e934 a38 f3d6 d352 -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[0] == strtox - - -Input: 1.23456789e-30 - -strtox consumes 14 bytes and returns 17 -with bits = #3f9b c851 f19d decc a8fc -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[0] == strtox - - -Input: 1.234567890123456789 - -strtox consumes 20 bytes and returns 17 -with bits = #3fff 9e06 5214 62cf db8d -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[0] == strtox - - -Input: 1.23456789012345678901234567890123456789 - -strtox consumes 40 bytes and returns 17 -with bits = #3fff 9e06 5214 62cf db8d -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[0] == strtox - - -Input: 1.23e306 - -strtox consumes 8 bytes and returns 17 -with bits = #43f7 e033 b668 e30f a6d5 -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[0] == strtox - - -Input: 1.23e-306 - -strtox consumes 9 bytes and returns 33 -with bits = #3c06 dd1d c2ed 1cb7 3f25 -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] == strtox - - -Input: 1.23e-320 - -strtox consumes 9 bytes and returns 33 -with bits = #3bd8 9b98 c371 844c 3f1a -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] == strtox - - -Input: 1.23e-20 - -strtox consumes 8 bytes and returns 17 -with bits = #3fbc e857 267b b3a9 84f2 -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[0] == strtox - - -Input: 1.23456789e307 - -strtox consumes 14 bytes and returns 17 -with bits = #43fb 8ca5 8a5e d766 de75 -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[0] == strtox - - -Input: 1.23456589e-307 - -strtox consumes 15 bytes and returns 17 -with bits = #3c03 b18c b5dc c22f d369 -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[0] == strtox - - -Input: 1.234567890123456789 - -strtox consumes 20 bytes and returns 17 -with bits = #3fff 9e06 5214 62cf db8d -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[0] == strtox - - -Input: 1.234567890123456789e301 - -strtox consumes 24 bytes and returns 33 -with bits = #43e7 937a 8baf ab20 980c -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] == strtox - - -Input: 1.234567890123456789e-301 - -strtox consumes 25 bytes and returns 33 -with bits = #3c17 a953 271a 5d06 9ad9 -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] == strtox - - -Input: 1.234567890123456789e-321 - -strtox consumes 25 bytes and returns 33 -with bits = #3bd4 f9e1 1b4c ea6d cce9 -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] == strtox - - -Input: 1e23 - -strtox consumes 4 bytes and returns 1 -with bits = #404b a968 163f a57 b400 -g_xfmt(0) gives 5 bytes: "1e+23" - -strtoIx returns 1, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1e310 - -strtox consumes 5 bytes and returns 33 -with bits = #4404 de81 e40a 34b cf50 -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] == strtox - - -Input: 9.0259718793241475e-277 - -strtox consumes 23 bytes and returns 33 -with bits = #3c69 ffff ffff ffff fcf7 -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] == strtox - - -Input: 9.025971879324147880346310405869e-277 - -strtox consumes 37 bytes and returns 17 -with bits = #3c6a 8000 0 0 0 -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[0] == strtox - - -Input: 9.025971879324147880346310405868e-277 - -strtox consumes 37 bytes and returns 33 -with bits = #3c6a 8000 0 0 0 -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] == strtox - - -Input: 2.2250738585072014e-308 - -strtox consumes 23 bytes and returns 17 -with bits = #3c01 8000 0 0 46 -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[0] == strtox - - -Input: 2.2250738585072013e-308 - -strtox consumes 23 bytes and returns 17 -with bits = #3c00 ffff ffff ffff fd4f -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[0] == strtox - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff 8ccc cccc cccc cccc -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[0] == strtox - - -Input: -1.1 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff 8ccc cccc cccc cccc -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] == strtox - - -Input: 1.2 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff 9999 9999 9999 9999 -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[0] == strtox - - -Input: -1.2 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff 9999 9999 9999 9999 -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] == strtox - - -Input: 1.3 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff a666 6666 6666 6666 -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[0] == strtox - - -Input: -1.3 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff a666 6666 6666 6666 -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] == strtox - - -Input: 1.4 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff b333 3333 3333 3333 -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[0] == strtox - - -Input: -1.4 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff b333 3333 3333 3333 -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] == strtox - - -Input: 1.5 - -strtox consumes 3 bytes and returns 1 -with bits = #3fff c000 0 0 0 -g_xfmt(0) gives 3 bytes: "1.5" - -strtoIx returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtox - - -Input: -1.5 - -strtox consumes 4 bytes and returns 9 -with bits = #bfff c000 0 0 0 -g_xfmt(0) gives 4 bytes: "-1.5" - -strtoIx returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.6 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff cccc cccc cccc cccc -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[0] == strtox - - -Input: -1.6 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff cccc cccc cccc cccc -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] == strtox - - -Input: 1.7 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff d999 9999 9999 9999 -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[0] == strtox - - -Input: -1.7 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff d999 9999 9999 9999 -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] == strtox - - -Input: 1.8 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff e666 6666 6666 6666 -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[0] == strtox - - -Input: -1.8 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff e666 6666 6666 6666 -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] == strtox - - -Input: 1.9 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff f333 3333 3333 3333 -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[0] == strtox - - -Input: -1.9 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff f333 3333 3333 3333 -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] == strtox - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff 8ccc cccc cccc cccd -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] == strtox - - -Input: -1.1 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff 8ccc cccc cccc cccd -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[0] == strtox - - -Input: 1.2 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff 9999 9999 9999 999a -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] == strtox - - -Input: -1.2 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff 9999 9999 9999 999a -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[0] == strtox - - -Input: 1.3 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff a666 6666 6666 6666 -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[0] == strtox - - -Input: -1.3 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff a666 6666 6666 6666 -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] == strtox - - -Input: 1.4 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff b333 3333 3333 3333 -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[0] == strtox - - -Input: -1.4 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff b333 3333 3333 3333 -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] == strtox - - -Input: 1.5 - -strtox consumes 3 bytes and returns 1 -with bits = #3fff c000 0 0 0 -g_xfmt(0) gives 3 bytes: "1.5" - -strtoIx returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtox - - -Input: -1.5 - -strtox consumes 4 bytes and returns 9 -with bits = #bfff c000 0 0 0 -g_xfmt(0) gives 4 bytes: "-1.5" - -strtoIx returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.6 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff cccc cccc cccc cccd -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] == strtox - - -Input: -1.6 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff cccc cccc cccc cccd -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[0] == strtox - - -Input: 1.7 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff d999 9999 9999 999a -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] == strtox - - -Input: -1.7 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff d999 9999 9999 999a -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[0] == strtox - - -Input: 1.8 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff e666 6666 6666 6666 -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[0] == strtox - - -Input: -1.8 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff e666 6666 6666 6666 -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] == strtox - - -Input: 1.9 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff f333 3333 3333 3333 -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[0] == strtox - - -Input: -1.9 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff f333 3333 3333 3333 -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] == strtox - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff 8ccc cccc cccc cccd -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] == strtox - - -Input: -1.1 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff 8ccc cccc cccc cccc -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] == strtox - - -Input: 1.2 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff 9999 9999 9999 999a -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] == strtox - - -Input: -1.2 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff 9999 9999 9999 9999 -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] == strtox - - -Input: 1.3 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff a666 6666 6666 6667 -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] == strtox - - -Input: -1.3 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff a666 6666 6666 6666 -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] == strtox - - -Input: 1.4 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff b333 3333 3333 3334 -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] == strtox - - -Input: -1.4 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff b333 3333 3333 3333 -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] == strtox - - -Input: 1.5 - -strtox consumes 3 bytes and returns 1 -with bits = #3fff c000 0 0 0 -g_xfmt(0) gives 3 bytes: "1.5" - -strtoIx returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtox - - -Input: -1.5 - -strtox consumes 4 bytes and returns 9 -with bits = #bfff c000 0 0 0 -g_xfmt(0) gives 4 bytes: "-1.5" - -strtoIx returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.6 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff cccc cccc cccc cccd -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] == strtox - - -Input: -1.6 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff cccc cccc cccc cccc -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] == strtox - - -Input: 1.7 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff d999 9999 9999 999a -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] == strtox - - -Input: -1.7 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff d999 9999 9999 9999 -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] == strtox - - -Input: 1.8 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff e666 6666 6666 6667 -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] == strtox - - -Input: -1.8 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff e666 6666 6666 6666 -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] == strtox - - -Input: 1.9 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff f333 3333 3333 3334 -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] == strtox - - -Input: -1.9 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff f333 3333 3333 3333 -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] == strtox - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff 8ccc cccc cccc cccc -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[0] == strtox - - -Input: -1.1 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff 8ccc cccc cccc cccd -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[0] == strtox - - -Input: 1.2 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff 9999 9999 9999 9999 -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[0] == strtox - - -Input: -1.2 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff 9999 9999 9999 999a -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[0] == strtox - - -Input: 1.3 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff a666 6666 6666 6666 -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[0] == strtox - - -Input: -1.3 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff a666 6666 6666 6667 -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[0] == strtox - - -Input: 1.4 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff b333 3333 3333 3333 -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[0] == strtox - - -Input: -1.4 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff b333 3333 3333 3334 -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[0] == strtox - - -Input: 1.5 - -strtox consumes 3 bytes and returns 1 -with bits = #3fff c000 0 0 0 -g_xfmt(0) gives 3 bytes: "1.5" - -strtoIx returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtox - - -Input: -1.5 - -strtox consumes 4 bytes and returns 9 -with bits = #bfff c000 0 0 0 -g_xfmt(0) gives 4 bytes: "-1.5" - -strtoIx returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.6 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff cccc cccc cccc cccc -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[0] == strtox - - -Input: -1.6 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff cccc cccc cccc cccd -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[0] == strtox - - -Input: 1.7 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff d999 9999 9999 9999 -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[0] == strtox - - -Input: -1.7 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff d999 9999 9999 999a -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[0] == strtox - - -Input: 1.8 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff e666 6666 6666 6666 -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[0] == strtox - - -Input: -1.8 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff e666 6666 6666 6667 -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[0] == strtox - - -Input: 1.9 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff f333 3333 3333 3333 -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[0] == strtox - - -Input: -1.9 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff f333 3333 3333 3334 -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[0] == strtox - diff --git a/contrib/gdtoa/test/x.ou1 b/contrib/gdtoa/test/x.ou1 deleted file mode 100644 index 3ebe74a..0000000 --- a/contrib/gdtoa/test/x.ou1 +++ /dev/null @@ -1,1460 +0,0 @@ - -Input: 1.23 - -strtox consumes 4 bytes and returns 33 -with bits = #3fff 9d70 a3d7 a3d 70a4 -printf("%.21Lg") gives 1.23000000000000000002 -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 -= 1.23000000000000000002 -fI[1] == strtox - - -Input: 1.23e+20 - -strtox consumes 8 bytes and returns 1 -with bits = #4041 d55e f90a 2da1 8000 -printf("%.21Lg") gives 123000000000000000000 -g_xfmt(0) gives 8 bytes: "1.23e+20" - -strtoIx returns 1, consuming 8 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.23e-20 - -strtox consumes 8 bytes and returns 17 -with bits = #3fbc e857 267b b3a9 84f2 -printf("%.21Lg") gives 1.22999999999999999997e-20 -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 -= 1.23000000000000000004e-20 -fI[0] == strtox - - -Input: 1.23456789 - -strtox consumes 10 bytes and returns 33 -with bits = #3fff 9e06 5214 1ef0 dbf6 -printf("%.21Lg") gives 1.23456789000000000003 -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 -= 1.23456789000000000003 -fI[1] == strtox - - -Input: 1.23456589e+20 - -strtox consumes 14 bytes and returns 1 -with bits = #4041 d629 bd33 5cc ba00 -printf("%.21Lg") gives 123456589000000000000 -g_xfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoIx returns 1, consuming 14 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.23e+30 - -strtox consumes 8 bytes and returns 17 -with bits = #4062 f865 8274 7dbc 824a -printf("%.21Lg") gives 1.22999999999999999999e+30 -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 -= 1.23000000000000000006e+30 -fI[0] == strtox - - -Input: 1.23e-30 - -strtox consumes 8 bytes and returns 17 -with bits = #3f9b c794 337a 8085 54eb -printf("%.21Lg") gives 1.22999999999999999999e-30 -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 -= 1.23000000000000000007e-30 -fI[0] == strtox - - -Input: 1.23456789e-20 - -strtox consumes 14 bytes and returns 17 -with bits = #3fbc e934 a38 f3d6 d352 -printf("%.21Lg") gives 1.23456788999999999998e-20 -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 -= 1.23456789000000000005e-20 -fI[0] == strtox - - -Input: 1.23456789e-30 - -strtox consumes 14 bytes and returns 17 -with bits = #3f9b c851 f19d decc a8fc -printf("%.21Lg") gives 1.23456788999999999999e-30 -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 -= 1.23456789000000000007e-30 -fI[0] == strtox - - -Input: 1.234567890123456789 - -strtox consumes 20 bytes and returns 17 -with bits = #3fff 9e06 5214 62cf db8d -printf("%.21Lg") gives 1.23456789012345678899 -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 -= 1.23456789012345678909 -fI[0] == strtox - - -Input: 1.23456789012345678901234567890123456789 - -strtox consumes 40 bytes and returns 17 -with bits = #3fff 9e06 5214 62cf db8d -printf("%.21Lg") gives 1.23456789012345678899 -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 -= 1.23456789012345678909 -fI[0] == strtox - - -Input: 1.23e306 - -strtox consumes 8 bytes and returns 17 -with bits = #43f7 e033 b668 e30f a6d5 -printf("%.21Lg") gives 1.22999999999999999997e+306 -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 -= 1.23000000000000000005e+306 -fI[0] == strtox - - -Input: 1.23e-306 - -strtox consumes 9 bytes and returns 33 -with bits = #3c06 dd1d c2ed 1cb7 3f25 -printf("%.21Lg") gives 1.23000000000000000002e-306 -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 -= 1.23000000000000000002e-306 -fI[1] == strtox - - -Input: 1.23e-320 - -strtox consumes 9 bytes and returns 33 -with bits = #3bd8 9b98 c371 844c 3f1a -printf("%.21Lg") gives 1.23000000000000000002e-320 -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 -= 1.23000000000000000002e-320 -fI[1] == strtox - - -Input: 1.23e-20 - -strtox consumes 8 bytes and returns 17 -with bits = #3fbc e857 267b b3a9 84f2 -printf("%.21Lg") gives 1.22999999999999999997e-20 -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 -= 1.23000000000000000004e-20 -fI[0] == strtox - - -Input: 1.23456789e307 - -strtox consumes 14 bytes and returns 17 -with bits = #43fb 8ca5 8a5e d766 de75 -printf("%.21Lg") gives 1.23456788999999999998e+307 -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 -= 1.23456789000000000011e+307 -fI[0] == strtox - - -Input: 1.23456589e-307 - -strtox consumes 15 bytes and returns 17 -with bits = #3c03 b18c b5dc c22f d369 -printf("%.21Lg") gives 1.23456588999999999999e-307 -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 -= 1.23456589000000000009e-307 -fI[0] == strtox - - -Input: 1.234567890123456789 - -strtox consumes 20 bytes and returns 17 -with bits = #3fff 9e06 5214 62cf db8d -printf("%.21Lg") gives 1.23456789012345678899 -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 -= 1.23456789012345678909 -fI[0] == strtox - - -Input: 1.234567890123456789e301 - -strtox consumes 24 bytes and returns 33 -with bits = #43e7 937a 8baf ab20 980c -printf("%.21Lg") gives 1.234567890123456789e+301 -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 -= 1.234567890123456789e+301 -fI[1] == strtox - - -Input: 1.234567890123456789e-301 - -strtox consumes 25 bytes and returns 33 -with bits = #3c17 a953 271a 5d06 9ad9 -printf("%.21Lg") gives 1.23456789012345678902e-301 -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 -= 1.23456789012345678902e-301 -fI[1] == strtox - - -Input: 1.234567890123456789e-321 - -strtox consumes 25 bytes and returns 33 -with bits = #3bd4 f9e1 1b4c ea6d cce9 -printf("%.21Lg") gives 1.234567890123456789e-321 -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 -= 1.234567890123456789e-321 -fI[1] == strtox - - -Input: 1e23 - -strtox consumes 4 bytes and returns 1 -with bits = #404b a968 163f a57 b400 -printf("%.21Lg") gives 1e+23 -g_xfmt(0) gives 5 bytes: "1e+23" - -strtoIx returns 1, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1e310 - -strtox consumes 5 bytes and returns 33 -with bits = #4404 de81 e40a 34b cf50 -printf("%.21Lg") gives 1e+310 -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 -= 1e+310 -fI[1] == strtox - - -Input: 9.0259718793241475e-277 - -strtox consumes 23 bytes and returns 33 -with bits = #3c69 ffff ffff ffff fcf7 -printf("%.21Lg") gives 9.02597187932414750016e-277 -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 -= 9.02597187932414750016e-277 -fI[1] == strtox - - -Input: 9.025971879324147880346310405869e-277 - -strtox consumes 37 bytes and returns 17 -with bits = #3c6a 8000 0 0 0 -printf("%.21Lg") gives 9.02597187932414788035e-277 -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 -= 9.02597187932414788132e-277 -fI[0] == strtox - - -Input: 9.025971879324147880346310405868e-277 - -strtox consumes 37 bytes and returns 33 -with bits = #3c6a 8000 0 0 0 -printf("%.21Lg") gives 9.02597187932414788035e-277 -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 -= 9.02597187932414788035e-277 -fI[1] == strtox - - -Input: 2.2250738585072014e-308 - -strtox consumes 23 bytes and returns 17 -with bits = #3c01 8000 0 0 46 -printf("%.21Lg") gives 2.22507385850720139998e-308 -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 -= 2.22507385850720140022e-308 -fI[0] == strtox - - -Input: 2.2250738585072013e-308 - -strtox consumes 23 bytes and returns 17 -with bits = #3c00 ffff ffff ffff fd4f -printf("%.21Lg") gives 2.22507385850720129998e-308 -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 -= 2.2250738585072013001e-308 -fI[0] == strtox - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff 8ccc cccc cccc cccc -printf("%.21Lg") gives 1.09999999999999999991 -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 -= 1.10000000000000000002 -fI[0] == strtox - - -Input: -1.1 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff 8ccc cccc cccc cccc -printf("%.21Lg") gives -1.09999999999999999991 -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 -= -1.09999999999999999991 -fI[1] == strtox - - -Input: 1.2 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff 9999 9999 9999 9999 -printf("%.21Lg") gives 1.19999999999999999993 -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 -= 1.20000000000000000004 -fI[0] == strtox - - -Input: -1.2 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff 9999 9999 9999 9999 -printf("%.21Lg") gives -1.19999999999999999993 -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 -= -1.19999999999999999993 -fI[1] == strtox - - -Input: 1.3 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff a666 6666 6666 6666 -printf("%.21Lg") gives 1.29999999999999999996 -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 -= 1.30000000000000000007 -fI[0] == strtox - - -Input: -1.3 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff a666 6666 6666 6666 -printf("%.21Lg") gives -1.29999999999999999996 -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 -= -1.29999999999999999996 -fI[1] == strtox - - -Input: 1.4 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff b333 3333 3333 3333 -printf("%.21Lg") gives 1.39999999999999999998 -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 -= 1.40000000000000000009 -fI[0] == strtox - - -Input: -1.4 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff b333 3333 3333 3333 -printf("%.21Lg") gives -1.39999999999999999998 -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 -= -1.39999999999999999998 -fI[1] == strtox - - -Input: 1.5 - -strtox consumes 3 bytes and returns 1 -with bits = #3fff c000 0 0 0 -printf("%.21Lg") gives 1.5 -g_xfmt(0) gives 3 bytes: "1.5" - -strtoIx returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtox - - -Input: -1.5 - -strtox consumes 4 bytes and returns 9 -with bits = #bfff c000 0 0 0 -printf("%.21Lg") gives -1.5 -g_xfmt(0) gives 4 bytes: "-1.5" - -strtoIx returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.6 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff cccc cccc cccc cccc -printf("%.21Lg") gives 1.59999999999999999991 -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 -= 1.60000000000000000002 -fI[0] == strtox - - -Input: -1.6 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff cccc cccc cccc cccc -printf("%.21Lg") gives -1.59999999999999999991 -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 -= -1.59999999999999999991 -fI[1] == strtox - - -Input: 1.7 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff d999 9999 9999 9999 -printf("%.21Lg") gives 1.69999999999999999993 -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 -= 1.70000000000000000004 -fI[0] == strtox - - -Input: -1.7 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff d999 9999 9999 9999 -printf("%.21Lg") gives -1.69999999999999999993 -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 -= -1.69999999999999999993 -fI[1] == strtox - - -Input: 1.8 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff e666 6666 6666 6666 -printf("%.21Lg") gives 1.79999999999999999996 -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 -= 1.80000000000000000007 -fI[0] == strtox - - -Input: -1.8 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff e666 6666 6666 6666 -printf("%.21Lg") gives -1.79999999999999999996 -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 -= -1.79999999999999999996 -fI[1] == strtox - - -Input: 1.9 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff f333 3333 3333 3333 -printf("%.21Lg") gives 1.89999999999999999998 -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 -= 1.90000000000000000009 -fI[0] == strtox - - -Input: -1.9 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff f333 3333 3333 3333 -printf("%.21Lg") gives -1.89999999999999999998 -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 -= -1.89999999999999999998 -fI[1] == strtox - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff 8ccc cccc cccc cccd -printf("%.21Lg") gives 1.10000000000000000002 -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 -= 1.10000000000000000002 -fI[1] == strtox - - -Input: -1.1 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff 8ccc cccc cccc cccd -printf("%.21Lg") gives -1.10000000000000000002 -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 -= -1.09999999999999999991 -fI[0] == strtox - - -Input: 1.2 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff 9999 9999 9999 999a -printf("%.21Lg") gives 1.20000000000000000004 -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 -= 1.20000000000000000004 -fI[1] == strtox - - -Input: -1.2 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff 9999 9999 9999 999a -printf("%.21Lg") gives -1.20000000000000000004 -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 -= -1.19999999999999999993 -fI[0] == strtox - - -Input: 1.3 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff a666 6666 6666 6666 -printf("%.21Lg") gives 1.29999999999999999996 -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 -= 1.30000000000000000007 -fI[0] == strtox - - -Input: -1.3 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff a666 6666 6666 6666 -printf("%.21Lg") gives -1.29999999999999999996 -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 -= -1.29999999999999999996 -fI[1] == strtox - - -Input: 1.4 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff b333 3333 3333 3333 -printf("%.21Lg") gives 1.39999999999999999998 -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 -= 1.40000000000000000009 -fI[0] == strtox - - -Input: -1.4 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff b333 3333 3333 3333 -printf("%.21Lg") gives -1.39999999999999999998 -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 -= -1.39999999999999999998 -fI[1] == strtox - - -Input: 1.5 - -strtox consumes 3 bytes and returns 1 -with bits = #3fff c000 0 0 0 -printf("%.21Lg") gives 1.5 -g_xfmt(0) gives 3 bytes: "1.5" - -strtoIx returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtox - - -Input: -1.5 - -strtox consumes 4 bytes and returns 9 -with bits = #bfff c000 0 0 0 -printf("%.21Lg") gives -1.5 -g_xfmt(0) gives 4 bytes: "-1.5" - -strtoIx returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.6 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff cccc cccc cccc cccd -printf("%.21Lg") gives 1.60000000000000000002 -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 -= 1.60000000000000000002 -fI[1] == strtox - - -Input: -1.6 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff cccc cccc cccc cccd -printf("%.21Lg") gives -1.60000000000000000002 -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 -= -1.59999999999999999991 -fI[0] == strtox - - -Input: 1.7 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff d999 9999 9999 999a -printf("%.21Lg") gives 1.70000000000000000004 -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 -= 1.70000000000000000004 -fI[1] == strtox - - -Input: -1.7 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff d999 9999 9999 999a -printf("%.21Lg") gives -1.70000000000000000004 -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 -= -1.69999999999999999993 -fI[0] == strtox - - -Input: 1.8 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff e666 6666 6666 6666 -printf("%.21Lg") gives 1.79999999999999999996 -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 -= 1.80000000000000000007 -fI[0] == strtox - - -Input: -1.8 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff e666 6666 6666 6666 -printf("%.21Lg") gives -1.79999999999999999996 -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 -= -1.79999999999999999996 -fI[1] == strtox - - -Input: 1.9 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff f333 3333 3333 3333 -printf("%.21Lg") gives 1.89999999999999999998 -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 -= 1.90000000000000000009 -fI[0] == strtox - - -Input: -1.9 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff f333 3333 3333 3333 -printf("%.21Lg") gives -1.89999999999999999998 -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 -= -1.89999999999999999998 -fI[1] == strtox - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff 8ccc cccc cccc cccd -printf("%.21Lg") gives 1.10000000000000000002 -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 -= 1.10000000000000000002 -fI[1] == strtox - - -Input: -1.1 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff 8ccc cccc cccc cccc -printf("%.21Lg") gives -1.09999999999999999991 -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 -= -1.09999999999999999991 -fI[1] == strtox - - -Input: 1.2 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff 9999 9999 9999 999a -printf("%.21Lg") gives 1.20000000000000000004 -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 -= 1.20000000000000000004 -fI[1] == strtox - - -Input: -1.2 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff 9999 9999 9999 9999 -printf("%.21Lg") gives -1.19999999999999999993 -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 -= -1.19999999999999999993 -fI[1] == strtox - - -Input: 1.3 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff a666 6666 6666 6667 -printf("%.21Lg") gives 1.30000000000000000007 -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 -= 1.30000000000000000007 -fI[1] == strtox - - -Input: -1.3 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff a666 6666 6666 6666 -printf("%.21Lg") gives -1.29999999999999999996 -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 -= -1.29999999999999999996 -fI[1] == strtox - - -Input: 1.4 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff b333 3333 3333 3334 -printf("%.21Lg") gives 1.40000000000000000009 -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 -= 1.40000000000000000009 -fI[1] == strtox - - -Input: -1.4 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff b333 3333 3333 3333 -printf("%.21Lg") gives -1.39999999999999999998 -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 -= -1.39999999999999999998 -fI[1] == strtox - - -Input: 1.5 - -strtox consumes 3 bytes and returns 1 -with bits = #3fff c000 0 0 0 -printf("%.21Lg") gives 1.5 -g_xfmt(0) gives 3 bytes: "1.5" - -strtoIx returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtox - - -Input: -1.5 - -strtox consumes 4 bytes and returns 9 -with bits = #bfff c000 0 0 0 -printf("%.21Lg") gives -1.5 -g_xfmt(0) gives 4 bytes: "-1.5" - -strtoIx returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.6 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff cccc cccc cccc cccd -printf("%.21Lg") gives 1.60000000000000000002 -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 -= 1.60000000000000000002 -fI[1] == strtox - - -Input: -1.6 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff cccc cccc cccc cccc -printf("%.21Lg") gives -1.59999999999999999991 -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 -= -1.59999999999999999991 -fI[1] == strtox - - -Input: 1.7 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff d999 9999 9999 999a -printf("%.21Lg") gives 1.70000000000000000004 -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 -= 1.70000000000000000004 -fI[1] == strtox - - -Input: -1.7 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff d999 9999 9999 9999 -printf("%.21Lg") gives -1.69999999999999999993 -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 -= -1.69999999999999999993 -fI[1] == strtox - - -Input: 1.8 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff e666 6666 6666 6667 -printf("%.21Lg") gives 1.80000000000000000007 -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 -= 1.80000000000000000007 -fI[1] == strtox - - -Input: -1.8 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff e666 6666 6666 6666 -printf("%.21Lg") gives -1.79999999999999999996 -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 -= -1.79999999999999999996 -fI[1] == strtox - - -Input: 1.9 - -strtox consumes 3 bytes and returns 33 -with bits = #3fff f333 3333 3333 3334 -printf("%.21Lg") gives 1.90000000000000000009 -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 -= 1.90000000000000000009 -fI[1] == strtox - - -Input: -1.9 - -strtox consumes 4 bytes and returns 25 -with bits = #bfff f333 3333 3333 3333 -printf("%.21Lg") gives -1.89999999999999999998 -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 -= -1.89999999999999999998 -fI[1] == strtox - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff 8ccc cccc cccc cccc -printf("%.21Lg") gives 1.09999999999999999991 -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 -= 1.10000000000000000002 -fI[0] == strtox - - -Input: -1.1 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff 8ccc cccc cccc cccd -printf("%.21Lg") gives -1.10000000000000000002 -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 -= -1.09999999999999999991 -fI[0] == strtox - - -Input: 1.2 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff 9999 9999 9999 9999 -printf("%.21Lg") gives 1.19999999999999999993 -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 -= 1.20000000000000000004 -fI[0] == strtox - - -Input: -1.2 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff 9999 9999 9999 999a -printf("%.21Lg") gives -1.20000000000000000004 -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 -= -1.19999999999999999993 -fI[0] == strtox - - -Input: 1.3 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff a666 6666 6666 6666 -printf("%.21Lg") gives 1.29999999999999999996 -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 -= 1.30000000000000000007 -fI[0] == strtox - - -Input: -1.3 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff a666 6666 6666 6667 -printf("%.21Lg") gives -1.30000000000000000007 -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 -= -1.29999999999999999996 -fI[0] == strtox - - -Input: 1.4 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff b333 3333 3333 3333 -printf("%.21Lg") gives 1.39999999999999999998 -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 -= 1.40000000000000000009 -fI[0] == strtox - - -Input: -1.4 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff b333 3333 3333 3334 -printf("%.21Lg") gives -1.40000000000000000009 -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 -= -1.39999999999999999998 -fI[0] == strtox - - -Input: 1.5 - -strtox consumes 3 bytes and returns 1 -with bits = #3fff c000 0 0 0 -printf("%.21Lg") gives 1.5 -g_xfmt(0) gives 3 bytes: "1.5" - -strtoIx returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtox - - -Input: -1.5 - -strtox consumes 4 bytes and returns 9 -with bits = #bfff c000 0 0 0 -printf("%.21Lg") gives -1.5 -g_xfmt(0) gives 4 bytes: "-1.5" - -strtoIx returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtox - - -Input: 1.6 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff cccc cccc cccc cccc -printf("%.21Lg") gives 1.59999999999999999991 -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 -= 1.60000000000000000002 -fI[0] == strtox - - -Input: -1.6 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff cccc cccc cccc cccd -printf("%.21Lg") gives -1.60000000000000000002 -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 -= -1.59999999999999999991 -fI[0] == strtox - - -Input: 1.7 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff d999 9999 9999 9999 -printf("%.21Lg") gives 1.69999999999999999993 -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 -= 1.70000000000000000004 -fI[0] == strtox - - -Input: -1.7 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff d999 9999 9999 999a -printf("%.21Lg") gives -1.70000000000000000004 -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 -= -1.69999999999999999993 -fI[0] == strtox - - -Input: 1.8 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff e666 6666 6666 6666 -printf("%.21Lg") gives 1.79999999999999999996 -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 -= 1.80000000000000000007 -fI[0] == strtox - - -Input: -1.8 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff e666 6666 6666 6667 -printf("%.21Lg") gives -1.80000000000000000007 -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 -= -1.79999999999999999996 -fI[0] == strtox - - -Input: 1.9 - -strtox consumes 3 bytes and returns 17 -with bits = #3fff f333 3333 3333 3333 -printf("%.21Lg") gives 1.89999999999999999998 -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 -= 1.90000000000000000009 -fI[0] == strtox - - -Input: -1.9 - -strtox consumes 4 bytes and returns 41 -with bits = #bfff f333 3333 3333 3334 -printf("%.21Lg") gives -1.90000000000000000009 -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 -= -1.89999999999999999998 -fI[0] == strtox - diff --git a/contrib/gdtoa/test/xL.ou0 b/contrib/gdtoa/test/xL.ou0 deleted file mode 100644 index dc75f91..0000000 --- a/contrib/gdtoa/test/xL.ou0 +++ /dev/null @@ -1,1182 +0,0 @@ - -Input: 1.23 - -strtoxL consumes 4 bytes and returns 33 -with bits = #3fff0000 9d70a3d7 a3d70a4 -g_xLfmt(0) gives 4 bytes: "1.23" - -strtoIxL returns 33, consuming 4 bytes. -fI[0] = #3fff0000 9d70a3d7 a3d70a3 -fI[1] = #3fff0000 9d70a3d7 a3d70a4 -fI[1] == strtoxL - - -Input: 1.23e+20 - -strtoxL consumes 8 bytes and returns 1 -with bits = #40410000 d55ef90a 2da18000 -g_xLfmt(0) gives 8 bytes: "1.23e+20" - -strtoIxL returns 1, consuming 8 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.23e-20 - -strtoxL consumes 8 bytes and returns 17 -with bits = #3fbc0000 e857267b b3a984f2 -g_xLfmt(0) gives 8 bytes: "1.23e-20" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #3fbc0000 e857267b b3a984f2 -fI[1] = #3fbc0000 e857267b b3a984f3 -fI[0] == strtoxL - - -Input: 1.23456789 - -strtoxL consumes 10 bytes and returns 33 -with bits = #3fff0000 9e065214 1ef0dbf6 -g_xLfmt(0) gives 10 bytes: "1.23456789" - -strtoIxL returns 33, consuming 10 bytes. -fI[0] = #3fff0000 9e065214 1ef0dbf5 -fI[1] = #3fff0000 9e065214 1ef0dbf6 -fI[1] == strtoxL - - -Input: 1.23456589e+20 - -strtoxL consumes 14 bytes and returns 1 -with bits = #40410000 d629bd33 5ccba00 -g_xLfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoIxL returns 1, consuming 14 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.23e+30 - -strtoxL consumes 8 bytes and returns 17 -with bits = #40620000 f8658274 7dbc824a -g_xLfmt(0) gives 8 bytes: "1.23e+30" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #40620000 f8658274 7dbc824a -fI[1] = #40620000 f8658274 7dbc824b -fI[0] == strtoxL - - -Input: 1.23e-30 - -strtoxL consumes 8 bytes and returns 17 -with bits = #3f9b0000 c794337a 808554eb -g_xLfmt(0) gives 8 bytes: "1.23e-30" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #3f9b0000 c794337a 808554eb -fI[1] = #3f9b0000 c794337a 808554ec -fI[0] == strtoxL - - -Input: 1.23456789e-20 - -strtoxL consumes 14 bytes and returns 17 -with bits = #3fbc0000 e9340a38 f3d6d352 -g_xLfmt(0) gives 14 bytes: "1.23456789e-20" - -strtoIxL returns 17, consuming 14 bytes. -fI[0] = #3fbc0000 e9340a38 f3d6d352 -fI[1] = #3fbc0000 e9340a38 f3d6d353 -fI[0] == strtoxL - - -Input: 1.23456789e-30 - -strtoxL consumes 14 bytes and returns 17 -with bits = #3f9b0000 c851f19d decca8fc -g_xLfmt(0) gives 14 bytes: "1.23456789e-30" - -strtoIxL returns 17, consuming 14 bytes. -fI[0] = #3f9b0000 c851f19d decca8fc -fI[1] = #3f9b0000 c851f19d decca8fd -fI[0] == strtoxL - - -Input: 1.234567890123456789 - -strtoxL consumes 20 bytes and returns 17 -with bits = #3fff0000 9e065214 62cfdb8d -g_xLfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIxL returns 17, consuming 20 bytes. -fI[0] = #3fff0000 9e065214 62cfdb8d -fI[1] = #3fff0000 9e065214 62cfdb8e -fI[0] == strtoxL - - -Input: 1.23456789012345678901234567890123456789 - -strtoxL consumes 40 bytes and returns 17 -with bits = #3fff0000 9e065214 62cfdb8d -g_xLfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIxL returns 17, consuming 40 bytes. -fI[0] = #3fff0000 9e065214 62cfdb8d -fI[1] = #3fff0000 9e065214 62cfdb8e -fI[0] == strtoxL - - -Input: 1.23e306 - -strtoxL consumes 8 bytes and returns 17 -with bits = #43f70000 e033b668 e30fa6d5 -g_xLfmt(0) gives 9 bytes: "1.23e+306" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #43f70000 e033b668 e30fa6d5 -fI[1] = #43f70000 e033b668 e30fa6d6 -fI[0] == strtoxL - - -Input: 1.23e-306 - -strtoxL consumes 9 bytes and returns 33 -with bits = #3c060000 dd1dc2ed 1cb73f25 -g_xLfmt(0) gives 9 bytes: "1.23e-306" - -strtoIxL returns 33, consuming 9 bytes. -fI[0] = #3c060000 dd1dc2ed 1cb73f24 -fI[1] = #3c060000 dd1dc2ed 1cb73f25 -fI[1] == strtoxL - - -Input: 1.23e-320 - -strtoxL consumes 9 bytes and returns 33 -with bits = #3bd80000 9b98c371 844c3f1a -g_xLfmt(0) gives 9 bytes: "1.23e-320" - -strtoIxL returns 33, consuming 9 bytes. -fI[0] = #3bd80000 9b98c371 844c3f19 -fI[1] = #3bd80000 9b98c371 844c3f1a -fI[1] == strtoxL - - -Input: 1.23e-20 - -strtoxL consumes 8 bytes and returns 17 -with bits = #3fbc0000 e857267b b3a984f2 -g_xLfmt(0) gives 8 bytes: "1.23e-20" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #3fbc0000 e857267b b3a984f2 -fI[1] = #3fbc0000 e857267b b3a984f3 -fI[0] == strtoxL - - -Input: 1.23456789e307 - -strtoxL consumes 14 bytes and returns 17 -with bits = #43fb0000 8ca58a5e d766de75 -g_xLfmt(0) gives 15 bytes: "1.23456789e+307" - -strtoIxL returns 17, consuming 14 bytes. -fI[0] = #43fb0000 8ca58a5e d766de75 -fI[1] = #43fb0000 8ca58a5e d766de76 -fI[0] == strtoxL - - -Input: 1.23456589e-307 - -strtoxL consumes 15 bytes and returns 17 -with bits = #3c030000 b18cb5dc c22fd369 -g_xLfmt(0) gives 15 bytes: "1.23456589e-307" - -strtoIxL returns 17, consuming 15 bytes. -fI[0] = #3c030000 b18cb5dc c22fd369 -fI[1] = #3c030000 b18cb5dc c22fd36a -fI[0] == strtoxL - - -Input: 1.234567890123456789 - -strtoxL consumes 20 bytes and returns 17 -with bits = #3fff0000 9e065214 62cfdb8d -g_xLfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIxL returns 17, consuming 20 bytes. -fI[0] = #3fff0000 9e065214 62cfdb8d -fI[1] = #3fff0000 9e065214 62cfdb8e -fI[0] == strtoxL - - -Input: 1.234567890123456789e301 - -strtoxL consumes 24 bytes and returns 33 -with bits = #43e70000 937a8baf ab20980c -g_xLfmt(0) gives 25 bytes: "1.234567890123456789e+301" - -strtoIxL returns 33, consuming 24 bytes. -fI[0] = #43e70000 937a8baf ab20980b -fI[1] = #43e70000 937a8baf ab20980c -fI[1] == strtoxL - - -Input: 1.234567890123456789e-301 - -strtoxL consumes 25 bytes and returns 33 -with bits = #3c170000 a953271a 5d069ad9 -g_xLfmt(0) gives 25 bytes: "1.234567890123456789e-301" - -strtoIxL returns 33, consuming 25 bytes. -fI[0] = #3c170000 a953271a 5d069ad8 -fI[1] = #3c170000 a953271a 5d069ad9 -fI[1] == strtoxL - - -Input: 1.234567890123456789e-321 - -strtoxL consumes 25 bytes and returns 33 -with bits = #3bd40000 f9e11b4c ea6dcce9 -g_xLfmt(0) gives 25 bytes: "1.234567890123456789e-321" - -strtoIxL returns 33, consuming 25 bytes. -fI[0] = #3bd40000 f9e11b4c ea6dcce8 -fI[1] = #3bd40000 f9e11b4c ea6dcce9 -fI[1] == strtoxL - - -Input: 1e23 - -strtoxL consumes 4 bytes and returns 1 -with bits = #404b0000 a968163f a57b400 -g_xLfmt(0) gives 5 bytes: "1e+23" - -strtoIxL returns 1, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1e310 - -strtoxL consumes 5 bytes and returns 33 -with bits = #44040000 de81e40a 34bcf50 -g_xLfmt(0) gives 6 bytes: "1e+310" - -strtoIxL returns 33, consuming 5 bytes. -fI[0] = #44040000 de81e40a 34bcf4f -fI[1] = #44040000 de81e40a 34bcf50 -fI[1] == strtoxL - - -Input: 9.0259718793241475e-277 - -strtoxL consumes 23 bytes and returns 33 -with bits = #3c690000 ffffffff fffffcf7 -g_xLfmt(0) gives 23 bytes: "9.0259718793241475e-277" - -strtoIxL returns 33, consuming 23 bytes. -fI[0] = #3c690000 ffffffff fffffcf6 -fI[1] = #3c690000 ffffffff fffffcf7 -fI[1] == strtoxL - - -Input: 9.025971879324147880346310405869e-277 - -strtoxL consumes 37 bytes and returns 17 -with bits = #3c6a0000 80000000 0 -g_xLfmt(0) gives 26 bytes: "9.0259718793241478803e-277" - -strtoIxL returns 17, consuming 37 bytes. -fI[0] = #3c6a0000 80000000 0 -fI[1] = #3c6a0000 80000000 1 -fI[0] == strtoxL - - -Input: 9.025971879324147880346310405868e-277 - -strtoxL consumes 37 bytes and returns 33 -with bits = #3c6a0000 80000000 0 -g_xLfmt(0) gives 26 bytes: "9.0259718793241478803e-277" - -strtoIxL returns 33, consuming 37 bytes. -fI[0] = #3c690000 ffffffff ffffffff -fI[1] = #3c6a0000 80000000 0 -fI[1] == strtoxL - - -Input: 2.2250738585072014e-308 - -strtoxL consumes 23 bytes and returns 17 -with bits = #3c010000 80000000 46 -g_xLfmt(0) gives 23 bytes: "2.2250738585072014e-308" - -strtoIxL returns 17, consuming 23 bytes. -fI[0] = #3c010000 80000000 46 -fI[1] = #3c010000 80000000 47 -fI[0] == strtoxL - - -Input: 2.2250738585072013e-308 - -strtoxL consumes 23 bytes and returns 17 -with bits = #3c000000 ffffffff fffffd4f -g_xLfmt(0) gives 23 bytes: "2.2250738585072013e-308" - -strtoIxL returns 17, consuming 23 bytes. -fI[0] = #3c000000 ffffffff fffffd4f -fI[1] = #3c000000 ffffffff fffffd50 -fI[0] == strtoxL - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 8ccccccc cccccccc -g_xLfmt(0) gives 21 bytes: "1.0999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 8ccccccc cccccccc -fI[1] = #3fff0000 8ccccccc cccccccd -fI[0] == strtoxL - - -Input: -1.1 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 8ccccccc cccccccc -g_xLfmt(0) gives 22 bytes: "-1.0999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 8ccccccc cccccccd -fI[1] = #bfff0000 8ccccccc cccccccc -fI[1] == strtoxL - - -Input: 1.2 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 99999999 99999999 -g_xLfmt(0) gives 21 bytes: "1.1999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 99999999 99999999 -fI[1] = #3fff0000 99999999 9999999a -fI[0] == strtoxL - - -Input: -1.2 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 99999999 99999999 -g_xLfmt(0) gives 22 bytes: "-1.1999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 99999999 9999999a -fI[1] = #bfff0000 99999999 99999999 -fI[1] == strtoxL - - -Input: 1.3 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 a6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.3" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 a6666666 66666666 -fI[1] = #3fff0000 a6666666 66666667 -fI[0] == strtoxL - - -Input: -1.3 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 a6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.3" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 a6666666 66666667 -fI[1] = #bfff0000 a6666666 66666666 -fI[1] == strtoxL - - -Input: 1.4 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 b3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.4" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 b3333333 33333333 -fI[1] = #3fff0000 b3333333 33333334 -fI[0] == strtoxL - - -Input: -1.4 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 b3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.4" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 b3333333 33333334 -fI[1] = #bfff0000 b3333333 33333333 -fI[1] == strtoxL - - -Input: 1.5 - -strtoxL consumes 3 bytes and returns 1 -with bits = #3fff0000 c0000000 0 -g_xLfmt(0) gives 3 bytes: "1.5" - -strtoIxL returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtoxL - - -Input: -1.5 - -strtoxL consumes 4 bytes and returns 9 -with bits = #bfff0000 c0000000 0 -g_xLfmt(0) gives 4 bytes: "-1.5" - -strtoIxL returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.6 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 cccccccc cccccccc -g_xLfmt(0) gives 21 bytes: "1.5999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 cccccccc cccccccc -fI[1] = #3fff0000 cccccccc cccccccd -fI[0] == strtoxL - - -Input: -1.6 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 cccccccc cccccccc -g_xLfmt(0) gives 22 bytes: "-1.5999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 cccccccc cccccccd -fI[1] = #bfff0000 cccccccc cccccccc -fI[1] == strtoxL - - -Input: 1.7 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 d9999999 99999999 -g_xLfmt(0) gives 21 bytes: "1.6999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 d9999999 99999999 -fI[1] = #3fff0000 d9999999 9999999a -fI[0] == strtoxL - - -Input: -1.7 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 d9999999 99999999 -g_xLfmt(0) gives 22 bytes: "-1.6999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 d9999999 9999999a -fI[1] = #bfff0000 d9999999 99999999 -fI[1] == strtoxL - - -Input: 1.8 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 e6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.8" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 e6666666 66666666 -fI[1] = #3fff0000 e6666666 66666667 -fI[0] == strtoxL - - -Input: -1.8 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 e6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.8" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 e6666666 66666667 -fI[1] = #bfff0000 e6666666 66666666 -fI[1] == strtoxL - - -Input: 1.9 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 f3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.9" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 f3333333 33333333 -fI[1] = #3fff0000 f3333333 33333334 -fI[0] == strtoxL - - -Input: -1.9 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 f3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.9" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 f3333333 33333334 -fI[1] = #bfff0000 f3333333 33333333 -fI[1] == strtoxL - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 8ccccccc cccccccd -g_xLfmt(0) gives 3 bytes: "1.1" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 8ccccccc cccccccc -fI[1] = #3fff0000 8ccccccc cccccccd -fI[1] == strtoxL - - -Input: -1.1 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 8ccccccc cccccccd -g_xLfmt(0) gives 4 bytes: "-1.1" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 8ccccccc cccccccd -fI[1] = #bfff0000 8ccccccc cccccccc -fI[0] == strtoxL - - -Input: 1.2 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 99999999 9999999a -g_xLfmt(0) gives 3 bytes: "1.2" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 99999999 99999999 -fI[1] = #3fff0000 99999999 9999999a -fI[1] == strtoxL - - -Input: -1.2 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 99999999 9999999a -g_xLfmt(0) gives 4 bytes: "-1.2" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 99999999 9999999a -fI[1] = #bfff0000 99999999 99999999 -fI[0] == strtoxL - - -Input: 1.3 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 a6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.3" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 a6666666 66666666 -fI[1] = #3fff0000 a6666666 66666667 -fI[0] == strtoxL - - -Input: -1.3 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 a6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.3" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 a6666666 66666667 -fI[1] = #bfff0000 a6666666 66666666 -fI[1] == strtoxL - - -Input: 1.4 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 b3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.4" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 b3333333 33333333 -fI[1] = #3fff0000 b3333333 33333334 -fI[0] == strtoxL - - -Input: -1.4 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 b3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.4" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 b3333333 33333334 -fI[1] = #bfff0000 b3333333 33333333 -fI[1] == strtoxL - - -Input: 1.5 - -strtoxL consumes 3 bytes and returns 1 -with bits = #3fff0000 c0000000 0 -g_xLfmt(0) gives 3 bytes: "1.5" - -strtoIxL returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtoxL - - -Input: -1.5 - -strtoxL consumes 4 bytes and returns 9 -with bits = #bfff0000 c0000000 0 -g_xLfmt(0) gives 4 bytes: "-1.5" - -strtoIxL returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.6 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 cccccccc cccccccd -g_xLfmt(0) gives 3 bytes: "1.6" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 cccccccc cccccccc -fI[1] = #3fff0000 cccccccc cccccccd -fI[1] == strtoxL - - -Input: -1.6 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 cccccccc cccccccd -g_xLfmt(0) gives 4 bytes: "-1.6" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 cccccccc cccccccd -fI[1] = #bfff0000 cccccccc cccccccc -fI[0] == strtoxL - - -Input: 1.7 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 d9999999 9999999a -g_xLfmt(0) gives 3 bytes: "1.7" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 d9999999 99999999 -fI[1] = #3fff0000 d9999999 9999999a -fI[1] == strtoxL - - -Input: -1.7 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 d9999999 9999999a -g_xLfmt(0) gives 4 bytes: "-1.7" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 d9999999 9999999a -fI[1] = #bfff0000 d9999999 99999999 -fI[0] == strtoxL - - -Input: 1.8 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 e6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.8" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 e6666666 66666666 -fI[1] = #3fff0000 e6666666 66666667 -fI[0] == strtoxL - - -Input: -1.8 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 e6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.8" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 e6666666 66666667 -fI[1] = #bfff0000 e6666666 66666666 -fI[1] == strtoxL - - -Input: 1.9 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 f3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.9" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 f3333333 33333333 -fI[1] = #3fff0000 f3333333 33333334 -fI[0] == strtoxL - - -Input: -1.9 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 f3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.9" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 f3333333 33333334 -fI[1] = #bfff0000 f3333333 33333333 -fI[1] == strtoxL - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 8ccccccc cccccccd -g_xLfmt(0) gives 3 bytes: "1.1" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 8ccccccc cccccccc -fI[1] = #3fff0000 8ccccccc cccccccd -fI[1] == strtoxL - - -Input: -1.1 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 8ccccccc cccccccc -g_xLfmt(0) gives 22 bytes: "-1.0999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 8ccccccc cccccccd -fI[1] = #bfff0000 8ccccccc cccccccc -fI[1] == strtoxL - - -Input: 1.2 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 99999999 9999999a -g_xLfmt(0) gives 3 bytes: "1.2" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 99999999 99999999 -fI[1] = #3fff0000 99999999 9999999a -fI[1] == strtoxL - - -Input: -1.2 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 99999999 99999999 -g_xLfmt(0) gives 22 bytes: "-1.1999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 99999999 9999999a -fI[1] = #bfff0000 99999999 99999999 -fI[1] == strtoxL - - -Input: 1.3 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 a6666666 66666667 -g_xLfmt(0) gives 21 bytes: "1.3000000000000000001" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 a6666666 66666666 -fI[1] = #3fff0000 a6666666 66666667 -fI[1] == strtoxL - - -Input: -1.3 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 a6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.3" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 a6666666 66666667 -fI[1] = #bfff0000 a6666666 66666666 -fI[1] == strtoxL - - -Input: 1.4 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 b3333333 33333334 -g_xLfmt(0) gives 21 bytes: "1.4000000000000000001" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 b3333333 33333333 -fI[1] = #3fff0000 b3333333 33333334 -fI[1] == strtoxL - - -Input: -1.4 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 b3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.4" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 b3333333 33333334 -fI[1] = #bfff0000 b3333333 33333333 -fI[1] == strtoxL - - -Input: 1.5 - -strtoxL consumes 3 bytes and returns 1 -with bits = #3fff0000 c0000000 0 -g_xLfmt(0) gives 3 bytes: "1.5" - -strtoIxL returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtoxL - - -Input: -1.5 - -strtoxL consumes 4 bytes and returns 9 -with bits = #bfff0000 c0000000 0 -g_xLfmt(0) gives 4 bytes: "-1.5" - -strtoIxL returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.6 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 cccccccc cccccccd -g_xLfmt(0) gives 3 bytes: "1.6" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 cccccccc cccccccc -fI[1] = #3fff0000 cccccccc cccccccd -fI[1] == strtoxL - - -Input: -1.6 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 cccccccc cccccccc -g_xLfmt(0) gives 22 bytes: "-1.5999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 cccccccc cccccccd -fI[1] = #bfff0000 cccccccc cccccccc -fI[1] == strtoxL - - -Input: 1.7 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 d9999999 9999999a -g_xLfmt(0) gives 3 bytes: "1.7" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 d9999999 99999999 -fI[1] = #3fff0000 d9999999 9999999a -fI[1] == strtoxL - - -Input: -1.7 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 d9999999 99999999 -g_xLfmt(0) gives 22 bytes: "-1.6999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 d9999999 9999999a -fI[1] = #bfff0000 d9999999 99999999 -fI[1] == strtoxL - - -Input: 1.8 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 e6666666 66666667 -g_xLfmt(0) gives 21 bytes: "1.8000000000000000001" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 e6666666 66666666 -fI[1] = #3fff0000 e6666666 66666667 -fI[1] == strtoxL - - -Input: -1.8 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 e6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.8" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 e6666666 66666667 -fI[1] = #bfff0000 e6666666 66666666 -fI[1] == strtoxL - - -Input: 1.9 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 f3333333 33333334 -g_xLfmt(0) gives 21 bytes: "1.9000000000000000001" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 f3333333 33333333 -fI[1] = #3fff0000 f3333333 33333334 -fI[1] == strtoxL - - -Input: -1.9 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 f3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.9" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 f3333333 33333334 -fI[1] = #bfff0000 f3333333 33333333 -fI[1] == strtoxL - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 8ccccccc cccccccc -g_xLfmt(0) gives 21 bytes: "1.0999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 8ccccccc cccccccc -fI[1] = #3fff0000 8ccccccc cccccccd -fI[0] == strtoxL - - -Input: -1.1 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 8ccccccc cccccccd -g_xLfmt(0) gives 4 bytes: "-1.1" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 8ccccccc cccccccd -fI[1] = #bfff0000 8ccccccc cccccccc -fI[0] == strtoxL - - -Input: 1.2 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 99999999 99999999 -g_xLfmt(0) gives 21 bytes: "1.1999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 99999999 99999999 -fI[1] = #3fff0000 99999999 9999999a -fI[0] == strtoxL - - -Input: -1.2 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 99999999 9999999a -g_xLfmt(0) gives 4 bytes: "-1.2" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 99999999 9999999a -fI[1] = #bfff0000 99999999 99999999 -fI[0] == strtoxL - - -Input: 1.3 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 a6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.3" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 a6666666 66666666 -fI[1] = #3fff0000 a6666666 66666667 -fI[0] == strtoxL - - -Input: -1.3 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 a6666666 66666667 -g_xLfmt(0) gives 22 bytes: "-1.3000000000000000001" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 a6666666 66666667 -fI[1] = #bfff0000 a6666666 66666666 -fI[0] == strtoxL - - -Input: 1.4 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 b3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.4" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 b3333333 33333333 -fI[1] = #3fff0000 b3333333 33333334 -fI[0] == strtoxL - - -Input: -1.4 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 b3333333 33333334 -g_xLfmt(0) gives 22 bytes: "-1.4000000000000000001" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 b3333333 33333334 -fI[1] = #bfff0000 b3333333 33333333 -fI[0] == strtoxL - - -Input: 1.5 - -strtoxL consumes 3 bytes and returns 1 -with bits = #3fff0000 c0000000 0 -g_xLfmt(0) gives 3 bytes: "1.5" - -strtoIxL returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtoxL - - -Input: -1.5 - -strtoxL consumes 4 bytes and returns 9 -with bits = #bfff0000 c0000000 0 -g_xLfmt(0) gives 4 bytes: "-1.5" - -strtoIxL returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.6 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 cccccccc cccccccc -g_xLfmt(0) gives 21 bytes: "1.5999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 cccccccc cccccccc -fI[1] = #3fff0000 cccccccc cccccccd -fI[0] == strtoxL - - -Input: -1.6 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 cccccccc cccccccd -g_xLfmt(0) gives 4 bytes: "-1.6" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 cccccccc cccccccd -fI[1] = #bfff0000 cccccccc cccccccc -fI[0] == strtoxL - - -Input: 1.7 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 d9999999 99999999 -g_xLfmt(0) gives 21 bytes: "1.6999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 d9999999 99999999 -fI[1] = #3fff0000 d9999999 9999999a -fI[0] == strtoxL - - -Input: -1.7 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 d9999999 9999999a -g_xLfmt(0) gives 4 bytes: "-1.7" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 d9999999 9999999a -fI[1] = #bfff0000 d9999999 99999999 -fI[0] == strtoxL - - -Input: 1.8 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 e6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.8" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 e6666666 66666666 -fI[1] = #3fff0000 e6666666 66666667 -fI[0] == strtoxL - - -Input: -1.8 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 e6666666 66666667 -g_xLfmt(0) gives 22 bytes: "-1.8000000000000000001" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 e6666666 66666667 -fI[1] = #bfff0000 e6666666 66666666 -fI[0] == strtoxL - - -Input: 1.9 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 f3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.9" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 f3333333 33333333 -fI[1] = #3fff0000 f3333333 33333334 -fI[0] == strtoxL - - -Input: -1.9 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 f3333333 33333334 -g_xLfmt(0) gives 22 bytes: "-1.9000000000000000001" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 f3333333 33333334 -fI[1] = #bfff0000 f3333333 33333333 -fI[0] == strtoxL - diff --git a/contrib/gdtoa/test/xL.ou1 b/contrib/gdtoa/test/xL.ou1 deleted file mode 100644 index 054690e..0000000 --- a/contrib/gdtoa/test/xL.ou1 +++ /dev/null @@ -1,1183 +0,0 @@ -***** 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 -g_xLfmt(0) gives 4 bytes: "1.23" - -strtoIxL returns 33, consuming 4 bytes. -fI[0] = #3fff0000 9d70a3d7 a3d70a3 -fI[1] = #3fff0000 9d70a3d7 a3d70a4 -fI[1] == strtoxL - - -Input: 1.23e+20 - -strtoxL consumes 8 bytes and returns 1 -with bits = #40410000 d55ef90a 2da18000 -g_xLfmt(0) gives 8 bytes: "1.23e+20" - -strtoIxL returns 1, consuming 8 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.23e-20 - -strtoxL consumes 8 bytes and returns 17 -with bits = #3fbc0000 e857267b b3a984f2 -g_xLfmt(0) gives 8 bytes: "1.23e-20" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #3fbc0000 e857267b b3a984f2 -fI[1] = #3fbc0000 e857267b b3a984f3 -fI[0] == strtoxL - - -Input: 1.23456789 - -strtoxL consumes 10 bytes and returns 33 -with bits = #3fff0000 9e065214 1ef0dbf6 -g_xLfmt(0) gives 10 bytes: "1.23456789" - -strtoIxL returns 33, consuming 10 bytes. -fI[0] = #3fff0000 9e065214 1ef0dbf5 -fI[1] = #3fff0000 9e065214 1ef0dbf6 -fI[1] == strtoxL - - -Input: 1.23456589e+20 - -strtoxL consumes 14 bytes and returns 1 -with bits = #40410000 d629bd33 5ccba00 -g_xLfmt(0) gives 14 bytes: "1.23456589e+20" - -strtoIxL returns 1, consuming 14 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.23e+30 - -strtoxL consumes 8 bytes and returns 17 -with bits = #40620000 f8658274 7dbc824a -g_xLfmt(0) gives 8 bytes: "1.23e+30" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #40620000 f8658274 7dbc824a -fI[1] = #40620000 f8658274 7dbc824b -fI[0] == strtoxL - - -Input: 1.23e-30 - -strtoxL consumes 8 bytes and returns 17 -with bits = #3f9b0000 c794337a 808554eb -g_xLfmt(0) gives 8 bytes: "1.23e-30" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #3f9b0000 c794337a 808554eb -fI[1] = #3f9b0000 c794337a 808554ec -fI[0] == strtoxL - - -Input: 1.23456789e-20 - -strtoxL consumes 14 bytes and returns 17 -with bits = #3fbc0000 e9340a38 f3d6d352 -g_xLfmt(0) gives 14 bytes: "1.23456789e-20" - -strtoIxL returns 17, consuming 14 bytes. -fI[0] = #3fbc0000 e9340a38 f3d6d352 -fI[1] = #3fbc0000 e9340a38 f3d6d353 -fI[0] == strtoxL - - -Input: 1.23456789e-30 - -strtoxL consumes 14 bytes and returns 17 -with bits = #3f9b0000 c851f19d decca8fc -g_xLfmt(0) gives 14 bytes: "1.23456789e-30" - -strtoIxL returns 17, consuming 14 bytes. -fI[0] = #3f9b0000 c851f19d decca8fc -fI[1] = #3f9b0000 c851f19d decca8fd -fI[0] == strtoxL - - -Input: 1.234567890123456789 - -strtoxL consumes 20 bytes and returns 17 -with bits = #3fff0000 9e065214 62cfdb8d -g_xLfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIxL returns 17, consuming 20 bytes. -fI[0] = #3fff0000 9e065214 62cfdb8d -fI[1] = #3fff0000 9e065214 62cfdb8e -fI[0] == strtoxL - - -Input: 1.23456789012345678901234567890123456789 - -strtoxL consumes 40 bytes and returns 17 -with bits = #3fff0000 9e065214 62cfdb8d -g_xLfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIxL returns 17, consuming 40 bytes. -fI[0] = #3fff0000 9e065214 62cfdb8d -fI[1] = #3fff0000 9e065214 62cfdb8e -fI[0] == strtoxL - - -Input: 1.23e306 - -strtoxL consumes 8 bytes and returns 17 -with bits = #43f70000 e033b668 e30fa6d5 -g_xLfmt(0) gives 9 bytes: "1.23e+306" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #43f70000 e033b668 e30fa6d5 -fI[1] = #43f70000 e033b668 e30fa6d6 -fI[0] == strtoxL - - -Input: 1.23e-306 - -strtoxL consumes 9 bytes and returns 33 -with bits = #3c060000 dd1dc2ed 1cb73f25 -g_xLfmt(0) gives 9 bytes: "1.23e-306" - -strtoIxL returns 33, consuming 9 bytes. -fI[0] = #3c060000 dd1dc2ed 1cb73f24 -fI[1] = #3c060000 dd1dc2ed 1cb73f25 -fI[1] == strtoxL - - -Input: 1.23e-320 - -strtoxL consumes 9 bytes and returns 33 -with bits = #3bd80000 9b98c371 844c3f1a -g_xLfmt(0) gives 9 bytes: "1.23e-320" - -strtoIxL returns 33, consuming 9 bytes. -fI[0] = #3bd80000 9b98c371 844c3f19 -fI[1] = #3bd80000 9b98c371 844c3f1a -fI[1] == strtoxL - - -Input: 1.23e-20 - -strtoxL consumes 8 bytes and returns 17 -with bits = #3fbc0000 e857267b b3a984f2 -g_xLfmt(0) gives 8 bytes: "1.23e-20" - -strtoIxL returns 17, consuming 8 bytes. -fI[0] = #3fbc0000 e857267b b3a984f2 -fI[1] = #3fbc0000 e857267b b3a984f3 -fI[0] == strtoxL - - -Input: 1.23456789e307 - -strtoxL consumes 14 bytes and returns 17 -with bits = #43fb0000 8ca58a5e d766de75 -g_xLfmt(0) gives 15 bytes: "1.23456789e+307" - -strtoIxL returns 17, consuming 14 bytes. -fI[0] = #43fb0000 8ca58a5e d766de75 -fI[1] = #43fb0000 8ca58a5e d766de76 -fI[0] == strtoxL - - -Input: 1.23456589e-307 - -strtoxL consumes 15 bytes and returns 17 -with bits = #3c030000 b18cb5dc c22fd369 -g_xLfmt(0) gives 15 bytes: "1.23456589e-307" - -strtoIxL returns 17, consuming 15 bytes. -fI[0] = #3c030000 b18cb5dc c22fd369 -fI[1] = #3c030000 b18cb5dc c22fd36a -fI[0] == strtoxL - - -Input: 1.234567890123456789 - -strtoxL consumes 20 bytes and returns 17 -with bits = #3fff0000 9e065214 62cfdb8d -g_xLfmt(0) gives 20 bytes: "1.234567890123456789" - -strtoIxL returns 17, consuming 20 bytes. -fI[0] = #3fff0000 9e065214 62cfdb8d -fI[1] = #3fff0000 9e065214 62cfdb8e -fI[0] == strtoxL - - -Input: 1.234567890123456789e301 - -strtoxL consumes 24 bytes and returns 33 -with bits = #43e70000 937a8baf ab20980c -g_xLfmt(0) gives 25 bytes: "1.234567890123456789e+301" - -strtoIxL returns 33, consuming 24 bytes. -fI[0] = #43e70000 937a8baf ab20980b -fI[1] = #43e70000 937a8baf ab20980c -fI[1] == strtoxL - - -Input: 1.234567890123456789e-301 - -strtoxL consumes 25 bytes and returns 33 -with bits = #3c170000 a953271a 5d069ad9 -g_xLfmt(0) gives 25 bytes: "1.234567890123456789e-301" - -strtoIxL returns 33, consuming 25 bytes. -fI[0] = #3c170000 a953271a 5d069ad8 -fI[1] = #3c170000 a953271a 5d069ad9 -fI[1] == strtoxL - - -Input: 1.234567890123456789e-321 - -strtoxL consumes 25 bytes and returns 33 -with bits = #3bd40000 f9e11b4c ea6dcce9 -g_xLfmt(0) gives 25 bytes: "1.234567890123456789e-321" - -strtoIxL returns 33, consuming 25 bytes. -fI[0] = #3bd40000 f9e11b4c ea6dcce8 -fI[1] = #3bd40000 f9e11b4c ea6dcce9 -fI[1] == strtoxL - - -Input: 1e23 - -strtoxL consumes 4 bytes and returns 1 -with bits = #404b0000 a968163f a57b400 -g_xLfmt(0) gives 5 bytes: "1e+23" - -strtoIxL returns 1, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1e310 - -strtoxL consumes 5 bytes and returns 33 -with bits = #44040000 de81e40a 34bcf50 -g_xLfmt(0) gives 6 bytes: "1e+310" - -strtoIxL returns 33, consuming 5 bytes. -fI[0] = #44040000 de81e40a 34bcf4f -fI[1] = #44040000 de81e40a 34bcf50 -fI[1] == strtoxL - - -Input: 9.0259718793241475e-277 - -strtoxL consumes 23 bytes and returns 33 -with bits = #3c690000 ffffffff fffffcf7 -g_xLfmt(0) gives 23 bytes: "9.0259718793241475e-277" - -strtoIxL returns 33, consuming 23 bytes. -fI[0] = #3c690000 ffffffff fffffcf6 -fI[1] = #3c690000 ffffffff fffffcf7 -fI[1] == strtoxL - - -Input: 9.025971879324147880346310405869e-277 - -strtoxL consumes 37 bytes and returns 17 -with bits = #3c6a0000 80000000 0 -g_xLfmt(0) gives 26 bytes: "9.0259718793241478803e-277" - -strtoIxL returns 17, consuming 37 bytes. -fI[0] = #3c6a0000 80000000 0 -fI[1] = #3c6a0000 80000000 1 -fI[0] == strtoxL - - -Input: 9.025971879324147880346310405868e-277 - -strtoxL consumes 37 bytes and returns 33 -with bits = #3c6a0000 80000000 0 -g_xLfmt(0) gives 26 bytes: "9.0259718793241478803e-277" - -strtoIxL returns 33, consuming 37 bytes. -fI[0] = #3c690000 ffffffff ffffffff -fI[1] = #3c6a0000 80000000 0 -fI[1] == strtoxL - - -Input: 2.2250738585072014e-308 - -strtoxL consumes 23 bytes and returns 17 -with bits = #3c010000 80000000 46 -g_xLfmt(0) gives 23 bytes: "2.2250738585072014e-308" - -strtoIxL returns 17, consuming 23 bytes. -fI[0] = #3c010000 80000000 46 -fI[1] = #3c010000 80000000 47 -fI[0] == strtoxL - - -Input: 2.2250738585072013e-308 - -strtoxL consumes 23 bytes and returns 17 -with bits = #3c000000 ffffffff fffffd4f -g_xLfmt(0) gives 23 bytes: "2.2250738585072013e-308" - -strtoIxL returns 17, consuming 23 bytes. -fI[0] = #3c000000 ffffffff fffffd4f -fI[1] = #3c000000 ffffffff fffffd50 -fI[0] == strtoxL - -Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero) - -Input: 1.1 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 8ccccccc cccccccc -g_xLfmt(0) gives 21 bytes: "1.0999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 8ccccccc cccccccc -fI[1] = #3fff0000 8ccccccc cccccccd -fI[0] == strtoxL - - -Input: -1.1 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 8ccccccc cccccccc -g_xLfmt(0) gives 22 bytes: "-1.0999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 8ccccccc cccccccd -fI[1] = #bfff0000 8ccccccc cccccccc -fI[1] == strtoxL - - -Input: 1.2 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 99999999 99999999 -g_xLfmt(0) gives 21 bytes: "1.1999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 99999999 99999999 -fI[1] = #3fff0000 99999999 9999999a -fI[0] == strtoxL - - -Input: -1.2 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 99999999 99999999 -g_xLfmt(0) gives 22 bytes: "-1.1999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 99999999 9999999a -fI[1] = #bfff0000 99999999 99999999 -fI[1] == strtoxL - - -Input: 1.3 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 a6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.3" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 a6666666 66666666 -fI[1] = #3fff0000 a6666666 66666667 -fI[0] == strtoxL - - -Input: -1.3 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 a6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.3" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 a6666666 66666667 -fI[1] = #bfff0000 a6666666 66666666 -fI[1] == strtoxL - - -Input: 1.4 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 b3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.4" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 b3333333 33333333 -fI[1] = #3fff0000 b3333333 33333334 -fI[0] == strtoxL - - -Input: -1.4 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 b3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.4" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 b3333333 33333334 -fI[1] = #bfff0000 b3333333 33333333 -fI[1] == strtoxL - - -Input: 1.5 - -strtoxL consumes 3 bytes and returns 1 -with bits = #3fff0000 c0000000 0 -g_xLfmt(0) gives 3 bytes: "1.5" - -strtoIxL returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtoxL - - -Input: -1.5 - -strtoxL consumes 4 bytes and returns 9 -with bits = #bfff0000 c0000000 0 -g_xLfmt(0) gives 4 bytes: "-1.5" - -strtoIxL returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.6 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 cccccccc cccccccc -g_xLfmt(0) gives 21 bytes: "1.5999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 cccccccc cccccccc -fI[1] = #3fff0000 cccccccc cccccccd -fI[0] == strtoxL - - -Input: -1.6 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 cccccccc cccccccc -g_xLfmt(0) gives 22 bytes: "-1.5999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 cccccccc cccccccd -fI[1] = #bfff0000 cccccccc cccccccc -fI[1] == strtoxL - - -Input: 1.7 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 d9999999 99999999 -g_xLfmt(0) gives 21 bytes: "1.6999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 d9999999 99999999 -fI[1] = #3fff0000 d9999999 9999999a -fI[0] == strtoxL - - -Input: -1.7 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 d9999999 99999999 -g_xLfmt(0) gives 22 bytes: "-1.6999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 d9999999 9999999a -fI[1] = #bfff0000 d9999999 99999999 -fI[1] == strtoxL - - -Input: 1.8 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 e6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.8" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 e6666666 66666666 -fI[1] = #3fff0000 e6666666 66666667 -fI[0] == strtoxL - - -Input: -1.8 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 e6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.8" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 e6666666 66666667 -fI[1] = #bfff0000 e6666666 66666666 -fI[1] == strtoxL - - -Input: 1.9 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 f3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.9" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 f3333333 33333333 -fI[1] = #3fff0000 f3333333 33333334 -fI[0] == strtoxL - - -Input: -1.9 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 f3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.9" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 f3333333 33333334 -fI[1] = #bfff0000 f3333333 33333333 -fI[1] == strtoxL - -Rounding mode for strtor... changed from 0 (toward zero) to 1 (nearest) - -Input: 1.1 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 8ccccccc cccccccd -g_xLfmt(0) gives 3 bytes: "1.1" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 8ccccccc cccccccc -fI[1] = #3fff0000 8ccccccc cccccccd -fI[1] == strtoxL - - -Input: -1.1 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 8ccccccc cccccccd -g_xLfmt(0) gives 4 bytes: "-1.1" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 8ccccccc cccccccd -fI[1] = #bfff0000 8ccccccc cccccccc -fI[0] == strtoxL - - -Input: 1.2 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 99999999 9999999a -g_xLfmt(0) gives 3 bytes: "1.2" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 99999999 99999999 -fI[1] = #3fff0000 99999999 9999999a -fI[1] == strtoxL - - -Input: -1.2 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 99999999 9999999a -g_xLfmt(0) gives 4 bytes: "-1.2" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 99999999 9999999a -fI[1] = #bfff0000 99999999 99999999 -fI[0] == strtoxL - - -Input: 1.3 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 a6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.3" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 a6666666 66666666 -fI[1] = #3fff0000 a6666666 66666667 -fI[0] == strtoxL - - -Input: -1.3 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 a6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.3" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 a6666666 66666667 -fI[1] = #bfff0000 a6666666 66666666 -fI[1] == strtoxL - - -Input: 1.4 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 b3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.4" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 b3333333 33333333 -fI[1] = #3fff0000 b3333333 33333334 -fI[0] == strtoxL - - -Input: -1.4 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 b3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.4" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 b3333333 33333334 -fI[1] = #bfff0000 b3333333 33333333 -fI[1] == strtoxL - - -Input: 1.5 - -strtoxL consumes 3 bytes and returns 1 -with bits = #3fff0000 c0000000 0 -g_xLfmt(0) gives 3 bytes: "1.5" - -strtoIxL returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtoxL - - -Input: -1.5 - -strtoxL consumes 4 bytes and returns 9 -with bits = #bfff0000 c0000000 0 -g_xLfmt(0) gives 4 bytes: "-1.5" - -strtoIxL returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.6 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 cccccccc cccccccd -g_xLfmt(0) gives 3 bytes: "1.6" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 cccccccc cccccccc -fI[1] = #3fff0000 cccccccc cccccccd -fI[1] == strtoxL - - -Input: -1.6 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 cccccccc cccccccd -g_xLfmt(0) gives 4 bytes: "-1.6" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 cccccccc cccccccd -fI[1] = #bfff0000 cccccccc cccccccc -fI[0] == strtoxL - - -Input: 1.7 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 d9999999 9999999a -g_xLfmt(0) gives 3 bytes: "1.7" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 d9999999 99999999 -fI[1] = #3fff0000 d9999999 9999999a -fI[1] == strtoxL - - -Input: -1.7 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 d9999999 9999999a -g_xLfmt(0) gives 4 bytes: "-1.7" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 d9999999 9999999a -fI[1] = #bfff0000 d9999999 99999999 -fI[0] == strtoxL - - -Input: 1.8 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 e6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.8" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 e6666666 66666666 -fI[1] = #3fff0000 e6666666 66666667 -fI[0] == strtoxL - - -Input: -1.8 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 e6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.8" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 e6666666 66666667 -fI[1] = #bfff0000 e6666666 66666666 -fI[1] == strtoxL - - -Input: 1.9 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 f3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.9" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 f3333333 33333333 -fI[1] = #3fff0000 f3333333 33333334 -fI[0] == strtoxL - - -Input: -1.9 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 f3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.9" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 f3333333 33333334 -fI[1] = #bfff0000 f3333333 33333333 -fI[1] == strtoxL - -Rounding mode for strtor... changed from 1 (nearest) to 2 (toward +Infinity) - -Input: 1.1 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 8ccccccc cccccccd -g_xLfmt(0) gives 3 bytes: "1.1" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 8ccccccc cccccccc -fI[1] = #3fff0000 8ccccccc cccccccd -fI[1] == strtoxL - - -Input: -1.1 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 8ccccccc cccccccc -g_xLfmt(0) gives 22 bytes: "-1.0999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 8ccccccc cccccccd -fI[1] = #bfff0000 8ccccccc cccccccc -fI[1] == strtoxL - - -Input: 1.2 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 99999999 9999999a -g_xLfmt(0) gives 3 bytes: "1.2" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 99999999 99999999 -fI[1] = #3fff0000 99999999 9999999a -fI[1] == strtoxL - - -Input: -1.2 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 99999999 99999999 -g_xLfmt(0) gives 22 bytes: "-1.1999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 99999999 9999999a -fI[1] = #bfff0000 99999999 99999999 -fI[1] == strtoxL - - -Input: 1.3 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 a6666666 66666667 -g_xLfmt(0) gives 21 bytes: "1.3000000000000000001" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 a6666666 66666666 -fI[1] = #3fff0000 a6666666 66666667 -fI[1] == strtoxL - - -Input: -1.3 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 a6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.3" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 a6666666 66666667 -fI[1] = #bfff0000 a6666666 66666666 -fI[1] == strtoxL - - -Input: 1.4 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 b3333333 33333334 -g_xLfmt(0) gives 21 bytes: "1.4000000000000000001" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 b3333333 33333333 -fI[1] = #3fff0000 b3333333 33333334 -fI[1] == strtoxL - - -Input: -1.4 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 b3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.4" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 b3333333 33333334 -fI[1] = #bfff0000 b3333333 33333333 -fI[1] == strtoxL - - -Input: 1.5 - -strtoxL consumes 3 bytes and returns 1 -with bits = #3fff0000 c0000000 0 -g_xLfmt(0) gives 3 bytes: "1.5" - -strtoIxL returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtoxL - - -Input: -1.5 - -strtoxL consumes 4 bytes and returns 9 -with bits = #bfff0000 c0000000 0 -g_xLfmt(0) gives 4 bytes: "-1.5" - -strtoIxL returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.6 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 cccccccc cccccccd -g_xLfmt(0) gives 3 bytes: "1.6" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 cccccccc cccccccc -fI[1] = #3fff0000 cccccccc cccccccd -fI[1] == strtoxL - - -Input: -1.6 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 cccccccc cccccccc -g_xLfmt(0) gives 22 bytes: "-1.5999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 cccccccc cccccccd -fI[1] = #bfff0000 cccccccc cccccccc -fI[1] == strtoxL - - -Input: 1.7 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 d9999999 9999999a -g_xLfmt(0) gives 3 bytes: "1.7" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 d9999999 99999999 -fI[1] = #3fff0000 d9999999 9999999a -fI[1] == strtoxL - - -Input: -1.7 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 d9999999 99999999 -g_xLfmt(0) gives 22 bytes: "-1.6999999999999999999" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 d9999999 9999999a -fI[1] = #bfff0000 d9999999 99999999 -fI[1] == strtoxL - - -Input: 1.8 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 e6666666 66666667 -g_xLfmt(0) gives 21 bytes: "1.8000000000000000001" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 e6666666 66666666 -fI[1] = #3fff0000 e6666666 66666667 -fI[1] == strtoxL - - -Input: -1.8 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 e6666666 66666666 -g_xLfmt(0) gives 4 bytes: "-1.8" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 e6666666 66666667 -fI[1] = #bfff0000 e6666666 66666666 -fI[1] == strtoxL - - -Input: 1.9 - -strtoxL consumes 3 bytes and returns 33 -with bits = #3fff0000 f3333333 33333334 -g_xLfmt(0) gives 21 bytes: "1.9000000000000000001" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 f3333333 33333333 -fI[1] = #3fff0000 f3333333 33333334 -fI[1] == strtoxL - - -Input: -1.9 - -strtoxL consumes 4 bytes and returns 25 -with bits = #bfff0000 f3333333 33333333 -g_xLfmt(0) gives 4 bytes: "-1.9" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 f3333333 33333334 -fI[1] = #bfff0000 f3333333 33333333 -fI[1] == strtoxL - -Rounding mode for strtor... changed from 2 (toward +Infinity) to 3 (toward -Infinity) - -Input: 1.1 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 8ccccccc cccccccc -g_xLfmt(0) gives 21 bytes: "1.0999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 8ccccccc cccccccc -fI[1] = #3fff0000 8ccccccc cccccccd -fI[0] == strtoxL - - -Input: -1.1 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 8ccccccc cccccccd -g_xLfmt(0) gives 4 bytes: "-1.1" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 8ccccccc cccccccd -fI[1] = #bfff0000 8ccccccc cccccccc -fI[0] == strtoxL - - -Input: 1.2 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 99999999 99999999 -g_xLfmt(0) gives 21 bytes: "1.1999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 99999999 99999999 -fI[1] = #3fff0000 99999999 9999999a -fI[0] == strtoxL - - -Input: -1.2 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 99999999 9999999a -g_xLfmt(0) gives 4 bytes: "-1.2" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 99999999 9999999a -fI[1] = #bfff0000 99999999 99999999 -fI[0] == strtoxL - - -Input: 1.3 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 a6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.3" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 a6666666 66666666 -fI[1] = #3fff0000 a6666666 66666667 -fI[0] == strtoxL - - -Input: -1.3 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 a6666666 66666667 -g_xLfmt(0) gives 22 bytes: "-1.3000000000000000001" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 a6666666 66666667 -fI[1] = #bfff0000 a6666666 66666666 -fI[0] == strtoxL - - -Input: 1.4 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 b3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.4" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 b3333333 33333333 -fI[1] = #3fff0000 b3333333 33333334 -fI[0] == strtoxL - - -Input: -1.4 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 b3333333 33333334 -g_xLfmt(0) gives 22 bytes: "-1.4000000000000000001" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 b3333333 33333334 -fI[1] = #bfff0000 b3333333 33333333 -fI[0] == strtoxL - - -Input: 1.5 - -strtoxL consumes 3 bytes and returns 1 -with bits = #3fff0000 c0000000 0 -g_xLfmt(0) gives 3 bytes: "1.5" - -strtoIxL returns 1, consuming 3 bytes. -fI[0] == fI[1] == strtoxL - - -Input: -1.5 - -strtoxL consumes 4 bytes and returns 9 -with bits = #bfff0000 c0000000 0 -g_xLfmt(0) gives 4 bytes: "-1.5" - -strtoIxL returns 9, consuming 4 bytes. -fI[0] == fI[1] == strtoxL - - -Input: 1.6 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 cccccccc cccccccc -g_xLfmt(0) gives 21 bytes: "1.5999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 cccccccc cccccccc -fI[1] = #3fff0000 cccccccc cccccccd -fI[0] == strtoxL - - -Input: -1.6 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 cccccccc cccccccd -g_xLfmt(0) gives 4 bytes: "-1.6" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 cccccccc cccccccd -fI[1] = #bfff0000 cccccccc cccccccc -fI[0] == strtoxL - - -Input: 1.7 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 d9999999 99999999 -g_xLfmt(0) gives 21 bytes: "1.6999999999999999999" - -strtoIxL returns 33, consuming 3 bytes. -fI[0] = #3fff0000 d9999999 99999999 -fI[1] = #3fff0000 d9999999 9999999a -fI[0] == strtoxL - - -Input: -1.7 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 d9999999 9999999a -g_xLfmt(0) gives 4 bytes: "-1.7" - -strtoIxL returns 41, consuming 4 bytes. -fI[0] = #bfff0000 d9999999 9999999a -fI[1] = #bfff0000 d9999999 99999999 -fI[0] == strtoxL - - -Input: 1.8 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 e6666666 66666666 -g_xLfmt(0) gives 3 bytes: "1.8" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 e6666666 66666666 -fI[1] = #3fff0000 e6666666 66666667 -fI[0] == strtoxL - - -Input: -1.8 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 e6666666 66666667 -g_xLfmt(0) gives 22 bytes: "-1.8000000000000000001" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 e6666666 66666667 -fI[1] = #bfff0000 e6666666 66666666 -fI[0] == strtoxL - - -Input: 1.9 - -strtoxL consumes 3 bytes and returns 17 -with bits = #3fff0000 f3333333 33333333 -g_xLfmt(0) gives 3 bytes: "1.9" - -strtoIxL returns 17, consuming 3 bytes. -fI[0] = #3fff0000 f3333333 33333333 -fI[1] = #3fff0000 f3333333 33333334 -fI[0] == strtoxL - - -Input: -1.9 - -strtoxL consumes 4 bytes and returns 41 -with bits = #bfff0000 f3333333 33333334 -g_xLfmt(0) gives 22 bytes: "-1.9000000000000000001" - -strtoIxL returns 25, consuming 4 bytes. -fI[0] = #bfff0000 f3333333 33333334 -fI[1] = #bfff0000 f3333333 33333333 -fI[0] == strtoxL - diff --git a/contrib/gdtoa/test/xLtest.c b/contrib/gdtoa/test/xLtest.c deleted file mode 100644 index c923e19..0000000 --- a/contrib/gdtoa/test/xLtest.c +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998-2001 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -/* Test program for g_xLfmt, strtoIxL, strtopxL, and strtorxL. - * - * Inputs (on stdin): - * r rounding_mode - * n ndig - * number - * #hex0 hex1 hex2 - * - * rounding_mode values: - * 0 = toward zero - * 1 = nearest - * 2 = toward +Infinity - * 3 = toward -Infinity - * - * where number is a decimal floating-point number, - * hex0 is a string of <= 8 Hex digits for the most significant - * word of the number, hex1 is a similar string for the next - * word, etc., and ndig is a parameters to g_xLfmt. - */ - -#include "gdtoa.h" -#include -#include -#include - - extern int getround ANSI((int,char*)); - - static char ibuf[2048], obuf[2048]; - -#define U (unsigned long) - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#endif -#ifdef IEEE_8087 -#define _0 2 -#define _1 1 -#define _2 0 -#endif - - int -main(Void) -{ - char *s, *se, *se1; - int dItry, i, ndig = 0, r = 1; - union { long double d; ULong bits[3]; } u, v[2]; - - while(s = fgets(ibuf, sizeof(ibuf), stdin)) { - while(*s <= ' ') - if (!*s++) - continue; - dItry = 0; - switch(*s) { - case 'r': - r = getround(r, s); - continue; - case 'n': - i = s[1]; - if (i <= ' ' || i >= '0' && i <= '9') { - ndig = atoi(s+1); - continue; - } - break; /* nan? */ - case '#': - sscanf(s+1, "%lx %lx %lx", &u.bits[_0], - &u.bits[_1], &u.bits[_2]); - printf("\nInput: %s", ibuf); - printf(" --> f = #%lx %lx %lx\n", u.bits[_0], - u.bits[_1], u.bits[_2]); - goto fmt_test; - } - dItry = 1; - printf("\nInput: %s", ibuf); - i = strtorxL(ibuf, &se, r, u.bits); - if (r == 1 && (i != strtopxL(ibuf, &se1, v[0].bits) || se1 != se - || memcmp(u.bits, v[0].bits, 12))) - printf("***strtoxL and strtorxL disagree!!\n:"); - printf("\nstrtoxL consumes %d bytes and returns %d\n", - (int)(se-ibuf), i); - printf("with bits = #%lx %lx %lx\n", - U u.bits[_0], U u.bits[_1], U u.bits[_2]); - if (sizeof(long double) == 12) - printf("printf(\"%%.21Lg\") gives %.21Lg\n", u.d); - fmt_test: - se = g_xLfmt(obuf, u.bits, ndig, sizeof(obuf)); - printf("g_xLfmt(%d) gives %d bytes: \"%s\"\n\n", - ndig, (int)(se-obuf), se ? obuf : ""); - if (!dItry) - continue; - printf("strtoIxL returns %d,", - strtoIxL(ibuf, &se, v[0].bits, v[1].bits)); - printf(" consuming %d bytes.\n", (int)(se-ibuf)); - if (!memcmp(v[0].bits, v[1].bits, 12)) { - if (!memcmp(u.bits, v[0].bits, 12)) - printf("fI[0] == fI[1] == strtoxL\n"); - else { - printf("fI[0] == fI[1] = #%lx %lx %lx\n", - U v[0].bits[_0], U v[0].bits[_1], - U v[0].bits[_2]); - if (sizeof(long double) == 12) - printf("= %.21Lg\n", v[0].d); - } - } - else { - printf("fI[0] = #%lx %lx %lx\n", - U v[0].bits[_0], U v[0].bits[_1], - U v[0].bits[_2]); - if (sizeof(long double) == 12) - printf("= %.21Lg\n", v[0].d); - printf("fI[1] = #%lx %lx %lx\n", - U v[1].bits[_0], U v[1].bits[_1], - U v[1].bits[_2]); - if (sizeof(long double) == 12) - printf("= %.21Lg\n", v[1].d); - if (!memcmp(v[0].bits, u.bits, 12)) - printf("fI[0] == strtoxL\n"); - else if (!memcmp(v[1].bits, u.bits, 12)) - printf("fI[1] == strtoxL\n"); - else - printf("**** Both differ from strtod ****\n"); - } - printf("\n"); - } - return 0; - } diff --git a/contrib/gdtoa/test/xQtest.c b/contrib/gdtoa/test/xQtest.c deleted file mode 100644 index 8dfe365..0000000 --- a/contrib/gdtoa/test/xQtest.c +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 2002 by Lucent Technologies -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 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. - -****************************************************************/ - -#include - - int -main(void) -{ - switch(sizeof(long double)) { - case 10: - case 12: - printf("cp x.ou1 x.out; cp xL.ou1 xL.out; cp Q.ou0 Q.out\n"); - break; - case 16: - printf("cp x.ou0 x.out; cp xL.ou0 xL.out; cp Q.ou1 Q.out\n"); - break; - default: - printf("cp x.ou0 x.out; cp xL.ou0 xL.out; cp Q.ou0 Q.out\n"); - } - return 0; - } diff --git a/contrib/gdtoa/test/xsum0.out b/contrib/gdtoa/test/xsum0.out deleted file mode 100644 index ee59cda..0000000 --- a/contrib/gdtoa/test/xsum0.out +++ /dev/null @@ -1,35 +0,0 @@ -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 -strtoIdSI.c 7bfb88b 49 -strtoIddSI.c 72e8852 50 -strtodISI.c ed08b740 49 -strtodt.c 17aca428 3213 -strtopddSI.c 13e7138d 50 -strtorddSI.c f7e4b1d5 50 -xLtest.c faca328f 4646 -xQtest.c efdea3a2 1549 -xtest.c 1f19b87 4858 -rtestnos f94bcdf6 336 -testnos e89999d6 485 -testnos1 7e16229 294 -testnos3 fa5c8aca 11998 -dI.out d522eef 4369 -dIsi.out 1dd6d02f 4350 -ddsi.out 1f94bbe2 10251 -dd.out e262456e 40923 -dtst.out ee75f6b9 23308 -d.out f271efc9 28131 -f.out 4b0bd51 21207 -x.ou0 1cfc5d22 25378 -xL.ou0 faa3a741 26363 -x.ou1 1a7e9dd4 34587 -xL.ou1 418057a 26476 -Q.ou0 e4592b85 28742 -Q.ou1 ea0b344d 39572 -makefile ebbea1e1 4191 diff --git a/contrib/gdtoa/test/xtest.c b/contrib/gdtoa/test/xtest.c deleted file mode 100644 index bd2b008..0000000 --- a/contrib/gdtoa/test/xtest.c +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************** - -The author of this software is David M. Gay. - -Copyright (C) 1998-2001 by Lucent Technologies -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 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. - -****************************************************************/ - -/* 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 - */ - -/* Test program for g_xfmt, strtoIx, strtopx, and strtorx. - * - * Inputs (on stdin): - * r rounding_mode - * n ndig - * number - * #hex0 hex1 hex2 hex3 hex4 - * - * rounding_mode values: - * 0 = toward zero - * 1 = nearest - * 2 = toward +Infinity - * 3 = toward -Infinity - * - * where number is a decimal floating-point number, - * hex0 is a string of <= 4 Hex digits for the most significant - * half-word of the number, hex1 is a similar string for the next - * half-word, etc., and ndig is a parameters to g_xfmt. - */ - -#include "gdtoa.h" -#include -#include -#include - - extern int getround ANSI((int,char*)); - - static char ibuf[2048], obuf[2048]; - -#undef _0 -#undef _1 - -/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ - -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#define _2 2 -#define _3 3 -#define _4 4 -#endif -#ifdef IEEE_8087 -#define _0 4 -#define _1 3 -#define _2 2 -#define _3 1 -#define _4 0 -#endif - - int -main(Void) -{ - char *s, *se, *se1; - int i, dItry, ndig = 0, r = 1; - union { long double d; UShort bits[5]; } u, v[2]; - - while(s = fgets(ibuf, sizeof(ibuf), stdin)) { - while(*s <= ' ') - if (!*s++) - continue; - dItry = 0; - switch(*s) { - case 'r': - r = getround(r, s); - continue; - case 'n': - i = s[1]; - if (i <= ' ' || i >= '0' && i <= '9') { - ndig = atoi(s+1); - continue; - } - break; /* nan? */ - case '#': - 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]); - goto fmt_test; - } - dItry = 1; - printf("\nInput: %s", ibuf); - i = strtorx(ibuf, &se, r, u.bits); - if (r == 1 && (i != strtopx(ibuf, &se1, v[0].bits) || se1 != se - || memcmp(u.bits, v[0].bits, 10))) - printf("***strtox and strtorx disagree!!\n:"); - printf("\nstrtox consumes %d bytes and returns %d\n", - (int)(se-ibuf), i); - printf("with bits = #%x %x %x %x %x\n", - u.bits[_0], u.bits[_1], u.bits[_2], - u.bits[_3], u.bits[_4]); - if (sizeof(long double) == 12) - printf("printf(\"%%.21Lg\") gives %.21Lg\n", u.d); - fmt_test: - se = g_xfmt(obuf, u.bits, ndig, sizeof(obuf)); - printf("g_xfmt(%d) gives %d bytes: \"%s\"\n\n", - ndig, (int)(se-obuf), se ? obuf : ""); - if (!dItry) - continue; - printf("strtoIx returns %d,", - strtoIx(ibuf, &se, v[0].bits, v[1].bits)); - printf(" consuming %d bytes.\n", (int)(se-ibuf)); - if (!memcmp(v[0].bits, v[1].bits, 10)) { - if (!memcmp(u.bits, v[0].bits, 10)) - printf("fI[0] == fI[1] == strtox\n"); - else { - printf("fI[0] == fI[1] = #%x %x %x %x %x\n", - v[0].bits[_0], v[0].bits[_1], - v[0].bits[_2], v[0].bits[_3], - v[0].bits[_4]); - if (sizeof(long double) == 12) - printf("= %.21Lg\n", v[0].d); - } - } - else { - printf("fI[0] = #%x %x %x %x %x\n", - v[0].bits[_0], v[0].bits[_1], - v[0].bits[_2], v[0].bits[_3], - v[0].bits[_4]); - if (sizeof(long double) == 12) - 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]); - if (sizeof(long double) == 12) - printf("= %.21Lg\n", v[1].d); - if (!memcmp(v[0].bits, u.bits, 10)) - printf("fI[0] == strtox\n"); - else if (!memcmp(v[1].bits, u.bits, 10)) - printf("fI[1] == strtox\n"); - else - printf("**** Both differ from strtod ****\n"); - } - printf("\n"); - } - return 0; - } diff --git a/contrib/gdtoa/ulp.c b/contrib/gdtoa/ulp.c index 536994a..17e9f86 100644 --- a/contrib/gdtoa/ulp.c +++ b/contrib/gdtoa/ulp.c @@ -26,27 +26,21 @@ ****************************************************************/ -/* 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" double ulp #ifdef KR_headers - (x) double x; + (x) U *x; #else - (double x) + (U *x) #endif { Long L; - double a; + U a; L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; #ifndef Sudden_Underflow @@ -55,22 +49,22 @@ #ifdef IBM L |= Exp_msk1 >> 4; #endif - word0(a) = L; - word1(a) = 0; + word0(&a) = L; + word1(&a) = 0; #ifndef Sudden_Underflow } else { L = -L >> Exp_shift; if (L < Exp_shift) { - word0(a) = 0x80000 >> L; - word1(a) = 0; + word0(&a) = 0x80000 >> L; + word1(&a) = 0; } else { - word0(a) = 0; + word0(&a) = 0; L -= Exp_shift; - word1(a) = L >= 31 ? 1 : 1 << 31 - L; + word1(&a) = L >= 31 ? 1 : 1 << (31 - L); } } #endif - return a; + return dval(&a); } diff --git a/contrib/gdtoa/xsum0.out b/contrib/gdtoa/xsum0.out deleted file mode 100644 index b61d0f0..0000000 --- a/contrib/gdtoa/xsum0.out +++ /dev/null @@ -1,46 +0,0 @@ -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 diff --git a/include_old/stdlib.h b/include_old/stdlib.h index c0b9c67..a274727 100644 --- a/include_old/stdlib.h +++ b/include_old/stdlib.h @@ -38,4 +38,6 @@ const char *getprogname(void); +int atexit(void (*)(void)); + #endif diff --git a/include_old/sys/param.h b/include_old/sys/param.h index 711abe3..49ed140 100644 --- a/include_old/sys/param.h +++ b/include_old/sys/param.h @@ -58,8 +58,8 @@ * * scheme is: <0 if release branch, otherwise 1>xx */ -#undef __FreeBSD_version -#define __FreeBSD_version 502104 /* Master, propagated to newvers */ +#undef __UbixOS_version +#define __UbixOS_version 1002000 /* Master, propagated to newvers */ #ifndef LOCORE #include diff --git a/lib/Makefile.incl b/lib/Makefile.incl index 686ae00..bd313ed 100644 --- a/lib/Makefile.incl +++ b/lib/Makefile.incl @@ -5,7 +5,8 @@ #CFLAGS = -fpic -DPIC -O2 -fno-strict-aliasing -pipe -D__DBINTERFACE_PRIVATE -DPOSIX_MISTAKE -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -DYP -DHESIOD -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized CFLAGS = -m32 -fno-builtin -Wno-uninitialized -O2 -fno-strict-aliasing -pipe -INCLUDES = -I../include -I../../../include_old -I../i386 +#INCLUDES = -I../include -I../../../include_old -I../i386 +#INCLUDES = -I${INCLUDE} -INCLUDES = -I${INCLUDE} +INCLUDES = -I${SRCTOP}/include_old CFLAGS = -m32 ${WFLAGS} -Wall -nostdlib -nostdinc -fno-builtin -fno-exceptions -O diff --git a/lib/csu/Makefile b/lib/csu/Makefile index d9b8772..762732f 100644 --- a/lib/csu/Makefile +++ b/lib/csu/Makefile @@ -7,8 +7,7 @@ CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -Wno-uninitialized -O2 -fno-strict-aliasing -pipe -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls #-DGCRT -INCLUDES+= -I../libc/include -# -I../../include.new +INCLUDES+= -I../libc_old/include #Objects OBJS = crtn.o crti.o crt1.o crtbrand.o diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 6e7a3b1..6b55b81 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -83,7 +83,7 @@ .include "${LIBC_SRCTOP}/nameser/Makefile.inc" .include "${LIBC_SRCTOP}/net/Makefile.inc" .include "${LIBC_SRCTOP}/nls/Makefile.inc" -#MrOlsen.include "${LIBC_SRCTOP}/posix1e/Makefile.inc" +.include "${LIBC_SRCTOP}/posix1e/Makefile.inc" .if ${LIBC_ARCH} != "aarch64" && \ ${LIBC_ARCH} != "amd64" && \ ${LIBC_ARCH} != "powerpc64" && \ diff --git a/lib/libc/gdtoa/machdep_ldisx.c b/lib/libc/gdtoa/machdep_ldisx.c index 6273b6f..07980a0 100644 --- a/lib/libc/gdtoa/machdep_ldisx.c +++ b/lib/libc/gdtoa/machdep_ldisx.c @@ -41,6 +41,7 @@ #include #include "gdtoaimp.h" +#include "../locale/xlocale_private.h" long double strtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale) diff --git a/lib/libc/posix1e/Makefile.inc b/lib/libc/posix1e/Makefile.inc index 1ac94a7..13b8d33 100644 --- a/lib/libc/posix1e/Makefile.inc +++ b/lib/libc/posix1e/Makefile.inc @@ -5,7 +5,8 @@ CFLAGS+=-D_ACL_PRIVATE # Copy kern/subr_acl_nfs4.c to the libc object directory. -subr_acl_nfs4.c: ${SRCTOP}/sys/kern/subr_acl_nfs4.c +#subr_acl_nfs4.c: ${SRCTOP}/sys/kern/subr_acl_nfs4.c +subr_acl_nfs4.c: ./subr_acl_nfs4.c cat ${.ALLSRC} > ${.TARGET} SRCS+= acl_branding.c \ diff --git a/lib/libc_old/gen/Makefile b/lib/libc_old/gen/Makefile index b17ac0e..87e2d2c 100644 --- a/lib/libc_old/gen/Makefile +++ b/lib/libc_old/gen/Makefile @@ -15,16 +15,16 @@ # Compile the source files .cc.o: - $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../../../include -c -o $@ $< + $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../../../include_old -c -o $@ $< .cc.s: - $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../../../include -S -o $@ $< + $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../../../include_old -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdlib -O -I. -I../../../include -c $< + $(CC) $(CFLAGS) -Wall -nostdlib -O -I. -I../../../include_old -c $< .c.s: - $(CC) $(CFLAGS) -Wall -nostdlib -O -I../../../include -S -o $@ $< + $(CC) $(CFLAGS) -Wall -nostdlib -O -I../../../include_old -S -o $@ $< .S.o: $(CC) $(CFLAGS) -Wall -nostdlib -c -o $@ $< diff --git a/lib/libc_old/generic/Makefile b/lib/libc_old/generic/Makefile index a9c8407..a8f9dc3 100644 --- a/lib/libc_old/generic/Makefile +++ b/lib/libc_old/generic/Makefile @@ -20,7 +20,7 @@ $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -I../../../include -c $< + $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -I../../../include_old -c $< .c.s: $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< diff --git a/lib/libc_old/include/libc_private.h b/lib/libc_old/include/libc_private.h index 63f8610..c6650a4 100644 --- a/lib/libc_old/include/libc_private.h +++ b/lib/libc_old/include/libc_private.h @@ -113,6 +113,11 @@ int _yp_check(char **); #endif +/* + * Initialise TLS for static programs + */ +void _init_tls(void); + /* * This is a pointer in the C run-time startup code. It is used diff --git a/lib/libc_old/locale/Makefile b/lib/libc_old/locale/Makefile index 92003cc..9041a14 100644 --- a/lib/libc_old/locale/Makefile +++ b/lib/libc_old/locale/Makefile @@ -21,7 +21,7 @@ $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -I../../../include -c $< + $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -I../../../include_old -c $< .c.s: $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< diff --git a/lib/libc_old/math/Makefile b/lib/libc_old/math/Makefile index a5a85b4..d909c96 100644 --- a/lib/libc_old/math/Makefile +++ b/lib/libc_old/math/Makefile @@ -21,7 +21,7 @@ $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdlib -O -I../../../include -c $< + $(CC) $(CFLAGS) -Wall -nostdlib -O -I../../../include_old -c $< .c.s: $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< diff --git a/lib/libc_old/quad/Makefile b/lib/libc_old/quad/Makefile index bcebc54..dfb7b6a 100644 --- a/lib/libc_old/quad/Makefile +++ b/lib/libc_old/quad/Makefile @@ -14,13 +14,13 @@ # Compile the source files .cc.o: - $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../../../include -c -o $@ $< + $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../../../include_old -c -o $@ $< .cc.s: $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdlib -O -I../../../include -c $< + $(CC) $(CFLAGS) -Wall -nostdlib -O -I../../../include_old -c $< .c.s: $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< diff --git a/lib/libc_old/stdio/Makefile b/lib/libc_old/stdio/Makefile index 639ad20..120681b 100644 --- a/lib/libc_old/stdio/Makefile +++ b/lib/libc_old/stdio/Makefile @@ -21,7 +21,7 @@ $(CXX) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -I../../../include -c $< + $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -I../../../include_old -c $< .c.s: $(CC) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< diff --git a/lib/libc_old/stdlib/Makefile b/lib/libc_old/stdlib/Makefile index c10698e..1f98f8e 100644 --- a/lib/libc_old/stdlib/Makefile +++ b/lib/libc_old/stdlib/Makefile @@ -21,7 +21,7 @@ $(CXX) -Wall ${CFLAGS} -nostdinc -O -I../include -S -o $@ $< .c.o: - $(CC) -Wall ${CFLAGS} -nostdinc -O -I../include -I../../../include -c $< + $(CC) -Wall ${CFLAGS} -nostdinc -O -I../include -I../../../include_old -c $< .c.s: $(CC) -Wall ${CFLAGS} -nostdinc -O -I../include -S -o $@ $< diff --git a/lib/libc_old/string/Makefile b/lib/libc_old/string/Makefile index 4b46d8e..7863728 100644 --- a/lib/libc_old/string/Makefile +++ b/lib/libc_old/string/Makefile @@ -20,7 +20,7 @@ $(CXX) $(CFLAGS) -Wall -nostdinc -O -I../include -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdinc -O -I./include -I../../../include -I../locale -c $< + $(CC) $(CFLAGS) -Wall -nostdinc -O -I./include -I../../../include_old -I../locale -c $< .c.s: $(CC) $(CFLAGS) -Wall -nostdinc -O -I../include -S -o $@ $< diff --git a/lib/libc_old/sys/Makefile b/lib/libc_old/sys/Makefile index 359ceb8..76e6ba6 100644 --- a/lib/libc_old/sys/Makefile +++ b/lib/libc_old/sys/Makefile @@ -21,7 +21,7 @@ $(CXX) ${CFLAGS} -Wall -nostdinc -O -I../include -S -o $@ $< .c.o: - $(CC) ${CFLAGS} -Wall -nostdinc -O -I../include -I../../../include -c $< + $(CC) ${CFLAGS} -Wall -nostdinc -O -I../include -I../../../include_old -c $< .c.s: $(CC) ${CFLAGS} -Wall -nostdinc -O -I../include -S -o $@ $<