1 Sun Jun 30 13:48:26 EDT 1991:
2 dtoa.c: adjust dtoa to allow negative ndigits for modes 3,5,7,9
3 (fixed-point mode); fix rounding bug in these modes when the input
4 d (to be converted) satisfies 10^-(ndigits+1) <= |d| < 10^-ndigits ,
5 i.e., when the result, before rounding, would be empty but might
6 round to one digit. Adjust the decpt returned in these modes when
7 the result is empty (i.e., when |d| <= 5 * 10^-ndigits).
9 Tue Jul 2 21:44:00 EDT 1991
10 Correct an inefficiency introduced 2 days ago in dtoa's handling of
11 integers in modes 0, 1.
13 Mon Sep 9 23:29:38 EDT 1991
14 dtoa.c: remove superfluous declaration of size_t.
16 Sun Oct 6 15:34:15 EDT 1991
17 dtoa.c: fix another bug in modes 3,5,7,9 when the result, before
18 rounding, would be empty, but rounds to one digit: *decpt was low by
21 Sat Jan 18 12:30:04 EST 1992
22 dtoa.c: add some #ifdef KR_headers lines relevant only if IBM is
23 defined; for input decimal strings representing numbers too large, have
24 strtod return HUGE_VAL only if __STDC__ is defined; otherwise have it
25 return +-Infinity for IEEE arithmetic, +- the largest machine number
26 for IBM and VAX arithmetic. (If __STDC__ is not defined, HUGE_VAL may
27 not be defined either, or it may be wrong.)
29 Mon Apr 27 23:13:43 EDT 1992
30 dtoa.c: tweak strtod (one-line addition) so the end-pointer = start
31 pointer when the input has, e.g., only white space.
33 Thu May 7 18:04:46 EDT 1992
34 dtoa.c: adjust treatment of exponent field (in strtod) to behave
35 reasonably with huge numbers and 16-bit ints.
37 Fri Jun 19 08:29:02 EDT 1992
38 dtoa.c: fix a botch in placement of #ifdef __cplusplus (which only
39 matters if you're using a C++ compiler).
41 Wed Oct 21 11:23:07 EDT 1992
42 dtoa.c: add #ifdef Bad_float_h lines for systems with missing or
45 Thu Apr 22 07:54:48 EDT 1993
46 dtoa.c: change < to <= in line 2059:
47 < for(result_k = 0; sizeof(Bigint) - sizeof(unsigned long) + j < i;
49 > for(result_k = 0; sizeof(Bigint) - sizeof(unsigned long) + j <= i;
50 With 32-bit ints, the former could give too small a block for the return
51 value when, e.g., mode = 2 or 4 and ndigits = 24 (16 for 16-bit ints).
53 Mon Jun 21 12:56:42 EDT 1993
54 dtoa.c: tweak to work with 32-bit ints and 64-bit longs
55 when compiled with -DLong=int .
57 Wed Jan 26 11:09:16 EST 1994
58 dtoa.c: fix bug in strtod's handling of numbers with very
59 negative exponents (e.g. 1.8826e-512), which should underflow to 0;
60 fix storage leak in strtod with underflows and overflows near
61 the underflow and overflow thresholds.
63 Mon Feb 28 11:37:30 EST 1994
66 > * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n)
67 > * if memory is available and otherwise does something you deem
68 > * appropriate. If MALLOC is undefined, malloc will be invoked
69 > * directly -- and assumed always to succeed.
72 > #define MALLOC malloc
76 < rv = (Bigint *)malloc(sizeof(Bigint) + (x-1)*sizeof(Long));
78 > rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(Long));
80 Thu Mar 3 16:56:39 EST 1994
81 dtoa.c: if MALLOC is #defined, declare it.
83 Wed Jan 4 15:45:34 EST 1995
84 dtoa.c: add CONST qualification to tens, bigtens, tinytens (for use
85 on embedded systems with little spare RAM).
87 Fri Mar 1 08:55:39 EST 1996
88 g_fmt.c: honor the sign of 0 and return the first argument (buf).
90 Sat Jul 6 07:59:28 EDT 1996
91 dtoa.c: cosmetic changes: "ULong" rather than "unsigned Long";
92 update comments to reflect AT&T breakup.
94 Mon Aug 5 23:31:24 EDT 1996
95 dtoa.c: add comment about invoking _control87(PC_53, MCW_PC)
96 (or the equivalent) on 80x87 machines before calling strtod or dtoa.
98 Tue Dec 17 15:01:56 EST 1996
99 dtoa.c: new #define possibilities: #define INFNAN_CHECK to have
100 strtod check (case insensitively) for "Infinity" and "NaN" on machines
101 with IEEE arithmetic; #define MULTIPLE_THREADS if the system offers
102 preemptively scheduled multiple threads, in which case you must supply
103 routines ACQUIRE_DTOA_LOCK(n) and FREE_DTOA_LOCK(n) (n = 0 or 1).
104 New void freedtoa(char*) for freeing values returned by dtoa; use of
105 freedtoa() is required if MULTIPLE_THREADS is #defined, and is merely
106 recommended otherwise.
107 g_fmt.c: adjusted to invoke freedtoa().
109 Wed Feb 12 00:40:01 EST 1997
110 dtoa.c: strtod: on IEEE systems, scale to avoid intermediate
111 underflows when the result does not underflow; compiling with
112 -DNO_IEEE_Scale restores the old logic. Fix a bug, revealed by
113 input string 2.2250738585072012e-308, in treating input just less
114 than the smallest normalized number. (The bug introduced an extra
115 ULP of error in this special case.)
117 Tue May 12 11:13:04 EDT 1998
118 dtoa.c: strtod: fix a glitch introduced with the scaling of 19970212
119 that caused one-bit rounding errors in certain denormal numbers, such
120 as 8.44291197326099e-309, which was read as 8.442911973260987e-309.
121 Remove #ifdef Unsigned_Shifts logic in favor of unsigned arithmetic.
122 Unless compiled with -DNO_LONG_LONG, use 64-bit arithmetic where
125 Fri May 15 07:49:07 EDT 1998
126 dtoa.c: strtod: fix another glitch with scaling to avoid underflow
127 with IEEE arithmetic, again revealed by the input string
128 2.2250738585072012e-308, which was rounded to the largest denormal
129 rather than the smallest normal double precision number.
131 Wed Aug 5 23:27:26 EDT 1998
132 gdtoa.tar.gz: tweaks in response to comments from Shawn C. Sheridan
133 (with no effect on the resulting .o files except when strtod.c is
134 compiled with -DNO_ERRNO); bigtens --> bigtens_D2A (a symbol meant
135 to be private to gdtoa.a).
137 Sat Sep 12 17:05:15 EDT 1998
138 gdtoa.tar.gz: more changes in response to comments from Shawn C.
139 Sheridan (including repair of a glitch in g_ffmt.c). For consistency
140 and possible convenience, there are some new functions and some name
141 changes to existing ones:
152 Functions strtopd and strtopf are variations of strtod and strtof,
153 respectively, which write their results to their final (pointer)
154 arguments. Functions strtorf and strtord are now analogous to the
155 other strtor* functions in that they now have a final pointer
156 argument to which they write their results, and they return the
157 int value they get from strtodg.
158 The xL family (g_xLfmt, strto[Irp]xL) is a variation of the old x
159 family (for 80-bit IEEE double-extended precision) that assumes the
160 storage layout of the Motorola 68881's double-extended format: 80
161 interesting bits stored in 3 unsigned 32-bit ints (with a "hole", 16
162 zero bits, in the word that holds the sign and exponent). The x
163 family now deals with 80-bit (5 unsigned 16-bit ints) rather than
164 96-bit arrays (3 unsigned 32-bit ints) that hold its 80-bit
165 double-extended values. (This relaxes the alignment requirements of
166 the x family and results in strto[Ipr]x writing 80 rather than 96 bits
167 to their final arguments.)
168 Each g_*fmt routine now returns a pointer to the null character
169 that terminates the strings it writes, rather than a pointer to
170 the beginning of that string (the first argument). These routines
171 still return 0 (NULL) if the first argument is too short.
172 The second argument to g_dfmt is now pointer (to a double) rather
175 Thu Oct 29 21:54:00 EST 1998
176 dtoa.c: Fix bug in strtod under -DSudden_Underflow and (the default)
177 -DAvoid_Underflow: some numbers that should have suffered sudden
178 underflow were scaled inappropriately (giving nonzero return values).
179 Example: "1e-320" gave -3.6304123742133376e+280 rather than 0.
181 Mon Nov 2 15:41:16 EST 1998
182 dtoa.c: tweak to remove LL suffixes from numeric constants (for
183 compilers that offer a 64-bit long long type but do not recognize the
184 LL constants prescribed by C9x, the proposed update to the ANSI/ISO C
185 standard). Thanks to Earl Chew for pointing out the existence of such
187 gdtoa.tar.gz: renamed gdtoa.tgz and updated to incorporate the above
188 changes (of 29 Oct. and 2 Nov. 1998) to dtoa.c.
190 Thu Mar 25 17:56:44 EST 1999
191 dtoa.c, gdtoa.tgz: fix a bug in strtod's reading of 4.9e-324:
192 it returned 0 rather than the smallest denormal.
194 Mon Apr 12 10:39:25 EDT 1999
195 gdtoa.tgz: test/ftest.c: change %.7g to %.8g throughout.
197 Fri Aug 20 19:17:52 EDT 1999
198 gdtoa.tgz: gdtoa.c: fix two bugs reported by David Chase (thanks!):
199 1. An adjustment for denormalized numbers around 503 was off by one.
200 2. A check for "The special case" around line 551 omitted the condition
201 that we not be at the bottom of the exponent range.
203 Mon Sep 13 10:53:34 EDT 1999
204 dtoa.c: computationally invisible tweak for the benefit of people
205 who actually read the code:
208 < && word0(d) & Exp_mask
210 > && word0(d) & (Exp_mask & Exp_mask << 1)
212 I.e., in dtoa(), the "special case" does not arise for the smallest
213 normalized IEEE double. Thanks to Waldemar Horwat for pointing this
214 out and suggesting the modified test above. Also, some tweaks for
215 compilation with -DKR_headers.
216 gdtoa.tgz: gdtoa.c: analogous change:
219 < if (bbits == 1 && be0 > fpi->emin) {
221 > if (bbits == 1 && be0 > fpi->emin + 1) {
223 This has no effect on the g*fmt.c routines, but might affect the
224 computation of the shortest decimal string that rounds to the
225 smallest normalized floating-point number of other precisions.
226 gdota.tgz: test/d.out test/dI.out test/dd.out: updated to reflect
227 previous changes (of 19990820); test/*.c: most test programs modified
228 to permit #hex input. See the comments.
230 Fri Sep 17 01:39:25 EDT 1999
231 Try again to update dtoa.c: somehow dtoa.c got put back to a version
232 from 3 years ago after this "changes" file was updated on 13 Sept. 1999.
233 One more tweak to omit a warning on some systems:
235 < && word0(d) & (Exp_mask & Exp_mask << 1)
237 > && word0(d) & (Exp_mask & ~Exp_msk1)
238 Plus changes to avoid trouble with aggressively optimizing compilers
239 (e.g., gcc 2.95.1 under -O2). On some systems, these changes do not
240 affect the resulting machine code; on others, the old way of viewing
241 a double as a pair of ULongs is available with -DYES_ALIAS.
243 Tue Sep 21 09:21:25 EDT 1999
244 gdtoa.tgz: changes analogous to those of 17 Sept. 1999 to dtoa.c to
245 avoid trouble with aggressively optimizing compilers.
247 Wed Dec 15 13:14:38 EST 1999
248 dtoa.c: tweak to bypass a bug with HUGE_VAL on HP systems.
250 Mon Jan 17 18:32:52 EST 2000
251 dtoa.c and gdtoa.tgz: strtod: set errno = ERANGE on all inputs that
252 underflow to zero (not just those sufficiently less than the smallest
253 positive denormalized number).
254 gdtoa.tgz: README: point out that compiling with -DNO_ERRNO inhibits
255 errno assignments (by strtod and the core converter, strtodg).
257 Tue Jan 18 16:35:31 EST 2000
258 dtoa.c and gdtoa.tgz: strtod: modify the test inserted yesterday so
259 it may work correctly with buggy 80x87 compilers. (The change matters,
260 e.g., to Microsoft Visual C++ 4.2 and 6.0.)
262 Thu Nov 2 21:00:45 EST 2000
263 dtoa.c and gdtoa.tgz:
264 1. Fix bug in test for exact half-way cases of denormalized numbers
265 (without -DNO_IEEE_Scale).
266 2. Compilation with -DNO_ERRNO prevents strtod from assigning
267 errno = ERANGE when the result overflows or underflows to 0.
268 3. With IEEE arithmetic and no -DNO_IEEE_Scale, adjust scaling so
269 ulp(d) never returns a denormalized number. This and other tweaks
270 permit strtod and dtoa to work correctly on machines that flush
271 underflows to zero but otherwise use IEEE arithmetic without
272 Sudden_Underflow being #defined (and with strtod simply returning 0
273 instead of denormalized numbers).
274 4. Compilations with -DUSE_LOCALE causes strtod to use the current
275 locale's decimal_point value.
276 5. Under compilations with -DINFNAN_CHECK, strtod and strtodg (case
277 insensitively) treat "inf" the same as "infinity" and, unless
278 compiled with -DNo_Hex_NaN, accept "nan(x)", where x is a string of
279 hexadecimal digits and spaces, as a NaN whose value is constructed
280 from x (as explained in comments near the top of dtoa.c and in
282 6. The default PRIVATE_MEM is increased slightly (to 2304), and comments
283 near the top of dtoa.c provide more discussion of PRIVATE_MEM.
284 7. Meanings of dtoa modes 4,5,8,9 changed. See comments in dtoa.c and
285 gdtoa.c; modes 4 and 5 may now provide shorter strings that round
286 (in round-nearest mode) to the given double value. (Paxson's
287 testbase program is unhappy with this new rounding, as it can
288 introduce an error of more than one base-10 ulp when 17 or more
289 decimal digits are requested.)
290 8. With IEEE arithmetic, compilation with -DHonor_FLT_ROUNDS causes
291 strtod and dtoa to round according to FLT_ROUNDS:
294 2 ==> towards +Infinity,
295 3 ==> towards -Infinity.
296 9. With IEEE arithmetic, compilation with -DSET_INEXACT causes extra
297 computation (and sometimes slower conversions in dtoa and strtod,
298 particularly for dtoa in cases where otherwise some simple floating-
299 point computations would suffice) to set the IEEE inexact flag
300 correctly. As comments in dtoa.c explain in more detail, this
301 requires compilation in an environment (such as #include "dtoa.c"
302 in suitable source) that provides
303 int get_inexact(void);
304 void clear_inexact(void);
305 10. On input "-x", return 0 rather than -0.
307 gdtoa.tgz: gethex.c: adjust logic for reading hex constants to accord
308 with current wording of the C99 standard. Previously, I thought hex
309 constants read by strtod and friends had to have either a decimal point
310 or an exponent field; p. 307 of the C99 standard states that both are
311 optional. Because of the complexity of this reading, it is available
312 only in the variant of strtod that appears in gdtoa.tgz.
314 strtodg (gdtoa.tgz): New return value STRTOG_NaNbits (with
315 STRTOG_NoNumber renumbered). Allow STRTOG_Neg bit in strtodg returns
316 for STRTOG_NaN and STRTOG_NaNbits.
318 gdtoa.tgz: Fix uninitialized variable bug in g_Qfmt.c's handling of NaNs.
320 Mon Nov 13 14:00:05 EST 2000
321 gdtoa.tgz: strtodg: fix a storage leak and an apparently rare infinite
322 loop with a boundary case of directed rounding. Example input to
323 gdtoa/test/Qtest where the loop bug bit:
325 35184372088831.999999999999999999999999999999999999
326 This was revealed by testbase for quad precision Solaris arithmetic;
327 it did not show up in several other testbase configurations.
329 Wed Feb 7 12:56:11 EST 2001
330 dtoa.c: fix bug (possible infinite loop, e.g., with
331 2.47032822920623272e-324) introduced 20001113 in handling the special
332 case of a power of 2 to be rounded down one ulp. Add test (required
333 by changes of 20001113) for the extra special case of 2^-1075 (half
334 the smallest denormal).
335 gdtoa.tgz: corresponding adjustments to strtod.c and strtodg.c.
337 Tue Mar 13 00:46:09 EST 2001
338 gdtoa.tgz: gdtoa/strtodg.c: fix bug in handling values exactly half
339 an ulp less than the smallest normal floating-point number;
340 gdtoa/*test.c: fix glitch in handling "n ..." lines (intended to
343 Wed Mar 6 10:13:52 EST 2002
344 gdtoa.tgz: add gdtoa/test/strtodt.c and gdtoa/test/testnos3 to test
345 strtod on hard cases posted by Fred Tydeman to comp.arch.arithmetic on
346 26 Feb. 1996. Add comment to gdtoa/README about strtod requiring true
347 IEEE arithmetic (with 53-bit rounding precision on 80x87 chips).
348 In gdtoa/test, automate selection of expected output files [xQ]*.out.
350 Wed Mar 5 10:35:41 EST 2003
351 gdtoa.tgz: fix a bug in strtod's handling of 0-valued 0x... "decimal"
352 strings. A fault was possible. Thanks to David Shultz for reporting
355 Tue Mar 18 09:38:28 EST 2003
356 gdtoa.tgz: fix a glitch in strtodg.c with -DUSE_LOCALE; add #ifdef
357 USE_LOCALE lines to g__fmt.c (to affect binary --> decimal conversions
358 via the g*fmt routines), and add comments about -DUSE_LOCALE to README.
359 In short, compiling strtod.c, strtodg.c, and g__fmt.c with -DUSE_LOCALE
360 causes them to determine the decimal-point character from the current
361 locale. (Otherwise it is '.'.)
363 Fri Mar 21 16:36:27 EST 2003
364 gdtoa.tgz: gethex.c: add #ifdef USE_LOCAL logic; strtod.c: fix a
365 glitch in handling 0x... input (the return from gethex was ignored).
367 Wed Mar 26 15:35:10 EST 2003
368 gdtoa.tgz: gethex.c: pedantic (and normally invisible) change:
369 use unsigned char for decimalpoint variable (under -DUSE_LOCALE).
371 Sat Jan 17 23:58:52 MST 2004
372 gdtoa.tgz: gethex.c: supply missing parens in test for whether a
373 denormal result should be zero, correct logic for rounding up when the
374 result is denormal, and when returning zero or Infinity, set *bp = 0;
375 strtod.c: switch on gethex(...) & STRTOG_Retmask rather than just on
376 gethex(), and only copybits(..., bb) when bb is nonzero. This
377 mattered for underflows and overflows in 0x notation.
379 Thu Mar 25 22:34:56 MST 2004
380 dtoa.c and gdtoa.c/misc.c: change "(!x & 1)" to "(!x)" to avoid
381 confusion by human readers -- the object code is unaffected (with
382 reasonable compilers).
384 Mon Apr 12 00:44:22 MDT 2004
385 dtoa.c and gdtoa.tar.gz: update contact info. for dmg and correct
386 page numbers in comment on Steele & White (1990).
387 gdtoa.tgz: add strtodnrp.c for a variant of strtod that is slower
388 but does not require 53-bit rounding precision on Intel IA32 systems.
390 Tue Apr 13 00:28:14 MDT 2004
391 gdtoa.tgz: strtod.c: fix glitch when both INFNAN_CHECK and No_Hex_NaN
392 are #defined. Thanks to David Mendenhall for pointing this bug out.
394 Wed Jan 5 22:39:17 MST 2005
396 gethex.c: fix the bug reported by Stefan Farfeleder of ignoring a
397 binary-exponent-part if the converted number is zero.
398 strto[pr]x.c: fix bug reported by Stefan Farfeleder in setting the
399 exponent of denormals (which should be 0, not 1).
400 g_xfmt.c: fix a corresponding bug with denormals.
401 strtodg.c: fix a bug under IBM (base 16) arithemtic reported
402 by Greg Alexander: a correction to the binary exponent for changes to
403 the exponent of a native double value for avoiding overflow had to be
404 multiplied by 4 ("e2 <<= 2;").
405 Various files: minor tweaks for portability.
407 Sat Jan 15 15:36:03 MST 2005
408 gdtoa.tgz: gethex.c: fix a glitch introduced last week (and reported
409 by Stefan Farfelder) with 0x forms with no nonzero digits before the "."
410 character, e.g., 0x.1 (which was rendered as 0 rather than .0625).
411 gdtoa.tgz: many files: add automatic computation of gd_qnan.h for
412 giving the system-dependent format of a quiet NaN (the one generated
413 for Infinity - Infinity). Tweak test/makefile so differences in the
414 spelling of Infinity ("INF" or "Inf" on some systems) do not matter.
415 Fix bug in strtod.c and strtodg.c under which, e.g., -.nan was read
416 as NaN rather than unacceptable input (causing return 0). Adjust
417 comments in README about nan(...). Fix glitch in test/dt.c.
419 Sun Jan 16 18:22:13 MST 2005
420 gdtoa.tgz: strtodg.c: fix long-standing bug in handling input
421 that rounds up to 2^nbits, e.g., strtof("16777215.5"). Thanks to
422 Edward Moy for reporting this problem.
423 gdtoa.tgz: Fix some bugs with -DJust_16.
425 Thu Sep 22 22:40:16 MDT 2005
427 strtod.c: unless prevented by -DNO_FENV_H, include C99's fenv.h
428 and with hex input, get the current rounding mode from fegetround().
429 With decimal input, strtod honors the rounding mode automatically.
430 Thanks to David Schultz (das at FreeBSD dot ORG) for pointing
431 strtodg.c: fix a bug with handling numbers very near the largest
432 possible one, which were sometimes incorrectly converted to Infinity.
433 Thanks to Edward Moy (emoy at apple dot com) for pointing this out.
434 g_Qfmt.c: change strcpy to strcp. Thanks to J. T. Conklin
435 (jtc at acorntoolworks dot com) for pointing this out.
436 test/xtest.c: fix some subscript bugs.
437 test/x.ou0, test/x.ou1, test/xL.: update in response to the above fix to
439 test/makefile: add -lm to some link lines (needed for fegetround).
441 Sun Jan 21 20:26:44 MST 2007
443 strtodg.c: fix a botch in the test of whether to increase rvbits
444 before terminating the big for(;;) loop with dsign true: change
445 if (hi0bits(rvb->x[(rvb->wds - 1) >> kshift])
449 if (hi0bits(rvb->x[rvb->wds - 1]) != j)
451 Example of input where this bug bit: 1.9e27. Thanks to Edward Moy
452 <emoy@apple.com> for providing this example. Also, simplify the
453 preceding computation of j.
454 test/README: add comment that strtodt needs to operate with 53-bit
455 rounding precision on Intel x86 systems, and add a pointer to Paxson's
458 Sat Mar 15 11:44:31 MDT 2008
459 dtoa.c and gdtoa.tgz: with -DINFNAN_CHECK and without
460 -DGDOTA_NON_PEDANTIC_NANCHECK, conform to the ill-advised prescription
461 in the C99 standard of consuming (...) in "nan(...)" even when ...
462 is not of the expected form. Allow an optional 0x or 0X to precede
463 the string of hex digits in the expected form of ... .
464 gdtoa.tgz: gethex.c: have, e.g., strtod("0xyz",&se) set se to "xyz".
465 Previously it was incorrectly set to "0xyz".
467 Thu Aug 28 22:37:35 MDT 2008
468 dtoa.c and gdtoa.tgz: Fix a bug in strtod when compiled with
469 -DHonor_FLT_ROUNDS: in rounding modes other than "to nearest",
470 strtod looped on input larger than and within a factor of 2 of
471 the largest finite floating-point number. Since FLT_ROUNDS is buggy
472 on some (Linux) systems in that it does not reflect calls on
473 fesetround(), when Honor_FLT_ROUNDS is #defined, get the curren
474 rounding mode from fegetround() rather than FLT_ROUNDS, unless
475 Trust_FLT_ROUNDS is also #defined.
476 gdtoa/test/getround.c in gdtoa.tgz: simply report the current
477 rounding mode when the input line is "r" by itself. (Previously it
478 did so, but also complained of invalid input.)
479 gdtoa/gethex.c: fix an off-by-one bug in a rounding test; detect and
480 deal with huge exponents (positive or negative). This affected the
481 reading of hexadecimal floating-point values (0x...). Also set errno
482 to ERANGE on out-of-range values (unless compiled with -DNO_ERRNO).
483 gdtoa/strtod.c: adjust scaling of tinytens[4] (as in dtoa.c) to
484 avoid double rounding when dealing with numbers near the bottom of
487 Sat Aug 30 23:37:07 MDT 2008
488 gdtoa/gethex.c: ensure *bp is set to something (NULL if nothing else).
489 Bring gdtoa/xsum0.out and gdtoa/test/xsum0.out up to date.
491 Tue Sep 9 22:08:30 MDT 2008
492 gdtoa/strto*.c and gdtoa/*fmt.c: if compiled with -DUSE_LOCALE, use
493 the current locale's decimal point character string.
494 gdtoa/gdtoa.c: trim trailing zeros in a missed case (e.g., ndigits = 6
496 dtoa.c and gdtoa/strtod.c: on systems with IEEE arithmetic (and without
497 NO_ERRNO being defined) set ERANGE for denormal values as well as real
499 gdtoa/strtodg.c: fix an off-by-one bug in rounding to the largest
500 representable magnitude when nbits is a multiple of 32.
501 gdtoa/*fmt.c and gdtoa/gdtoa.h: bufsize changed from unsigned to size_t.
502 gdtoaimp.h, *fmt.c: change in calling sequence to internal g__fmt(),
503 which now explicitly checks bufsize.
504 Relevant routines (see README) honor the current rounding mode if
505 compiled with -DHonor_FLT_ROUNDS on IEEE-arithmetic systems that provide
506 the C99 fegetround() function.
507 gdtoa/test/getround.c can optionally be compiled with
508 -DHonor_FLT_ROUNDS and/or -DUSE_MY_LOCALE for manual testing of gdtoa.a
509 compiled with -DHonor_FLT_ROUNDS or -DUSE_LOCALE.
511 Fri Oct 10 20:07:15 MDT 2008
512 gdtoa/gethex.c: fix a bug reading hexadecimal floating-point values
513 starting with "0xd" for a nonzero digit d (such as "0x1.0002p3"). The
514 bug caused the values to be read as zero with endptr set incorrectly.
516 Tue Oct 28 00:14:08 MDT 2008
517 gdtoa/strtod.c: fix a comment glitch (with commented {}).
519 Tue Nov 11 23:05:25 MST 2008
520 gdtoa: fix a glitch in the strto* routines when compiled with
521 -DUSE_LOCALE and the locale's decimal-point string is two or more
522 characters long. Wrong conversions were then possible.
524 Fri Dec 5 18:20:36 MST 2008
525 gdtoa.tgz: fix bugs with reading C99-style hexadecimal floating-point
526 values when compiled with -DPack_16; on IEEE-arithmetic systems, make
527 INFNAN_CHECK the default unless NO_INFNAN_CHECK is #defined. (This is
528 consistent with dtoa.c, which has worked this way for a while.)
529 dtoa.c: add recognition of C99-style hexadecimal floating-point
530 values (unless compiled with NO_HEX_FP is #defined).
532 Thu Dec 11 23:10:23 MST 2008
533 dtoa.c: omit an unused variable.
535 Fri Jan 2 22:45:33 MST 2009
536 dtoa.c: tweak to banish some compiler warnings.
538 Sun Mar 1 20:57:22 MST 2009
539 dtoa.c, gdtoa/{g__fmt.c, gethex.c, strtod.c, strtodg.c}: change malloc
541 dtoa.c and gdtoa/gdtoaimp.h and gdtoa/misc.c: reduce Kmax, and use
542 MALLOC and FREE or free for huge blocks, which are possible only in
543 pathological cases, such as dtoa calls in mode 3 with thousands of
544 digits requested, or strtod() calls with thousand of digits. For the
545 latter case, I have an alternate approach that runs much faster
546 and uses less memory, but finding time to get it ready for distribution
549 Mon Mar 16 00:32:43 MDT 2009
550 dtoa.c: Fix a bug under -DUSE_LOCALE in handling "decimal point"
551 strings more than one character long.
552 dtoa.c and gdtoa/misc.c: Remove a buggy test activated with
554 dtoa.c and gdtoa/gdtoa.c: simplify logic for "4 leading 0 bits".
555 dtoa.c: Add logic (that can be disabled with -DNO_STRTOD_BIGCOMP
556 and that) to strtod for more efficiently handling a very long input
557 string. It proceeds by initially truncating the input string, then if
558 necessary comparing the whole string with a decimal expansion to
559 decide close cases. This logic is only used for input more than
560 STRTOD_DIGLIM digits long (default 40), and for now only applies to
561 IEEE arithmetic (for want of other kinds of platforms on which to run
562 tests). This only appears worthwhile for absurdly long input strings,
563 so a corresponding update to gdtoa does not seem warranted.
564 dtoa.c, gdtoa.tgz: tweaks (mostly adding unnecessary parens) to
565 silence "gcc -Wall" warnings. Aside from a couple of minor changes
566 to banish erroneous warnings about uninitialized variables, the tweaks
567 do not affect the generated object code.
569 Sat Apr 11 23:25:58 MDT 2009
570 dtoa.c: fix glitch in compiling with -DNo_Hex_NaN and the bug of
571 accepting (e.g.) ".nan" or ".inf" as NaN or Infinity.
572 gdtoa.tgz: tweaks to silence warnings from "gcc -Wstrict-aliasing=2";
573 update xsum0.out files.
575 Sun Apr 19 23:40:24 MDT 2009
576 dtoa.c, gdtoa/misc.c: do not attempt to allocate large memory blocks
577 from the private memory pool (which was an unlikely event, but a bug).
578 gdtoa/strtopx.c, gdtoa/strtopxL.c, gdtoa/strtorx.c, gdtoa/strtorxL.c:
579 supply explicit bit for Infinity. Note that the Q routines (which do
580 not supply this bit) are appropriate for Sparc quad precision (probably
581 known as long double with most current compilers).
583 Wed Dec 9 08:14:52 MST 2009
584 gdtoa.tgz: add gdtoa/printf.c* and modify makefile so "make Printf"
585 adds a printf to gdtoa.a (to be accessed with #include "stdio1.h" to
586 get gdtoa/stdio1.h, which you might install in some standard place).
587 On Intel/AMD i386, x86_64, and Sparc systems, this adds formats %La,
588 %Le, %Lf and %Lg to handle long double. On x86_64 systems, it also
589 adds %Lqa, %Lqe, %Lqf and %Lqg to handle 128-bit bit types (called
590 __float128 by gcc and _Quad by the Intel compiler). In gdtoa/test,
591 "make pf_test" tests this printf (provided the system is an i386,
592 x86_64, or Sparc system). On x86_64 systems, "make pf_testLq" tests
593 the %Lq... formats (briefly).
595 Mon Jan 11 22:25:17 MST 2010
596 dtoa.c: fix a minor performance bug and, under compilation with -DDEBUG,
597 an erroneous error message "oversize b in quorem" in strtod's processing
598 of some input that underflows to zero. Also fix a bug in bigcomp()'s
599 handling of numbers that will scale to denormal values. The increments
600 that bigcomp applied were ignoring the effects of denormalization.
602 Sat Jan 23 00:25:54 MST 2010
603 dtoa.c: Fix some glitches in recently introduced changes meant to
604 speed up returns in pedantic cases. In quorem, adjust #ifdef DEBUG
605 stuff so it does not complain when bigcomp() calls quorem on input
606 near the smallest representable number and rounding up by a bit causes
607 a quorem return > 9 (which in this case is not a bug). Fix a memory
608 leak in the unlikely case of overflow only being detected after some
609 high-precision integer computations. Fix an off-by-one bug in
610 handling a large number of digits with a few nonzero digits, followed
611 by many zeros, and then some nonzero digits. (This does not happen
612 with sensible input.) Fix an off-by-one bug in a recently introduced
613 quick test for underflow (i.e., zero result) on input at the bottom of
614 the exponent range. Thanks to Mark Dickinson for pointing these bugs
617 dtoa.c and gdtoa/strtod.c: Fix an obscure bug in strtod's handling
618 of some inputs of many digits at the bottom of the exponent range:
619 results were sometimes off by a bit when gdtoa/strtod.c or dtoa.c was
620 compiled without -DNO_IEEE_SCALE and, for dtoa.c, when compiled with
623 gdtoa/test/testnos3: add some examples that went wrong before
626 Sat Jan 23 23:29:02 MST 2010
627 dtoa.c: more tweaks relevant only to absurd input.
629 Tue Feb 2 23:05:34 MST 2010
630 dtoa.c: add test for setting errno = ERANGE when input of many digits
631 is rounded to Infinity or underflows to zero. Fix a memory leak in
633 gdtoa/strtod.c: make some corresponding changes.
635 Wed Jul 7 09:25:46 MDT 2010
636 dtoa.c: adjust to use bigcomp when necessary when compiled with
637 -DHonor_FLT_ROUNDS (and without -DNO_STRTOD_BIGCOMP), and the rounding
638 mode is torwards +Infinity. An input (supplied by Rick Regan
639 <exploringbinary@gmail.com>) where this matters is
640 1.100000000000000088817841970012523233890533447265626
641 gdtoa/strtod.c: fix errors (introduced 20090411) when compiled
642 with -DHonor_FLT_ROUNDS.
644 Wed Sep 15 09:00:26 MDT 2010
645 dtoa.c, gdtoa/dtoa.c, gdtoa/gdtoa.c: fix bugs with -DROUND_BIASED
646 pointed out by Jay Foad.
648 Mon Sep 27 13:43:30 MDT 2010
649 gdtoa/gdtoa.c: fix a glitch (not revealed by compilation) in the
650 changes of 15 Sept. 2010.
652 Fri Nov 5 13:02:41 MDT 2010
653 dtoa.c: fix a bug related to bigcomp: decimal strings with all
654 zeros before the decimal point more than 40 significant digits that
655 required use of bigcomp might be converted very incorrectly.
656 Example: .010000000000000000057612911342378542997169 .
657 Thanks to Rick Regan <exploringbinary@gmail.com> for reporting the
658 symptoms and providing an example.
661 dtoa.c, gdtoa/gdtoaimp.h, gdtoa/strtod.c: if
662 ROUND_BIASED_without_Round_Up is #defined, assume ROUND_BIASED and
663 omit the quick computation that would use ordinary arithmetic to
664 compute the correctly rounded result with one rounding error. If you
665 want biased rounding with IEEE-style format "double" and will operate
666 with rounding toward +Infinity, it suffices to #define ROUND_BIASED
667 (and thus retain the quick computation when it is appropriate).
668 gdtoa/gdtoa.h: change default Long from long to int (with the goal
669 of portability when compiling without -DLong=... specified). On some
670 64-bit systems, long is a 64-bit type; we need a 32-bit type here.
671 dtoa.c, gdtoa/gdtoa.c: fix a glith with ndigits with mode = 4 at
672 the bottom of the exponent range, e.g., 1e-323.