| 1 |
This directory contains source for several test programs: |
| 2 |
|
| 3 |
dt is for conversion to/from double; it permits input of pairs of |
| 4 |
32-bit hex integers as #hhhhhhhh hhhhhhhh (i.e., the initial '#' |
| 5 |
indicates hex input). No initial # ==> decimal input. |
| 6 |
After the input number is an optional : mode ndigits |
| 7 |
(colon, and decimal integers for parameters "mode" and "ndigits" |
| 8 |
to gdtoa). |
| 9 |
|
| 10 |
Qtest, ddtest, dtest, ftest, xLtest and xtest are for conversion to/from |
| 11 |
|
| 12 |
f IEEE single precision |
| 13 |
d IEEE double precision |
| 14 |
xL IEEE extended precision, as on Motorola 680x0 chips |
| 15 |
x IEEE extended precision, as on Intel 80x87 chips or |
| 16 |
software emulation of Motorola 680x0 chips |
| 17 |
Q quad precision, as on Sun Sparc chips |
| 18 |
dd double double, pairs of IEEE double numbers |
| 19 |
whose sum is the desired value |
| 20 |
|
| 21 |
They're all similar, except for the precision. They test both |
| 22 |
directed roundings and interval input (the strtoI* routines). |
| 23 |
Lines that begin with "r" specify or interrogate the desired rounding |
| 24 |
direction: |
| 25 |
|
| 26 |
0 = toward 0 |
| 27 |
1 = nearest (default) |
| 28 |
2 = toward +Infinity |
| 29 |
3 = toward -Infinity |
| 30 |
|
| 31 |
These are the FPI_Round_* values in gdota.h. The "r" value is sticky: |
| 32 |
it stays in effect til changed. To change the value, give a line that |
| 33 |
starts with r followed by 0, 1, 2, or 3. To check the value, give "r" |
| 34 |
by itself. |
| 35 |
|
| 36 |
Lines that begin with n followed by a number specify the ndig |
| 37 |
argument for subsequent calls to the relevant g_*fmt routine. |
| 38 |
|
| 39 |
Lines that start with # followed by the appropriate number of |
| 40 |
hexadecimal strings (see the comments) give the big-endian |
| 41 |
internal representation of the desired number. |
| 42 |
|
| 43 |
When routines Qtest, xLtest, and xtest are used on machines whose |
| 44 |
long double is of type "quad" (for Qtest) or "extended" (for x*test), |
| 45 |
they try to print with %Lg as another way to show binary values. |
| 46 |
|
| 47 |
Program ddtest also accepts (white-space separated) pairs of decimal |
| 48 |
input numbers; it converts both with strtod and feeds the result |
| 49 |
to g_ddfmt. |
| 50 |
|
| 51 |
Program dItest exercises strtodI and strtoId. |
| 52 |
|
| 53 |
Programs dItestsi and ddtestsi are for testing the sudden-underflow |
| 54 |
logic (on double and double-double conversions). |
| 55 |
|
| 56 |
Program strtodt tests strtod on some hard cases (in file testnos3) |
| 57 |
posted by Fred Tydeman to comp.arch.arithmetic on 26 Feb. 1996. |
| 58 |
To get correct results on Intel (x86) systems, the rounding precision |
| 59 |
must be set to 53 bits. This can be done, e.g., by invoking |
| 60 |
fpinit_ASL(), whose source appears in |
| 61 |
http://www.netlib.org/ampl/solvers/fpinit.c . |
| 62 |
|
| 63 |
The obad directory shows results expected on (at least some) Intel x86 |
| 64 |
Linux systems and may not be relevant to other systems. |
| 65 |
|
| 66 |
You can optionally compile getround.c with -DHonor_FLT_ROUNDS |
| 67 |
to manually test strtof, strtod, etc., using fegetround(). |
| 68 |
You can also or alternatively compile getround.c with |
| 69 |
-DUSE_MY_LOCALE (when ../gdtoa.a is compiled with -DUSE_LOCALE) |
| 70 |
to test multi-byte decimal points. |
| 71 |
|
| 72 |
If in the parent directory, you have sucessfully invoked "make Printf" |
| 73 |
to add a "printf" (called Printf and accessed via ../stdio1.h), then |
| 74 |
here you can use "make pf_test" and (if you have both a 64-bit long |
| 75 |
double and a 113-bit "quad" double type) "make pf_testLq" for a brief |
| 76 |
test of %g and %a variants in Printf. |
| 77 |
|
| 78 |
These are simple test programs, not meant for exhaustive testing, |
| 79 |
but for manually testing "interesting" cases. Paxson's testbase |
| 80 |
is good for more exhaustive testing, in part with random inputs. |
| 81 |
See ftp://ftp.ee.lbl.gov/testbase-report.ps.Z . |