* gdtoa/gdtoa.c, gdtoa/gdtoa.h, gdtoa/gdtoaimp.h: Sync gdtoa to match the latest version at netlib.org as of 2011-03-21. git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/branches/releases/v1.0@4150 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/ChangeLog b/mingw-w64-crt/ChangeLog index e69de29..26eb25e 100644 --- a/mingw-w64-crt/ChangeLog +++ b/mingw-w64-crt/ChangeLog
@@ -0,0 +1,5 @@ +2011-04-26 Ozkan Sezer <sezeroz@gmail.com> + + * gdtoa/gdtoa.c, gdtoa/gdtoa.h, gdtoa/gdtoaimp.h: Sync gdtoa to + match the latest version at netlib.org as of 2011-03-21. +
diff --git a/mingw-w64-crt/gdtoa/gdtoa.c b/mingw-w64-crt/gdtoa/gdtoa.c index a58487a..3158453 100644 --- a/mingw-w64-crt/gdtoa/gdtoa.c +++ b/mingw-w64-crt/gdtoa/gdtoa.c
@@ -111,6 +111,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 @@ -256,6 +257,8 @@ 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. */ @@ -469,13 +472,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;
diff --git a/mingw-w64-crt/gdtoa/gdtoa.h b/mingw-w64-crt/gdtoa/gdtoa.h index d7464db..f2d079a 100644 --- a/mingw-w64-crt/gdtoa/gdtoa.h +++ b/mingw-w64-crt/gdtoa/gdtoa.h
@@ -42,12 +42,12 @@ /* keep the 'Long' definition as 'long' for compatibility * with older/other software. long in w64 is 32 bits anyway.. */ -#define Long long /* int */ +#define Long long /* Windows long is 32 bit */ #undef NO_LONG_LONG /* we have long long type */ #endif /* MinGW */ #ifndef Long -#define Long long +#define Long int #endif #ifndef ULong typedef unsigned Long ULong;
diff --git a/mingw-w64-crt/gdtoa/gdtoaimp.h b/mingw-w64-crt/gdtoa/gdtoaimp.h index 58781f6..49b9ce0 100644 --- a/mingw-w64-crt/gdtoa/gdtoaimp.h +++ b/mingw-w64-crt/gdtoa/gdtoaimp.h
@@ -89,12 +89,18 @@ * #define IBM for IBM mainframe-style floating-point arithmetic. * #define VAX for VAX-style floating-point arithmetic (D_floating). * #define No_leftright to omit left-right logic in fast floating-point - * computation of dtoa. + * computation of dtoa and gdtoa. This will cause modes 4 and 5 to be + * treated the same as modes 2 and 3 for some inputs. * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3. * #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" @@ -395,6 +401,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