xref: /freebsd/contrib/gdtoa/changes (revision eb69d1f144a6fcc765d1b9d44a5ae8082353e70b)
1Sun 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
4d (to be converted) satisfies 10^-(ndigits+1) <= |d| < 10^-ndigits ,
5i.e., when the result, before rounding, would be empty but might
6round to one digit.  Adjust the decpt returned in these modes when
7the result is empty (i.e., when |d| <= 5 * 10^-ndigits).
8
9Tue Jul  2 21:44:00 EDT 1991
10  Correct an inefficiency introduced 2 days ago in dtoa's handling of
11integers in modes 0, 1.
12
13Mon Sep  9 23:29:38 EDT 1991
14  dtoa.c: remove superfluous declaration of size_t.
15
16Sun Oct  6 15:34:15 EDT 1991
17  dtoa.c: fix another bug in modes 3,5,7,9 when the result, before
18rounding, would be empty, but rounds to one digit: *decpt was low by
19one.
20
21Sat Jan 18 12:30:04 EST 1992
22  dtoa.c: add some #ifdef KR_headers lines relevant only if IBM is
23defined; for input decimal strings representing numbers too large, have
24strtod return HUGE_VAL only if __STDC__ is defined; otherwise have it
25return +-Infinity for IEEE arithmetic, +- the largest machine number
26for IBM and VAX arithmetic.  (If __STDC__ is not defined, HUGE_VAL may
27not be defined either, or it may be wrong.)
28
29Mon Apr 27 23:13:43 EDT 1992
30  dtoa.c: tweak strtod (one-line addition) so the end-pointer = start
31pointer when the input has, e.g., only white space.
32
33Thu May  7 18:04:46 EDT 1992
34  dtoa.c: adjust treatment of exponent field (in strtod) to behave
35reasonably with huge numbers and 16-bit ints.
36
37Fri Jun 19 08:29:02 EDT 1992
38  dtoa.c: fix a botch in placement of #ifdef __cplusplus (which only
39matters if you're using a C++ compiler).
40
41Wed Oct 21 11:23:07 EDT 1992
42  dtoa.c: add #ifdef Bad_float_h lines for systems with missing or
43inferior float.h .
44
45Thu 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;
48---
49>	for(result_k = 0; sizeof(Bigint) - sizeof(unsigned long) + j <= i;
50With 32-bit ints, the former could give too small a block for the return
51value when, e.g., mode = 2 or 4 and ndigits = 24 (16 for 16-bit ints).
52
53Mon Jun 21 12:56:42 EDT 1993
54  dtoa.c: tweak to work with 32-bit ints and 64-bit longs
55when compiled with -DLong=int .
56
57Wed Jan 26 11:09:16 EST 1994
58  dtoa.c: fix bug in strtod's handling of numbers with very
59negative exponents (e.g. 1.8826e-512), which should underflow to 0;
60fix storage leak in strtod with underflows and overflows near
61the underflow and overflow thresholds.
62
63Mon Feb 28 11:37:30 EST 1994
64  dtoa.c:
6585a86,89
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.
7087a92,95
71> #ifndef MALLOC
72> #define MALLOC malloc
73> #endif
74>
75352c360
76< 		rv = (Bigint *)malloc(sizeof(Bigint) + (x-1)*sizeof(Long));
77---
78> 		rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(Long));
79
80Thu Mar  3 16:56:39 EST 1994
81  dtoa.c: if MALLOC is #defined, declare it.
82
83Wed Jan  4 15:45:34 EST 1995
84  dtoa.c: add CONST qualification to tens, bigtens, tinytens (for use
85on embedded systems with little spare RAM).
86
87Fri Mar  1 08:55:39 EST 1996
88  g_fmt.c: honor the sign of 0 and return the first argument (buf).
89
90Sat Jul  6 07:59:28 EDT 1996
91  dtoa.c: cosmetic changes: "ULong" rather than "unsigned Long";
92update comments to reflect AT&T breakup.
93
94Mon 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.
97
98Tue Dec 17 15:01:56 EST 1996
99  dtoa.c: new #define possibilities: #define INFNAN_CHECK to have
100strtod check (case insensitively) for "Infinity" and "NaN" on machines
101with IEEE arithmetic; #define MULTIPLE_THREADS if the system offers
102preemptively scheduled multiple threads, in which case you must supply
103routines ACQUIRE_DTOA_LOCK(n) and FREE_DTOA_LOCK(n) (n = 0 or 1).
104New void freedtoa(char*) for freeing values returned by dtoa; use of
105freedtoa() is required if MULTIPLE_THREADS is #defined, and is merely
106recommended otherwise.
107  g_fmt.c: adjusted to invoke freedtoa().
108
109Wed Feb 12 00:40:01 EST 1997
110  dtoa.c: strtod: on IEEE systems, scale to avoid intermediate
111underflows when the result does not underflow; compiling with
112-DNO_IEEE_Scale restores the old logic.  Fix a bug, revealed by
113input string 2.2250738585072012e-308, in treating input just less
114than the smallest normalized number.  (The bug introduced an extra
115ULP of error in this special case.)
116
117Tue May 12 11:13:04 EDT 1998
118  dtoa.c: strtod: fix a glitch introduced with the scaling of 19970212
119that caused one-bit rounding errors in certain denormal numbers, such
120as 8.44291197326099e-309, which was read as 8.442911973260987e-309.
121Remove #ifdef Unsigned_Shifts logic in favor of unsigned arithmetic.
122Unless compiled with -DNO_LONG_LONG, use 64-bit arithmetic where
123possible.
124
125Fri May 15 07:49:07 EDT 1998
126  dtoa.c: strtod: fix another glitch with scaling to avoid underflow
127with IEEE arithmetic, again revealed by the input string
1282.2250738585072012e-308, which was rounded to the largest denormal
129rather than the smallest normal double precision number.
130
131Wed 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
134compiled with -DNO_ERRNO); bigtens --> bigtens_D2A (a symbol meant
135to be private to gdtoa.a).
136
137Sat Sep 12 17:05:15 EDT 1998
138  gdtoa.tar.gz: more changes in response to comments from Shawn C.
139Sheridan (including repair of a glitch in g_ffmt.c).  For consistency
140and possible convenience, there are some new functions and some name
141changes to existing ones:
142	Old	New
143	---	g_xLfmt
144	strtoQ	strtopQ
145	---	strtopd
146	strtodd	strtopdd
147	---	strtopf
148	strtox	strtopx
149	---	strtopxL
150	---	strtorxL
151	---	strtoIxL
152Functions strtopd and strtopf are variations of strtod and strtof,
153respectively, which write their results to their final (pointer)
154arguments.  Functions strtorf and strtord are now analogous to the
155other strtor* functions in that they now have a final pointer
156argument to which they write their results, and they return the
157int value they get from strtodg.
158  The xL family (g_xLfmt, strto[Irp]xL) is a variation of the old x
159family (for 80-bit IEEE double-extended precision) that assumes the
160storage layout of the Motorola 68881's double-extended format:  80
161interesting bits stored in 3 unsigned 32-bit ints (with a "hole", 16
162zero bits, in the word that holds the sign and exponent).  The x
163family now deals with 80-bit (5 unsigned 16-bit ints) rather than
16496-bit arrays (3 unsigned 32-bit ints) that hold its 80-bit
165double-extended values.  (This relaxes the alignment requirements of
166the x family and results in strto[Ipr]x writing 80 rather than 96 bits
167to their final arguments.)
168  Each g_*fmt routine now returns a pointer to the null character
169that terminates the strings it writes, rather than a pointer to
170the beginning of that string (the first argument).  These routines
171still return 0 (NULL) if the first argument is too short.
172  The second argument to g_dfmt is now pointer (to a double) rather
173than a double value.
174
175Thu 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
178underflow were scaled inappropriately (giving nonzero return values).
179Example: "1e-320" gave -3.6304123742133376e+280 rather than 0.
180
181Mon Nov  2 15:41:16 EST 1998
182  dtoa.c: tweak to remove LL suffixes from numeric constants (for
183compilers that offer a 64-bit long long type but do not recognize the
184LL constants prescribed by C9x, the proposed update to the ANSI/ISO C
185standard).  Thanks to Earl Chew for pointing out the existence of such
186compilers.
187  gdtoa.tar.gz: renamed gdtoa.tgz and updated to incorporate the above
188changes (of 29 Oct. and 2 Nov. 1998) to dtoa.c.
189
190Thu Mar 25 17:56:44 EST 1999
191  dtoa.c, gdtoa.tgz: fix a bug in strtod's reading of 4.9e-324:
192it returned 0 rather than the smallest denormal.
193
194Mon Apr 12 10:39:25 EDT 1999
195  gdtoa.tgz: test/ftest.c: change %.7g to %.8g throughout.
196
197Fri Aug 20 19:17:52 EDT 1999
198  gdtoa.tgz: gdtoa.c: fix two bugs reported by David Chase (thanks!):
1991. An adjustment for denormalized numbers around 503 was off by one.
2002. A check for "The special case" around line 551 omitted the condition
201that we not be at the bottom of the exponent range.
202
203Mon Sep 13 10:53:34 EDT 1999
204  dtoa.c: computationally invisible tweak for the benefit of people
205who actually read the code:
206
2072671c2671
208< 		 && word0(d) & Exp_mask
209---
210> 		 && word0(d) & (Exp_mask & Exp_mask << 1)
211
212I.e., in dtoa(), the "special case" does not arise for the smallest
213normalized IEEE double.  Thanks to Waldemar Horwat for pointing this
214out and suggesting the modified test above.  Also, some tweaks for
215compilation with -DKR_headers.
216  gdtoa.tgz: gdtoa.c: analogous change:
217
218552c552
219< 		if (bbits == 1 && be0 > fpi->emin) {
220---
221> 		if (bbits == 1 && be0 > fpi->emin + 1) {
222
223This has no effect on the g*fmt.c routines, but might affect the
224computation of the shortest decimal string that rounds to the
225smallest normalized floating-point number of other precisions.
226  gdota.tgz: test/d.out test/dI.out test/dd.out: updated to reflect
227previous changes (of 19990820); test/*.c: most test programs modified
228to permit #hex input.  See the comments.
229
230Fri Sep 17 01:39:25 EDT 1999
231  Try again to update dtoa.c: somehow dtoa.c got put back to a version
232from 3 years ago after this "changes" file was updated on 13 Sept. 1999.
233One more tweak to omit a warning on some systems:
2342671c2671
235<		 && word0(d) & (Exp_mask & Exp_mask << 1)
236---
237>		 && word0(d) & (Exp_mask & ~Exp_msk1)
238Plus changes to avoid trouble with aggressively optimizing compilers
239(e.g., gcc 2.95.1 under -O2).  On some systems, these changes do not
240affect the resulting machine code; on others, the old way of viewing
241a double as a pair of ULongs is available with -DYES_ALIAS.
242
243Tue Sep 21 09:21:25 EDT 1999
244  gdtoa.tgz: changes analogous to those of 17 Sept. 1999 to dtoa.c to
245avoid trouble with aggressively optimizing compilers.
246
247Wed Dec 15 13:14:38 EST 1999
248  dtoa.c: tweak to bypass a bug with HUGE_VAL on HP systems.
249
250Mon Jan 17 18:32:52 EST 2000
251  dtoa.c and gdtoa.tgz: strtod: set errno = ERANGE on all inputs that
252underflow to zero (not just those sufficiently less than the smallest
253positive denormalized number).
254  gdtoa.tgz: README: point out that compiling with -DNO_ERRNO inhibits
255errno assignments (by strtod and the core converter, strtodg).
256
257Tue Jan 18 16:35:31 EST 2000
258  dtoa.c and gdtoa.tgz: strtod: modify the test inserted yesterday so
259it may work correctly with buggy 80x87 compilers.  (The change matters,
260e.g., to Microsoft Visual C++ 4.2 and 6.0.)
261
262Thu Nov  2 21:00:45 EST 2000
263  dtoa.c and gdtoa.tgz:
2641. Fix bug in test for exact half-way cases of denormalized numbers
265   (without -DNO_IEEE_Scale).
2662. Compilation with -DNO_ERRNO prevents strtod from assigning
267   errno = ERANGE when the result overflows or underflows to 0.
2683. 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).
2744. Compilations with -DUSE_LOCALE causes strtod to use the current
275   locale's decimal_point value.
2765. 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
281   gdtoaimp.h).
2826. The default PRIVATE_MEM is increased slightly (to 2304), and comments
283   near the top of dtoa.c provide more discussion of PRIVATE_MEM.
2847. 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.)
2908. With IEEE arithmetic, compilation with -DHonor_FLT_ROUNDS causes
291   strtod and dtoa to round according to FLT_ROUNDS:
292	0 ==> towards 0,
293	1 ==> nearest,
294	2 ==> towards +Infinity,
295	3 ==> towards -Infinity.
2969. 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);
30510. On input "-x", return 0 rather than -0.
306
307gdtoa.tgz: gethex.c: adjust logic for reading hex constants to accord
308with current wording of the C99 standard.  Previously, I thought hex
309constants read by strtod and friends had to have either a decimal point
310or an exponent field; p. 307 of the C99 standard states that both are
311optional.  Because of the complexity of this reading, it is available
312only in the variant of strtod that appears in gdtoa.tgz.
313
314strtodg (gdtoa.tgz): New return value STRTOG_NaNbits (with
315STRTOG_NoNumber renumbered).  Allow STRTOG_Neg bit in strtodg returns
316for STRTOG_NaN and STRTOG_NaNbits.
317
318gdtoa.tgz: Fix uninitialized variable bug in g_Qfmt.c's handling of NaNs.
319
320Mon Nov 13 14:00:05 EST 2000
321  gdtoa.tgz: strtodg:  fix a storage leak and an apparently rare infinite
322loop with a boundary case of directed rounding.  Example input to
323gdtoa/test/Qtest where the loop bug bit:
324	r 3
325	35184372088831.999999999999999999999999999999999999
326This was revealed by testbase for quad precision Solaris arithmetic;
327it did not show up in several other testbase configurations.
328
329Wed Feb  7 12:56:11 EST 2001
330  dtoa.c:  fix bug (possible infinite loop, e.g., with
3312.47032822920623272e-324) introduced 20001113 in handling the special
332case of a power of 2 to be rounded down one ulp.  Add test (required
333by changes of 20001113) for the extra special case of 2^-1075 (half
334the smallest denormal).
335  gdtoa.tgz: corresponding adjustments to strtod.c and strtodg.c.
336
337Tue Mar 13 00:46:09 EST 2001
338  gdtoa.tgz: gdtoa/strtodg.c: fix bug in handling values exactly half
339an ulp less than the smallest normal floating-point number;
340gdtoa/*test.c: fix glitch in handling "n ..." lines (intended to
341change "ndig").
342
343Wed Mar  6 10:13:52 EST 2002
344  gdtoa.tgz:  add gdtoa/test/strtodt.c and gdtoa/test/testnos3 to test
345strtod on hard cases posted by Fred Tydeman to comp.arch.arithmetic on
34626 Feb. 1996.  Add comment to gdtoa/README about strtod requiring true
347IEEE arithmetic (with 53-bit rounding precision on 80x87 chips).
348In gdtoa/test, automate selection of expected output files [xQ]*.out.
349
350Wed Mar  5 10:35:41 EST 2003
351  gdtoa.tgz:  fix a bug in strtod's handling of 0-valued 0x... "decimal"
352strings.  A fault was possible.  Thanks to David Shultz for reporting
353this bug.
354
355Tue Mar 18 09:38:28 EST 2003
356  gdtoa.tgz:  fix a glitch in strtodg.c with -DUSE_LOCALE; add #ifdef
357USE_LOCALE lines to g__fmt.c (to affect binary --> decimal conversions
358via the g*fmt routines), and add comments about -DUSE_LOCALE to README.
359In short, compiling strtod.c, strtodg.c, and g__fmt.c with -DUSE_LOCALE
360causes them to determine the decimal-point character from the current
361locale.  (Otherwise it is '.'.)
362
363Fri Mar 21 16:36:27 EST 2003
364  gdtoa.tgz:  gethex.c: add #ifdef USE_LOCAL logic; strtod.c: fix a
365glitch in handling 0x... input (the return from gethex was ignored).
366
367Wed Mar 26 15:35:10 EST 2003
368  gdtoa.tgz:  gethex.c:  pedantic (and normally invisible) change:
369use unsigned char for decimalpoint variable (under -DUSE_LOCALE).
370
371Sat Jan 17 23:58:52 MST 2004
372  gdtoa.tgz:  gethex.c:  supply missing parens in test for whether a
373denormal result should be zero, correct logic for rounding up when the
374result is denormal, and when returning zero or Infinity, set *bp = 0;
375strtod.c:  switch on gethex(...)  & STRTOG_Retmask rather than just on
376gethex(), and only copybits(..., bb) when bb is nonzero.  This
377mattered for underflows and overflows in 0x notation.
378
379Thu Mar 25 22:34:56 MST 2004
380 dtoa.c and gdtoa.c/misc.c:  change "(!x & 1)" to "(!x)" to avoid
381confusion by human readers -- the object code is unaffected (with
382reasonable compilers).
383
384Mon Apr 12 00:44:22 MDT 2004
385 dtoa.c and gdtoa.tar.gz:  update contact info. for dmg and correct
386page numbers in comment on Steele & White (1990).
387 gdtoa.tgz:  add strtodnrp.c for a variant of strtod that is slower
388but does not require 53-bit rounding precision on Intel IA32 systems.
389
390Tue Apr 13 00:28:14 MDT 2004
391 gdtoa.tgz: strtod.c: fix glitch when both INFNAN_CHECK and No_Hex_NaN
392are #defined.  Thanks to David Mendenhall for pointing this bug out.
393
394Wed Jan  5 22:39:17 MST 2005
395  gdtoa.tgz:
396    gethex.c:  fix the bug reported by Stefan Farfeleder of ignoring a
397binary-exponent-part if the converted number is zero.
398    strto[pr]x.c: fix bug reported by Stefan Farfeleder in setting the
399exponent 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
402by Greg Alexander:  a correction to the binary exponent for changes to
403the exponent of a native double value for avoiding overflow had to be
404multiplied by 4 ("e2 <<= 2;").
405    Various files: minor tweaks for portability.
406
407Sat Jan 15 15:36:03 MST 2005
408  gdtoa.tgz: gethex.c:  fix a glitch introduced last week (and reported
409by Stefan Farfelder) with 0x forms with no nonzero digits before the "."
410character, 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
412giving the system-dependent format of a quiet NaN (the one generated
413for Infinity - Infinity).  Tweak test/makefile so differences in the
414spelling of Infinity ("INF" or "Inf" on some systems) do not matter.
415Fix bug in strtod.c and strtodg.c under which, e.g., -.nan was read
416as NaN rather than unacceptable input (causing return 0).  Adjust
417comments in README about nan(...).  Fix glitch in test/dt.c.
418
419Sun Jan 16 18:22:13 MST 2005
420  gdtoa.tgz: strtodg.c: fix long-standing bug in handling input
421that rounds up to 2^nbits, e.g., strtof("16777215.5").  Thanks to
422Edward Moy for reporting this problem.
423  gdtoa.tgz: Fix some bugs with -DJust_16.
424
425Thu Sep 22 22:40:16 MDT 2005
426gdtoa.tgz:
427  strtod.c: unless prevented by -DNO_FENV_H, include C99's fenv.h
428and with hex input, get the current rounding mode from fegetround().
429With decimal input, strtod honors the rounding mode automatically.
430Thanks to David Schultz (das at FreeBSD dot ORG) for pointing
431  strtodg.c: fix a bug with handling numbers very near the largest
432possible one, which were sometimes incorrectly converted to Infinity.
433Thanks 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
438test/xtest.c.
439  test/makefile:  add -lm to some link lines (needed for fegetround).
440
441Sun Jan 21 20:26:44 MST 2007
442gdtoa.tgz:
443  strtodg.c:  fix a botch in the test of whether to increase rvbits
444before terminating the big for(;;) loop with dsign true:  change
445	if (hi0bits(rvb->x[(rvb->wds - 1) >> kshift])
446			!= j)
447		rvbits++;
448to
449	if (hi0bits(rvb->x[rvb->wds - 1]) != j)
450		rvbits++;
451Example of input where this bug bit:  1.9e27.  Thanks to Edward Moy
452<emoy@apple.com> for providing this example.  Also, simplify the
453preceding computation of j.
454  test/README:  add comment that strtodt needs to operate with 53-bit
455rounding precision on Intel x86 systems, and add a pointer to Paxson's
456paper.
457
458Sat 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
461in the C99 standard of consuming (...)  in "nan(...)"  even when ...
462is not of the expected form.  Allow an optional 0x or 0X to precede
463the string of hex digits in the expected form of ... .
464  gdtoa.tgz: gethex.c: have, e.g., strtod("0xyz",&se) set se to "xyz".
465Previously it was incorrectly set to "0xyz".
466
467Thu 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",
470strtod looped on input larger than and within a factor of 2 of
471the largest finite floating-point number.  Since FLT_ROUNDS is buggy
472on some (Linux) systems in that it does not reflect calls on
473fesetround(), when Honor_FLT_ROUNDS is #defined, get the curren
474rounding mode from fegetround() rather than FLT_ROUNDS, unless
475Trust_FLT_ROUNDS is also #defined.
476  gdtoa/test/getround.c in gdtoa.tgz: simply report the current
477rounding mode when the input line is "r" by itself.  (Previously it
478did so, but also complained of invalid input.)
479  gdtoa/gethex.c: fix an off-by-one bug in a rounding test; detect and
480deal with huge exponents (positive or negative).  This affected the
481reading of hexadecimal floating-point values (0x...).  Also set errno
482to 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
484avoid double rounding when dealing with numbers near the bottom of
485the exponent range.
486
487Sat 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.
490
491Tue Sep  9 22:08:30 MDT 2008
492  gdtoa/strto*.c and gdtoa/*fmt.c:  if compiled with -DUSE_LOCALE, use
493the current locale's decimal point character string.
494  gdtoa/gdtoa.c: trim trailing zeros in a missed case (e.g., ndigits = 6
495on 1020302).
496  dtoa.c and gdtoa/strtod.c: on systems with IEEE arithmetic (and without
497NO_ERRNO being defined) set ERANGE for denormal values as well as real
498underflows.
499  gdtoa/strtodg.c:  fix an off-by-one bug in rounding to the largest
500representable 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(),
503which now explicitly checks bufsize.
504  Relevant routines (see README) honor the current rounding mode if
505compiled with -DHonor_FLT_ROUNDS on IEEE-arithmetic systems that provide
506the 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
509compiled with -DHonor_FLT_ROUNDS or -DUSE_LOCALE.
510
511Fri Oct 10 20:07:15 MDT 2008
512  gdtoa/gethex.c:  fix a bug reading hexadecimal floating-point values
513starting with "0xd" for a nonzero digit d (such as "0x1.0002p3").  The
514bug caused the values to be read as zero with endptr set incorrectly.
515
516Tue Oct 28 00:14:08 MDT 2008
517  gdtoa/strtod.c: fix a comment glitch (with commented {}).
518
519Tue 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
522characters long.  Wrong conversions were then possible.
523
524Fri Dec  5 18:20:36 MST 2008
525  gdtoa.tgz: fix bugs with reading C99-style hexadecimal floating-point
526values when compiled with -DPack_16; on IEEE-arithmetic systems, make
527INFNAN_CHECK the default unless NO_INFNAN_CHECK is #defined.  (This is
528consistent with dtoa.c, which has worked this way for a while.)
529  dtoa.c:  add recognition of C99-style hexadecimal floating-point
530values (unless compiled with NO_HEX_FP is #defined).
531
532Thu Dec 11 23:10:23 MST 2008
533  dtoa.c: omit an unused variable.
534
535Fri Jan  2 22:45:33 MST 2009
536  dtoa.c: tweak to banish some compiler warnings.
537
538Sun Mar  1 20:57:22 MST 2009
539  dtoa.c, gdtoa/{g__fmt.c, gethex.c, strtod.c, strtodg.c}: change malloc
540to MALLOC.
541  dtoa.c and gdtoa/gdtoaimp.h and gdtoa/misc.c:  reduce Kmax, and use
542MALLOC and FREE or free for huge blocks, which are possible only in
543pathological cases, such as dtoa calls in mode 3 with thousands of
544digits requested, or strtod() calls with thousand of digits.  For the
545latter case, I have an alternate approach that runs much faster
546and uses less memory, but finding time to get it ready for distribution
547may take a while.
548
549Mon Mar 16 00:32:43 MDT 2009
550  dtoa.c:  Fix a bug under -DUSE_LOCALE in handling "decimal point"
551strings more than one character long.
552  dtoa.c and gdtoa/misc.c:  Remove a buggy test activated with
553-DDEBUG.
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
556and that) to strtod for more efficiently handling a very long input
557string.  It proceeds by initially truncating the input string, then if
558necessary comparing the whole string with a decimal expansion to
559decide close cases.  This logic is only used for input more than
560STRTOD_DIGLIM digits long (default 40), and for now only applies to
561IEEE arithmetic (for want of other kinds of platforms on which to run
562tests).  This only appears worthwhile for absurdly long input strings,
563so a corresponding update to gdtoa does not seem warranted.
564  dtoa.c, gdtoa.tgz:  tweaks (mostly adding unnecessary parens) to
565silence "gcc -Wall" warnings.  Aside from a couple of minor changes
566to banish erroneous warnings about uninitialized variables, the tweaks
567do not affect the generated object code.
568
569Sat Apr 11 23:25:58 MDT 2009
570  dtoa.c: fix glitch in compiling with -DNo_Hex_NaN and the bug of
571accepting (e.g.) ".nan" or ".inf" as NaN or Infinity.
572  gdtoa.tgz: tweaks to silence warnings from "gcc -Wstrict-aliasing=2";
573update xsum0.out files.
574
575Sun Apr 19 23:40:24 MDT 2009
576  dtoa.c, gdtoa/misc.c:  do not attempt to allocate large memory blocks
577from 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:
579supply explicit bit for Infinity.  Note that the Q routines (which do
580not supply this bit) are appropriate for Sparc quad precision (probably
581known as long double with most current compilers).
582
583Wed Dec  9 08:14:52 MST 2009
584  gdtoa.tgz:  add gdtoa/printf.c* and modify makefile so "make Printf"
585adds a printf to gdtoa.a (to be accessed with #include "stdio1.h" to
586get gdtoa/stdio1.h, which you might install in some standard place).
587On 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
589adds %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,
592x86_64, or Sparc system).  On x86_64 systems, "make pf_testLq" tests
593the %Lq...  formats (briefly).
594
595Mon Jan 11 22:25:17 MST 2010
596  dtoa.c: fix a minor performance bug and, under compilation with -DDEBUG,
597an erroneous error message "oversize b in quorem" in strtod's processing
598of some input that underflows to zero.  Also fix a bug in bigcomp()'s
599handling of numbers that will scale to denormal values.  The increments
600that bigcomp applied were ignoring the effects of denormalization.
601
602Sat Jan 23 00:25:54 MST 2010
603  dtoa.c:  Fix some glitches in recently introduced changes meant to
604speed up returns in pedantic cases.  In quorem, adjust #ifdef DEBUG
605stuff so it does not complain when bigcomp() calls quorem on input
606near the smallest representable number and rounding up by a bit causes
607a quorem return > 9 (which in this case is not a bug).  Fix a memory
608leak in the unlikely case of overflow only being detected after some
609high-precision integer computations.  Fix an off-by-one bug in
610handling a large number of digits with a few nonzero digits, followed
611by many zeros, and then some nonzero digits.  (This does not happen
612with sensible input.)  Fix an off-by-one bug in a recently introduced
613quick test for underflow (i.e., zero result) on input at the bottom of
614the exponent range.  Thanks to Mark Dickinson for pointing these bugs
615out.
616
617  dtoa.c and gdtoa/strtod.c:  Fix an obscure bug in strtod's handling
618of some inputs of many digits at the bottom of the exponent range:
619results were sometimes off by a bit when gdtoa/strtod.c or dtoa.c was
620compiled without -DNO_IEEE_SCALE and, for dtoa.c, when compiled with
621-DNO_STRTOD_BIGCOMP.
622
623  gdtoa/test/testnos3: add some examples that went wrong before
624the present changes.
625
626Sat Jan 23 23:29:02 MST 2010
627  dtoa.c: more tweaks relevant only to absurd input.
628
629Tue Feb  2 23:05:34 MST 2010
630  dtoa.c: add test for setting errno = ERANGE when input of many digits
631is rounded to Infinity or underflows to zero.  Fix a memory leak in
632such instances.
633  gdtoa/strtod.c: make some corresponding changes.
634
635Wed 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
638mode is torwards +Infinity.  An input (supplied by Rick Regan
639<exploringbinary@gmail.com>) where this matters is
6401.100000000000000088817841970012523233890533447265626
641  gdtoa/strtod.c:  fix errors (introduced 20090411) when compiled
642with -DHonor_FLT_ROUNDS.
643
644Wed Sep 15 09:00:26 MDT 2010
645  dtoa.c, gdtoa/dtoa.c, gdtoa/gdtoa.c:  fix bugs with -DROUND_BIASED
646pointed out by Jay Foad.
647
648Mon Sep 27 13:43:30 MDT 2010
649  gdtoa/gdtoa.c: fix a glitch (not revealed by compilation) in the
650changes of 15 Sept. 2010.
651
652Fri Nov  5 13:02:41 MDT 2010
653  dtoa.c:  fix a bug related to bigcomp:  decimal strings with all
654zeros before the decimal point more than 40 significant digits that
655required use of bigcomp might be converted very incorrectly.
656Example: .010000000000000000057612911342378542997169 .
657Thanks to Rick Regan <exploringbinary@gmail.com> for reporting the
658symptoms and providing an example.
659
66020110403:
661  dtoa.c, gdtoa/gdtoaimp.h, gdtoa/strtod.c:  if
662ROUND_BIASED_without_Round_Up is #defined, assume ROUND_BIASED and
663omit the quick computation that would use ordinary arithmetic to
664compute the correctly rounded result with one rounding error.  If you
665want biased rounding with IEEE-style format "double" and will operate
666with 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
669of portability when compiling without -DLong=... specified).  On some
67064-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
672the bottom of the exponent range, e.g., 1e-323.
673