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