11.1Schristos# /**************************************************************** 21.1Schristos# Copyright (C) 1998, 2000 by Lucent Technologies 31.1Schristos# All Rights Reserved 41.1Schristos# 51.1Schristos# Permission to use, copy, modify, and distribute this software and 61.1Schristos# its documentation for any purpose and without fee is hereby 71.1Schristos# granted, provided that the above copyright notice appear in all 81.1Schristos# copies and that both that the copyright notice and this 91.1Schristos# permission notice and warranty disclaimer appear in supporting 101.1Schristos# documentation, and that the name of Lucent or any of its entities 111.1Schristos# not be used in advertising or publicity pertaining to 121.1Schristos# distribution of the software without specific, written prior 131.1Schristos# permission. 141.1Schristos# 151.1Schristos# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 161.1Schristos# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 171.1Schristos# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY 181.1Schristos# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 191.1Schristos# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 201.1Schristos# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 211.1Schristos# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 221.1Schristos# THIS SOFTWARE. 231.1Schristos# 241.1Schristos# ****************************************************************/ 251.1Schristos 261.1SchristosCC = cc 271.1SchristosCFLAGS = -g -I.. 281.3SnatCFLAGS+=-I${.CURDIR}/../../arch/${MACHINE_ARCH:S/m68ksf/m68k/}/gdtoa 291.1SchristosL = -lm 301.2SchristosL1 = -lm 311.1Schristos#use "L1=-lm" when compiled with -DHonor_FLTP_ROUNDS or -DUSE_LOCALE 321.1SchristosINFFIX = | sed 's/[Ii][Nn][Ff][intyINTY]*/Infinity/g' 331.1Schristos 341.2Schristos.PATH: /usr/src/lib/libc/gdtoa 351.1Schristos 361.1Schristosall: dt dItest ddtest dtest ftest Qtest xLtest xtest ddtestsi dItestsi tests 371.1Schristos 381.1Schristosdt = dt.o $A 391.1Schristosdt: $(dt) 401.1Schristos $(CC) -o dt $(dt) $L 411.1Schristos 421.2SchristosdItest = dItest.o getround.o g_dfmt.o strtoId.o strtodI.o \ 431.2Schristos g__fmt.o strtoIg.o 441.1SchristosdItest: $(dItest) 451.1Schristos $(CC) -o dItest $(dItest) $(L1) 461.1Schristos 471.2Schristosddtest = ddtest.o getround.o g_dfmt.o strtordd.o strtopdd.o g_ddfmt.o \ 481.2Schristos strtoIdd.o g__fmt.o strtoIg.o 491.1Schristosddtest: $(ddtest) 501.1Schristos $(CC) -o ddtest $(ddtest) $L 511.1Schristos 521.2Schristosdtest = dtest.o getround.o g_dfmt.o strtopd.o strtoId.o \ 531.2Schristos g__fmt.o strtoIg.o 541.1Schristosdtest: $(dtest) 551.1Schristos $(CC) -o dtest $(dtest) $L 561.1Schristos 571.2Schristosftest = ftest.o getround.o strtorf.o strtopf.o g_ffmt.o strtoIf.o \ 581.2Schristos g__fmt.o strtoIg.o 591.1Schristosftest: $(ftest) 601.1Schristos $(CC) -o ftest $(ftest) $(L1) 611.1Schristos 621.2SchristosQtest = Qtest.o getround.o strtorQ.o g_Qfmt.o strtoIQ.o strtopQ.o \ 631.2Schristos g__fmt.o strtoIg.o 641.1SchristosQtest: $(Qtest) 651.1Schristos $(CC) -o Qtest $(Qtest) $(L1) 661.1Schristos 671.2Schristosxtest = xtest.o getround.o strtorx.o g_xfmt.o strtoIx.o \ 681.2Schristos g__fmt.o strtoIg.o 691.1Schristosxtest: $(xtest) 701.1Schristos $(CC) -o xtest $(xtest) $(L1) 711.1Schristos 721.2SchristosxLtest = xLtest.o getround.o strtorxL.o strtopxL.o g_xLfmt.o strtoIxL.o \ 731.2Schristos g__fmt.o strtoIg.o 741.1SchristosxLtest: $(xLtest) 751.1Schristos $(CC) -o xLtest $(xLtest) $(L1) 761.1Schristos 771.2Schristosddtestsi = ddtest.o strtopddSI.o strtorddSI.o strtoIddSI.o getround.o \ 781.2Schristos g_dfmt.o g_ddfmt.o g__fmt.o strtoIg.o 791.1Schristosddtestsi: $(ddtestsi) 801.1Schristos $(CC) -o ddtestsi $(ddtestsi) $L 811.1Schristos 821.2SchristosdItestsi = dItest.o strtodISI.o strtoIdSI.o getround.o \ 831.2Schristos g_dfmt.o g__fmt.o strtoIg.o 841.1SchristosdItestsi: $(dItestsi) 851.1Schristos $(CC) -o dItestsi $(dItestsi) $(L1) 861.1Schristos 871.1Schristosstrtodt = strtodt.o $A 881.1Schristosstrtodt: $(strtodt) 891.1Schristos $(CC) -o strtodt $(strtodt) $L 901.1Schristos 911.1Schristospftest = pftest.o $A 921.2Schristospftest: $(pftest) 931.1Schristos $(CC) -o pftest $(pftest) $L 941.1Schristos 951.1Schristos## On Intel (and Intel-like) systems using extended-precision registers 961.1Schristos## for double-precision (C type double) computations that sometimes suffer 971.1Schristos## double rounding errors, the test below involving strtodt generally shows 981.1Schristos## five lines of unexpected results. Variant strtodtnrp uses ../strtodrnp.c 991.1Schristos## (which does all computations in integer arithmetic) and should show no 1001.1Schristos## unexpected results. 1011.1Schristos 1021.2Schristosstrtodtnrp = strtodt.o strtodnrp.o 1031.1Schristosstrtodtnrp: $(strtodtnrp) 1041.1Schristos $(CC) -o strtodtnrp $(strtodtnrp) 1051.1Schristos 1061.1Schristos# xQtest generates cp commands that depend on sizeof(long double). 1071.1Schristos# See the source for details. If you know better, create Q.out, 1081.1Schristos# x.out and xL.out by copying the relevant *.ou0 or *.ou1 files 1091.1Schristos# to the corresponding .out files. In short, the *.ou0 files are 1101.1Schristos# for long double == double; x.ou1 and xL.ou1 are for 1111.1Schristos# long double == extended (a la 80x87 and MC680x0), and Q.ou1 is 1121.1Schristos# for long double == quad. 1131.1Schristos 1141.1SchristosQ.out x.out xL.out: 1151.1Schristos $(CC) -o xQtest xQtest.c 1161.1Schristos ./xQtest | sh 1171.1Schristos rm -f xQtest xQtest.o 1181.1Schristos 1191.1Schristos## The rmdir below will fail if any test results differ. 1201.1Schristos 1211.1Schristostests: Q.out x.out xL.out dt dItest ddtest dtest ftest Qtest xLtest xtest ddtestsi dItestsi strtodt strtodtnrp 1221.1Schristos mkdir bad 1231.1Schristos cat testnos testnos1 | ./dt $(INFFIX) >zap 2>&1 1241.1Schristos cmp dtst.out zap || mv zap bad/dtst.out 1251.1Schristos ./dItest <testnos $(INFFIX) >zap 2>&1 1261.1Schristos cmp dI.out zap || mv zap bad/dI.out 1271.1Schristos ./dItestsi <testnos $(INFFIX) >zap 2>&1 1281.1Schristos cmp dIsi.out zap || mv zap bad/dIsi.out 1291.1Schristos ./ddtestsi <testnos $(INFFIX) >zap 2>&1 1301.1Schristos cmp ddsi.out zap || mv zap bad/ddsi.out 1311.1Schristos for i in dd d f x xL Q; do cat testnos rtestnos | \ 1321.1Schristos ./"$$i"test $(INFFIX) >zap 2>&1;\ 1331.1Schristos cmp $$i.out zap || mv zap bad/$$i.out; done 1341.1Schristos ./strtodt testnos3 >bad/strtodt.out && rm bad/strtodt.out || \ 1351.1Schristos cat bad/strtodt.out 1361.1Schristos ./strtodtnrp testnos3 >bad/strtodtnrp.out && rm bad/strtodtnrp.out || \ 1371.1Schristos cat bad/strtodtnrp.out 1381.1Schristos rmdir bad 2>/dev/null || \ 1391.1Schristos (cd bad; for i in *; do cmp -s $$i ../obad/$$i && rm $$i;done; cd ..; rmdir bad) 1401.1Schristos touch tests 1411.1Schristos 1421.1Schristos# To test Printf in ../gdtoa.a, "make pf_test" and perhaps "make pf_testLq" 1431.1Schristos# (if both long double and quad are desired and available). 1441.1Schristos 1451.1Schristospf_test: pftest 1461.1Schristos ./pftest <pftestnos >zap 1471.1Schristos cmp pftest.out zap && rm zap 1481.1Schristos 1491.1Schristospf_testLq: pftest 1501.1Schristos ./pftest <pfLqtestnos >zap 1511.1Schristos cmp pftestLq.out zap && rm zap 1521.1Schristos 1531.1Schristosxs0 = README Q.ou0 Q.ou1 Qtest.c d.out dI.out dIsi.out dItest.c dd.out\ 1541.1Schristos ddsi.out ddtest.c dt.c dtest.c dtst.out f.out ftest.c\ 1551.1Schristos getround.c makefile pfLqtestnos pftest.c pftestQ.out\ 1561.1Schristos pftestx.out pftestLq.out pftestnos rtestnos strtoIdSI.c\ 1571.1Schristos strtoIddSI.c strtodISI.c strtodt.c strtopddSI.c strtorddSI.c\ 1581.1Schristos testnos testnos1 testnos3 x.ou0 x.ou1 xL.ou0 xL.ou1 xLtest.c\ 1591.1Schristos xQtest.c xtest.c 1601.1Schristos 1611.1Schristos# invoke "make -r xsum.out" 1621.1Schristosxsum.out: xsum0.out $(xs0) 1631.1Schristos xsum $(xs0) >xsum1.out 1641.1Schristos cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out 1651.1Schristos 1661.1Schristosclean: 1671.1Schristos rm -f *.[ao] dt *test *testsi pftest.out strtodt strtodtnrp xsum.out\ 1681.1Schristos xsum1.out tests zap x.out xL.out Q.out 1691.1Schristos rm -rf bad 170