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