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