[comp.os.minix] GCC lib update/Math lib Tos/MinixST shar 5/5

bammi@dsrgsun.ces.cwru.edu (Jwahar R. Bammi) (12/14/88)

#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	pmltests/*
# This archive created: Wed Dec 14 04:43:42 1988
# By:	Jwahar R. Bammi(Case Western Reserve University)
#  Uucp:	 {decvax,sun,att}!cwjcc!dsrgsun!bammi
# Csnet:	 bammi@dsrgsun.ces.CWRU.edu
#  Arpa:	 bammi@dsrgsun.ces.CWRU.edu
#
export PATH; PATH=/bin:$PATH
if test ! -d 'pmltests'
then
	echo shar: creating directory "'pmltests'"
	mkdir 'pmltests'
fi
echo shar: entering directory "'pmltests'"
cd 'pmltests'
echo shar: extracting "'README'" '(677 characters)'
if test -f 'README'
then
	echo shar: over-writing existing file "'README'"
fi
sed 's/^X//' << \SHAR_EOF > 'README'
XThis the test directory for PML (Fred Fish's Portable Math Library)
X
XBefore you make the tests
X	- You must have GCC V1.31
X	- You should have applied all patches to the gcc library
X	  (the ones that came with this distribution, and the one
X	   that came with the gcc V1.31 upgrade).
X	- You should have compiled the library again
X	- You should have made and installed libpml.a in ../src
X
XTo make tests
X	GCC-TOS	: use Makefile.tos
X	GCC-MINIX : use Makefile.minix
XIn both Makefiles adjust CC to suit your environment.
X--
Xusenet: {decvax,sun}!cwjcc!dsrgsun!bammi	jwahar r. bammi
Xcsnet:       bammi@dsrgsun.ces.CWRU.edu
Xarpa:        bammi@dsrgsun.ces.CWRU.edu
XcompuServe:  71515,155
SHAR_EOF
if test 677 -ne "`wc -c 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 677 characters)'
fi
echo shar: extracting "'c2d.dat'" '(401 characters)'
if test -f 'c2d.dat'
then
	echo shar: over-writing existing file "'c2d.dat'"
fi
sed 's/^X//' << \SHAR_EOF > 'c2d.dat'
Xcabs    1.000000000000e00  2.000000000000e00  2.23606798052788e00 
Xcabs    0.000000000000e00  2.000000000000e00  2.00000000000000e00 
Xcabs    1.000000000000e00  0.000000000000e00  1.00000000000000e00 
Xcabs   -2.000000000000e00  2.000000000000e00  2.82842713594437e00 
Xcabs   -1.000000000000e00 -2.000000000000e00  2.23606798052788e00 
Xcabs    1.000000000000e00 -2.000000000000e00  2.23606798052788e00
SHAR_EOF
if test 401 -ne "`wc -c 'c2d.dat'`"
then
	echo shar: error transmitting "'c2d.dat'" '(should have been 401 characters)'
fi
echo shar: extracting "'dd2d.dat'" '(1082 characters)'
if test -f 'dd2d.dat'
then
	echo shar: over-writing existing file "'dd2d.dat'"
fi
sed 's/^X//' << \SHAR_EOF > 'dd2d.dat'
Xatan2  -6.000000000000e-01  -5.000000000000e-01  -2.44685437739309e00
Xatan2    0.000000000000e00  -1.000000000000e00  -1.57079632679490e00
Xatan2    6.000000000000e-01  -5.000000000000e-01  -6.94738276196703e-01
Xatan2    1.000000000000e00    0.000000000000e00    0.00000000000000e00
Xatan2    6.000000000000e-01    5.000000000000e-01    6.94738276196703e-01
Xatan2    0.000000000000e00    1.000000000000e00    1.57079632679490e00
Xatan2  -6.000000000000e-01    5.000000000000e-01    2.44685437739309e00
Xatan2  -1.000000000000e00    0.000000000000e00    -3.14159265358979e00
Xmax    6.0  5.0    6.0
Xmax    0.0  0.0    0.0
Xmax    0.1  0.2    0.2
Xmax    -0.1  -0.2    -0.1
Xmax    -0.1  0.2    0.2
Xmax    0.1  0.2    0.2
Xmax    0.1  -0.2    0.1
Xmax    1e10  1.1e10    1.1e10
Xmax    -1e10  -1.1e10  -1e10
Xmax    1e-10  1.1e-10  1.1e-10
Xmin    6.0  5.0    5.0
Xmin    0.0  0.0    0.0
Xmin    0.1  0.2    0.1
Xmin    -0.1  -0.2    -0.2
Xmin    -0.1  0.2    -0.1
Xmin    0.1  0.2    0.1
Xmin    0.1  -0.2    -0.2
Xmin    1e10  1.1e10    1e10
Xmin    -1e10  -1.1e10  -1.1e10
Xmin    1e-10  1.1e-10  1e-10
SHAR_EOF
if test 1082 -ne "`wc -c 'dd2d.dat'`"
then
	echo shar: error transmitting "'dd2d.dat'" '(should have been 1082 characters)'
fi
echo shar: extracting "'c2c.dat'" '(5354 characters)'
if test -f 'c2c.dat'
then
	echo shar: over-writing existing file "'c2c.dat'"
fi
sed 's/^X//' << \SHAR_EOF > 'c2c.dat'
Xcsin   1.0e00  2.0e00   3.165778547525405883e00  1.959601044654846191e00
Xcsin   0.0e00  2.0e00   0.0e00  3.626860409975051879e00
Xcsin   1.0e00  0.0e00   8.414709866046905517e-01  0.0e00
Xcsin  -2.0e00  2.0e00  -3.420954853296279907e00 -1.509306490421295166e00
Xcsin  -1.0e00 -2.0e00  -3.165778547525405883e00 -1.959601044654846191e00
Xcsin   1.0e00 -2.0e00   3.165778547525405883e00 -1.959601044654846191e00
Xccos   1.0e00  2.0e00   2.032723009586334228e00 -3.051897794008255004e00
Xccos   0.0e00  2.0e00   3.762195706367492675e00  0.0e00
Xccos   1.0e00  0.0e00   5.403023064136505127e-01  0.0e00
Xccos  -2.0e00  2.0e00  -1.565625846385955810e00  3.297894805669784545e00
Xccos  -1.0e00 -2.0e00   2.032723009586334228e00 -3.051897794008255004e00
Xccos   1.0e00 -2.0e00   2.032723009586334228e00  3.051897794008255004e00
Xcexp   1.0e00  2.0e00  -1.131204381585121154e00  2.471726655960083007e00
Xcexp   0.0e00  2.0e00  -4.161468371748924255e-01  9.092974215745925903e-01
Xcexp   1.0e00  0.0e00   2.718281835317611694e00  0.0e00
Xcexp  -2.0e00  2.0e00  -5.631934991106390953e-02  1.230600243434309959e-01
Xcexp  -1.0e00 -2.0e00  -1.530918665230274200e-01 -3.345118276774883270e-01
Xcexp   1.0e00 -2.0e00  -1.131204381585121154e00 -2.471726655960083007e00
Xctanh   1.0e00  2.0e00   1.166736245155334472e00 -2.434581927955150604e-01
Xctanh   0.0e00  2.0e00   0.0e00 -2.185039848089218139e00
Xctanh   1.0e00  0.0e00   7.615941539406776428e-01  0.0e00
Xctanh  -2.0e00  2.0e00  -1.023835599422454834e00 -2.839295566082000732e-02
Xctanh  -1.0e00 -2.0e00  -1.166736245155334472e00  2.434581927955150604e-01
Xctanh   1.0e00 -2.0e00   1.166736245155334472e00  2.434581927955150604e-01
Xctan   1.0e00  2.0e00   3.381283208727836608e-02  1.014793619513511657e00
Xctan   0.0e00  2.0e00   0.0e00  9.640275761485099792e-01
Xctan   1.0e00  0.0e00   1.557407721877098083e00  0.0e00
Xctan  -2.0e00  2.0e00   2.839295566082000732e-02  1.023835599422454834e00
Xctan  -1.0e00 -2.0e00  -3.381283208727836608e-02 -1.014793619513511657e00
Xctan   1.0e00 -2.0e00   3.381283208727836608e-02 -1.014793619513511657e00
Xcsqrt  0.0  0.0  0.000000000000000000e00  0.000000000000000000e00
Xcsqrt  1.0  2.0  1.272019654512405395e00  7.861513718962669372e-01
Xcsqrt  0.0  2.0  1.000000000000000000e00  1.000000000000000000e00
Xcsqrt  1.0  0.0  1.000000000000000000e00  0.000000000000000000e00
Xcsqrt -2.0  2.0  6.435942575335502624e-01  1.553773969411849975e00
Xcsqrt -1.0  2.0  7.861513718962669372e-01  1.272019654512405395e00
Xcsqrt  1.0  2.0  1.272019654512405395e00  7.861513718962669372e-01
Xcsinh   1.0e00  2.0e00  -4.890562593936920166e-01  1.403119236230850219e00
Xcsinh   0.0e00  2.0e00   0.0e00  9.092974215745925903e-01
Xcsinh   1.0e00  0.0e00   1.175201192498207092e00  0.0e00
Xcsinh  -2.0e00  2.0e00   1.509306475520133972e00  3.420954853296279907e00
Xcsinh  -1.0e00 -2.0e00   4.890562593936920166e-01 -1.403119236230850219e00
Xcsinh   1.0e00 -2.0e00  -4.890562593936920166e-01 -1.403119236230850219e00
Xcrcp   1.0e00  2.0e00   1.999999992549419403e-01 -3.999999985098838806e-01
Xcrcp   0.0e00  2.0e00   0.0e00 -5.0e-01
Xcrcp   1.0e00  0.0e00   1.0e00  0.0e00
Xcrcp  -2.0e00  2.0e00  -2.5e-01 -2.5e-01
Xcrcp  -1.0e00 -2.0e00  -1.999999992549419403e-01  3.999999985098838806e-01
Xcrcp   1.0e00 -2.0e00   1.999999992549419403e-01  3.999999985098838806e-01
Xclog   1.0e00  2.0e00   8.047189563512802124e-01  1.107148721814155578e00
Xclog   0.0e00  2.0e00   6.931471824645996093e-01  1.570796325802803039e00
Xclog   1.0e00  0.0e00   0.0e00  0.0e00
Xclog  -2.0e00  2.0e00   1.039720773696899414e00  2.356194496154785156e00
Xclog  -1.0e00 -2.0e00   8.047189563512802124e-01 -2.034443944692611694e00
Xclog   1.0e00 -2.0e00   8.047189563512802124e-01 -1.107148721814155578e00
Xccosh   1.0e00  2.0e0  -6.421481221914291381e-01  1.068607419729232788e00
Xccosh   0.0e00  2.0e00  -4.161468371748924255e-01  0.0e00
Xccosh   1.0e00  0.0e00   1.543080642819404602e00  0.0e00
Xccosh  -2.0e00  2.0e00  -1.565625831484794616e00 -3.297894805669784545e00
Xccosh  -1.0e00 -2.0e00  -6.421481221914291381e-01  1.068607419729232788e00
Xccosh   1.0e00 -2.0e00  -6.421481221914291381e-01 -1.068607419729232788e00
Xcatan   1.0e00  2.0e00   1.338972523808479309e00  4.023594781756401062e-01
Xcatan   0.0e00  2.0e00   1.570796325802803039e00  5.493061468005180358e-01  /* -real part */
Xcatan   1.0e00  0.0e00   7.853981629014015197e-01  0.0e00
Xcatan  -2.0e00  2.0e00  -1.311223268508911132e00  2.388778626918792724e-01
Xcatan  -1.0e00 -2.0e00  -1.338972523808479309e00 -4.023594819009304046e-01
Xcatan   1.0e00 -2.0e00   1.338972523808479309e00 -4.023594819009304046e-01
Xcasin  1.0  2.0  4.270785786211490631e-01  1.528570890426635742e00
Xcasin  0.0  2.0  0.000000000000000000e00  1.443635478615760803e00
Xcasin  1.0  0.0  1.570796325802803039e00  0.000000000000000000e00
Xcasin -2.0  2.0 -7.542491331696510314e-01  1.734324455261230468e00
Xcasin -1.0 -2.0 -4.270785823464393615e-01 -1.528570920228958129e00
Xcasin  1.0 -2.0  4.270785823464393615e-01 -1.528570920228958129e00
Xcacos  1.0  2.0  1.143717750906944274e00 -1.528570920228958129e00
Xcacos  0.0  2.0  1.570796325802803039e00 -1.443635478615760803e00
Xcacos  1.0  0.0  0.000000000000000000e00  0.000000000000000000e00
Xcacos -2.0  2.0  2.325045466423034668e00 -1.734324529767036438e00
Xcacos -1.0 -2.0  1.997874900698661804e00  1.528570890426635742e00
Xcacos  1.0 -2.0  1.143717750906944274e00  1.528570890426635742e00
SHAR_EOF
if test 5354 -ne "`wc -c 'c2c.dat'`"
then
	echo shar: error transmitting "'c2c.dat'" '(should have been 5354 characters)'
fi
echo shar: extracting "'cc2c.dat'" '(3825 characters)'
if test -f 'cc2c.dat'
then
	echo shar: over-writing existing file "'cc2c.dat'"
fi
sed 's/^X//' << \SHAR_EOF > 'cc2c.dat'
Xcadd     1.122999995946884155e00  2.340000003576278686e00 3.560000002384185791e00  4.100000023841857910e00 4.683000028133392334e00  6.440000057220458984e00
Xcadd    -1.345669999718666076e00  2.234566986560821533e00  3.348675012588500976e00 -4.122219979763031005e00  2.003005027770996093e00 -1.887652993202209472e00
Xcadd     3.857562988996505737e-01  1.000030040740966796e-01  3.333939403295516967e00  4.349979996681213378e00  3.719695717096328735e00  4.449983000755310058e00
Xcadd     1.575757563114166259e00  0.000000000000000000e00  3.378574609756469726e00  0.000000000000000000e00  4.954332172870635986e00  0.000000000000000000e00
Xcadd    -1.233999997377395629e00 -2.334455549716949462e00 -3.000000000000000000e00 -4.000000000000000000e00 -4.234000027179718017e00 -6.334455549716949462e00
Xcadd     1.227000000000000000e04  1.300000000000000000e03  0.000000000000000000e00  3.452000021934509277e-02  1.227000000000000000e04  1.300034515380859375e03
Xcdiv     1.122999995946884155e00  2.340000003576278686e00  3.560000002384185791e00  4.100000023841857910e00  4.609979800879955291e-01  1.263787318021059036e-01
Xcdiv    -1.345669999718666076e00  2.234566986560821533e00  3.348675012588500976e00 -4.122219979763031005e00 -4.863302707672119140e-01  6.862613558769226074e-02
Xcdiv      3.857562988996505737e-01  1.000030040740966796e-01  3.333939403295516967e00  4.349979996681213378e00  5.729839205741882324e-02 -4.476501746103167533e-02
Xcdiv     1.575757563114166259e00  0.000000000000000000e00  3.378574609756469726e00  0.000000000000000000e00  4.663971476256847381e-01  0.000000000000000000e00
Xcdiv    -1.233999997377395629e00 -2.334455549716949462e00 -3.000000000000000000e00 -4.000000000000000000e00  5.215928852558135986e-01  8.269466646015644073e-02
Xcdiv     1.227000000000000000e04  1.300000000000000000e03  0.000000000000000000e00  3.452000021934509277e-02  3.765932763671875000e04 -3.554461171875000000e05
Xcmult     1.122999995946884155e00  2.340000003576278686e00  3.560000002384185791e00  4.100000023841857910e00 -5.596120119094848632e00  1.293470001220703125e01
Xcmult    -1.345669999718666076e00  2.234566986560821533e00  3.348675012588500976e00 -4.122219979763031005e00  4.705165147781372070e00  1.302998638153076171e01
Xcmult     3.857562988996505737e-01  1.000030040740966796e-01  3.333939403295516967e00  4.349979996681213378e00  8.510770574212074279e-01  2.011436134576797485e00
Xcmult     1.575757563114166259e00  0.000000000000000000e00  3.378574609756469726e00  0.000000000000000000e00  5.323814511299133300e00  0.000000000000000000e00
Xcmult    -1.233999997377395629e00 -2.334455549716949462e00 -3.000000000000000000e00 -4.000000000000000000e00 -5.635822236537933349e00  1.193936669826507568e01
Xcmult     1.227000000000000000e04  1.300000000000000000e03  0.000000000000000000e00  3.452000021934509277e-02 -4.487600040435791015e01  4.235604019165039062e02
Xcsubt     1.122999995946884155e00  2.340000003576278686e00  3.560000002384185791e00  4.100000023841857910e00 -2.437000006437301635e00 -1.760000020265579223e00
Xcsubt    -1.345669999718666076e00  2.234566986560821533e00  3.348675012588500976e00 -4.122219979763031005e00 -4.694344997406005859e00  6.356786966323852539e00
Xcsubt     3.857562988996505737e-01  1.000030040740966796e-01  3.333939403295516967e00  4.349979996681213378e00 -2.948183119297027587e00 -4.249976992607116699e00
Xcsubt     1.575757563114166259e00  0.000000000000000000e00  3.378574609756469726e00  0.000000000000000000e00 -1.802817046642303466e00  0.000000000000000000e00
Xcsubt    -1.233999997377395629e00 -2.334455549716949462e00 -3.000000000000000000e00 -4.000000000000000000e00  1.766000002622604370e00  1.665544450283050537e00
Xcsubt     1.227000000000000000e04  1.300000000000000000e03  0.000000000000000000e00  3.452000021934509277e-02  1.227000000000000000e04  1.299965484619140625e03
SHAR_EOF
if test 3825 -ne "`wc -c 'cc2c.dat'`"
then
	echo shar: error transmitting "'cc2c.dat'" '(should have been 3825 characters)'
fi
echo shar: extracting "'d2d.dat'" '(8975 characters)'
if test -f 'd2d.dat'
then
	echo shar: over-writing existing file "'d2d.dat'"
fi
sed 's/^X//' << \SHAR_EOF > 'd2d.dat'
Xdabs 1.2345 1.2345
Xdabs -1.2345 1.2345 
Xdabs 1.2345e+20 1.2345e+20 
Xdabs -9.987e+25 9.987e+25 
Xdabs -7.89e-24 7.89e-24 
Xdabs 5.67e-15 5.67e-15
Xexp -40.0 4.248354255291e-18 
Xexp -30.0 9.357622968840e-14 
Xexp -20.0 2.061153622438e-09 
Xexp -10.0 4.539992976248e-05 
Xexp -2.0 1.353352832366e-01 
Xexp -1.0  0.36787944117144232159552377016146087
Xexp -0.25 0.77880078307140486824517026697832065
Xexp 0.0 1.000000000000e00 
Xexp  0.25 1.28402541668774148407342056806243646
Xexp  1.0  2.71828182845904523536028747135266250
Xexp 2.0 7.389056098930e00 
Xexp 10.0 2.202646579480e04 
Xexp 20.0 4.851651954097e08 
Xexp 30.0 1.068647458152e13 
Xexp 40.0 2.353852668370e17 
Xsqrt 0.0 0.0
Xsqrt 4.999999999999999999e-02 2.236067977499789696e-01
Xsqrt 2.500000000000000000e-01 5.000000000000000000e-01
Xsqrt 5.000000000000000000e-01 7.071067811865475243e-01
Xsqrt 1.000000000000000000e00 1.000000000000000000e00
Xsqrt 2.000000000000000000e00 1.414213562373095048e00
Xsqrt 1.000000000000000000e01 3.162277660168379332e00
Xsqrt 3.000000000000000000e01 5.477225575051661134e00
Xsqrt 7.000000000000000000e01 8.366600265340755481e00
Xsqrt 2.000000000000000000e02 1.414213562373095049e01
Xsqrt 1.999999999999999999e32 1.414213562373095048e16
Xsqrt 0.6366197723675813430755350534900574 0.79788456080286535587989211986876373
Xsqrt 3.1415926535897932384626433832795028 1.77245385090551602729816748334114518
Xlog 4.999999999999999999e-02 -2.995732273553990993e00 
Xlog 2.500000000000000000e-01 -1.386294361119890618e00 
Xlog 5.000000000000000000e-01 -6.931471805599453094e-01 
Xlog 1.000000000000000000e00 0.000000000000000000e00 
Xlog 2.0 0.69314718055994530941723212145817657
Xlog 4.0 1.38629436111989061883446424291635313
Xlog 10.0 2.30258509299404568401799145468436421
Xlog 1.000000000000000000e01 2.302585092994045684e00 
Xlog 3.000000000000000000e01 3.401197381662155375e00 
Xlog 5.000000000000000000e01 3.912023005428146058e00 
Xlog 2.000000000000000000e02 5.298317366548036677e00 
Xlog 1.999999999999999999e32 7.437587015636940721e01 
Xatanh -9.999899999999999999e-01 -6.103033822758835533e00 
Xatanh -5.000000000000000000e-01 -5.493061443340548457e-01 
Xatanh -2.500000000000000000e-01 -2.554128118829953416e-01 
Xatanh 0.000000000000000000e00 0.000000000000000000e00 
Xatanh 2.500000000000000000e-01 2.554128118829953415e-01 
Xatanh 5.000000000000000000e-01 5.493061443340548457e-01 
Xatanh 9.999899999999999999e-01 6.103033822758835533e00
Xsinh -8.000000000000000000e01 -2.770311192196755026e34 
Xsinh -1.000000000000000000e01 -1.101323287470339337e04 
Xsinh -5.000000000000000000e-01 -5.210953054937473615e-01 
Xsinh 0.000000000000000000e00 0.000000000000000000e00 
Xsinh 1.500000000000000000e00 2.129279455094817497e00 
Xsinh 1.000000000000000000e01 1.101323287470339337e04 
Xsinh 8.000000000000000000e01 2.770311192196755026e34
Xcosh -8.000000000000000000e01 2.770311192196755026e34 
Xcosh -1.000000000000000000e01 1.101323292010332313e04 
Xcosh -5.000000000000000000e-01 1.127625965206380785e00 
Xcosh 0.000000000000000000e00 1.000000000000000000e00 
Xcosh 1.500000000000000000e00 2.352409615243247325e00 
Xcosh 1.000000000000000000e01 1.101323292010332313e04 
Xcosh 8.000000000000000000e01 2.770311192196755026e34
Xtanh -8.000000000000000000e01 -1.000000000000000000e00 
Xtanh -1.000000000000000000e01 -9.999999958776927635e-01 
Xtanh -5.000000000000000000e-01 -4.621171572600097586e-01 
Xtanh 0.000000000000000000e00 0.000000000000000000e00 
Xtanh 1.500000000000000000e00 9.051482536448664383e-01 
Xtanh 1.000000000000000000e01 9.999999958776927635e-01 
Xtanh 8.000000000000000000e01 1.000000000000000000e00
Xsin 5.00e-11 5.000000000000000000e-11 
Xsin 0.0 0.0 
Xsin 0.25 0.24740395925452292959684870484938920
Xsin 0.5 0.47942553860420300027328793521557139
Xsin 0.78539816339744830961556084581987572 0.70710678118654752440084436210484903
Xsin -0.7853981633974483096155608458198757 -0.7071067811865475244008443621048490
Xsin 1.0 0.84147098480789650665250232163029900
Xsin 2.00e00 9.092974268256816953e-01 
Xsin 2.50e00 5.984721441039564939e-01 
Xsin 3.50e00 -3.507832276896198480e-01 
Xsin 4.00e00 -7.568024953079282514e-01 
Xsin 5.00e00 -9.589242746631384689e-01 
Xsin 6.00e00 -2.794154981989258727e-01 
Xsin 7.50e00 9.379999767747388579e-01 
Xsin 8.00e00 9.893582466233817778e-01 
Xsin 9.00e00 4.121184852417565697e-01 
Xsin 9.50e00 -7.515112046180930728e-02 
Xsin -5.00e-01 -4.794255386042030000e-01 
Xsin -1.00e00 -8.414709848078965066e-01 
Xsin -2.00e00 -9.092974268256816953e-01 
Xsin -2.50e00 -5.984721441039564939e-01 
Xsin -3.50e00 3.507832276896198480e-01 
Xsin -4.00e00 7.568024953079282514e-01 
Xsin -5.00e00 9.589242746631384689e-01 
Xsin -5.50e00 7.055403255703919063e-01 
Xsin -6.50e00 -2.151199880878155242e-01 
Xsin -7.50e00 -9.379999767747388579e-01 
Xsin -8.00e00 -9.893582466233817778e-01 
Xsin -9.00e00 -4.121184852417565697e-01 
Xsin -9.50e00 7.515112046180930728e-02 
Xcos 5.00e-11 9.999999999999999997e-01 
Xcos 0.00e00 9.999999999999999997e-01 
Xcos 5.00e-01 8.77582561890372716e-01 
Xcos 1.00e00 5.403023058681397173e-01 
Xcos 2.00e00 -4.161468365471423870e-01 
Xcos 2.50e00 -8.011436155469337148e-01 
Xcos 3.50e00 -9.364566872907963376e-01 
Xcos 4.00e00 -6.536436208636119144e-01 
Xcos 5.00e00 2.836621854632262644e-01 
Xcos 5.50e00 7.086697742912599999e-01 
Xcos 6.50e00 9.765876257280234999e-01 
Xcos 7.50e00 3.466353178350258109e-01 
Xcos 8.00e00 -1.455000338086135258e-01 
Xcos 9.00e00 -9.111302618846769882e-01 
Xcos 9.50e00 -9.971721561963784728e-01 
Xcos -5.00e-01 8.775825618903727160e-01 
Xcos -1.00e00 5.403023058681397173e-01 
Xcos -2.00e00 -4.161468365471423870e-01 
Xcos -2.50e00 -8.011436155469337148e-01 
Xcos -3.50e00 -9.364566872907963376e-01 
Xcos -4.00e00 -6.536436208636119144e-01 
Xcos -5.00e00 2.836621854632262644e-01 
Xcos -6.00e00 9.601702866503660205e-01 
Xcos -6.50e00 9.765876257280234999e-01 
Xcos -7.50e00 3.466353178350258109e-01
Xcos -8.00e00 -1.455000338086135258e-01 
Xcos -9.00e00 -9.111302618846769882e-01 
Xcos -9.50e00 -9.971721561963784728e-01 
Xtan -2.000000000000000000e00 2.185039863261518991e00 
Xtan -1.000000000000000000e00 -1.557407724654902230e00 
Xtan -5.000000000000000000e-01 -5.463024898437905132e-01 
Xtan 0.000000000000000000e00 0.000000000000000000e00 
Xtan 0.39269908169872415480783042290993786 0.41421356237309504880168872420969807
Xtan 0.25 0.25534192122103626650448223649047368
Xtan 0.5 0.54630248984379051325517946578028538
Xtan 0.78539816339744830961556084581987572 1.0
Xtan -0.78539816339744830961556084581987572 -1.0
Xtan 1.0 1.55740772465490223050697480745836017
Xtan 2.000000000000000000e00 -2.185039863261518991e00
Xlog10 1.00e-10 -1.000000000000000000e01 
Xlog10 1.00e-05 -5.000000000000000000e00 
Xlog10 5.00e-01 -3.010299956639811952e-01 
Xlog10 1.00e00 0.000000000000000000e00 
Xlog10 1.50e00 1.760912590556812420e-01 
Xlog10 2.0 0.30102999566398119521373889472449303
Xlog10 2.71828182845904523536028747135266250 0.43429448190325182765112891891660508
Xlog10 1.00e05 5.000000000000000000e00 
Xlog10 1.00e20 2.000000000000000000e01
Xatan 0.000000000000e00 0.000000000000e00 
Xatan 4.999999999999e-02 4.995839572194e-02 
Xatan 2.500000000000e-01 2.449786631268e-01 
Xatan 3.500000000000e-01 3.366748193867e-01 
Xatan 7.000000000000e-01 6.107259643892e-01 
Xatan 1.000000000000e00 7.85398163397e-01 
Xatan 2.000000000000e00 1.10714871779e00 
Xatan 1.400000000000e01 1.49948886200e00 
Xatan 3.000000000000e01 1.53747533091e00 
Xatan 5.000000000000e01 1.55079899282e00 
Xatan 7.000000000000e01 1.55651158420e00 
Xatan 9.000000000000e01 1.55968567289e00 
Xatan 2.000000000000e02 1.56579636846e00
Xasinh -8.000000000000000000e01 -5.075212875445203927e00 
Xasinh -1.000000000000000000e01 -2.998222950297969704e00 
Xasinh -5.000000000000000000e-01 -4.812118250596034474e-01 
Xasinh 0.000000000000000000e00 0.000000000000000000e00 
Xasinh 1.500000000000000000e00 1.194763217287109304e00 
Xasinh 1.000000000000000000e01 2.998222950297969738e00 
Xasinh 8.000000000000000000e01 5.075212875445207223e00 
Xasin -1.000000000000000000e00 -1.570796326794896619e00 
Xasin -7.000000000000000000e-01 -7.753974966107530636e-01 
Xasin -1.999999999999999999e-01 -2.013579207903307914e-01 
Xasin 0.000000000000000000e00 0.000000000000000000e00 
Xasin 1.999999999999999999e-01 2.013579207903307914e-01 
Xasin 7.000000000000000000e-01 7.753974966107530636e-01 
Xasin 1.000000000000000000e00 1.570796326794896619e00
Xacosh 1.000000000000000000e00 0.000000000000000000e00 
Xacosh 2.000000000000000000e00 1.316957896924816708e00 
Xacosh 1.000000000000000000e01 2.993222846126380897e00 
Xacosh 2.000000000000000000e02 5.991458297049387423e00 
Xacosh 1.000000000000000000e03 7.600902209541988611e00 
Xacosh 1.000000000000000000e05 1.220607264550517372e01 
Xacosh 1.000000000000000000e18 4.213967885445276762e01
Xacos -1.000000000000000000e00 3.141592653589793238e00 
Xacos -7.000000000000000000e-01 2.346193823405649682e00 
Xacos -1.999999999999999999e-01 1.772154247585227410e00 
Xacos 0.000000000000000000e00 1.570796326794896619e00 
Xacos 1.999999999999999999e-01 1.369438406004565827e00 
Xacos 7.000000000000000000e-01 7.953988301841435554e-01 
Xacos 1.000000000000000000e00 0.000000000000000000e00 
SHAR_EOF
if test 8975 -ne "`wc -c 'd2d.dat'`"
then
	echo shar: error transmitting "'d2d.dat'" '(should have been 8975 characters)'
fi
echo shar: extracting "'c2d.c'" '(10044 characters)'
if test -f 'c2d.c'
then
	echo shar: over-writing existing file "'c2d.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'c2d.c'
X/************************************************************************
X *									*
X *				N O T I C E				*
X *									*
X *			Copyright Abandoned, 1987, Fred Fish		*
X *									*
X *	This previously copyrighted work has been placed into the	*
X *	public domain by the author (Fred Fish) and may be freely used	*
X *	for any purpose, private or commercial.  I would appreciate	*
X *	it, as a courtesy, if this notice is left in all copies and	*
X *	derivative works.  Thank you, and enjoy...			*
X *									*
X *	The author makes no warranty of any kind with respect to this	*
X *	product and explicitly disclaims any implied warranties of	*
X *	merchantability or fitness for any particular purpose.		*
X *									*
X ************************************************************************
X */
X
X/*
X *  FILE
X *
X *	c2d.c   test complex to double math functions
X *
X *  KEY WORDS
X *
X *	portable math library
X *	test functions
X *
X *  DESCRIPTION
X *
X *	Tests double precision functions for the Portable Math
X *	Library.  Tests those functions which expect a single
X *	double precision complex argument and return a double.
X *
X *	Most of the test data in the current data file (c2d.dat)
X *	was generated using double precision FORTRAN arithmetic
X *	on a Decsystem-20.
X *
X *	Note that the ordering of functions is important for
X *	optimum error information.  Since some functions call
X *	others in the library, the functions being called should
X *	be tested first.  Naturally, an error in a lower level
X *	function will cause propagation of errors up to higher
X *	level functions.
X *
X *  USAGE
X *
X *	c2d [-esv] [-l limit]
X *
X *		-e	=>	force error for each test
X *				to verify error handling
X *
X *		-l	=>	report errors greater than
X *				specified limit (default 10**-6)
X *
X *		-s	=>	print summary after tests
X *
X *		-v	=>	print each function, argument,
X *				and result
X *
X *	Test directives are read from the standard input, which
X *	may be redirected to the provided test file (c2d.dat),
X *	and any relative errors are automatically written to standard
X *	output if they exceed a maximum allowable limit.
X *	Each test directive has the form:
X *
X *		<name> <real(arg)> <imag(arg)> <expected result>
X *
X *	Each field is separated by a one or more space character(s).
X *	The first field, "name", is the name of the function
X *	to test. The second field is the real part of the argument.
X *	The third field is the imaginary part of the argument.
X *	The last field is the expected result.
X *		
X *  PROGRAMMER
X *
X *	Fred Fish
X *	Tempe, Az 85281
X *
X */
X
X
X#include <stdio.h>
X#include <pmluser.h>
X
X#include "pml.h"
X
X#define MAX_ABS_ERR 1.0e-6	/* Set to catch only gross errors */
X
Xstatic int vflag;		/* Flag for verbose option */
Xstatic int eflag;		/* Simulate an error to error printout */
Xstatic int sflag;		/* Flag to show final statistics */
X
Xstatic double max_abs_err = MAX_ABS_ERR;
X
Xextern double cabs ();		/* Complex absolute value */
X
X
X/*
X *	Define all recognized test functions.  Each function
X *	must have an entry in this table, where each
X *	entry contains the information specified in the 
X *	structure "test".
X *
X */
X
Xstruct test {			/* Structure of each function to be tested */
X    char *name;			/* Name of the function to test */
X    double (*func)();		/* Pointer to the function's entry point */
X    double max_err;		/* Error accumulator for this function */
X};
X
Xstatic struct test tests[] = {	/* Table of all recognized functions */
X    "cabs", cabs, 0.0,		/* Complex magnitude */
X    NULL, NULL, 0.0		/* Function list end marker */
X};
X
X
X/*
X *  FUNCTION
X *
X *	main   entry point for c2d test utility
X *
X *  PSEUDO CODE
X *
X *	Begin main
X *	    Process any options in command line.
X *	    Do all tests requested by stdin directives.
X *	    Report final statistics (if enabled).
X *	End main
X *
X */
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    ENTER ("main");
X    DEBUGWHO (argv[0]);
X    options (argc, argv);
X    dotests (argv);
X    statistics ();
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	dotests   process each test from stdin directives
X *
X *  ERROR REPORTING
X *
X *	Note that in most cases, the error criterion is based
X *	on relative error, defined as:
X *
X *	    error = (result - expected) / expected
X *
X *	Naturally, if the expected result is zero, some
X *	other criterion must be used.  In this case, the
X *	absolute error is used.  That is:
X *
X *	    error = result
X *
X *  PSEUDO CODE
X *
X *	Begin dotests
X *	    While a test directive is successfully read from stdin
X *		Default function name to "{null}"
X *		Default real part of argument to 0.0
X *		Default imaginary part of argument to 0.0
X *		Default expected result to 0.0
X *		Extract function name, argument and expected result
X *		Lookup test in available test list
X *		If no test was found then
X *		    Tell user that unknown function was specified
X *		Else
X *		    Call function with argument and save result
X *		    If the verify flag is set then
X *			Print function name, argument, and result
X *		    End if
X *		    If the expected result is not zero then
X *			Compute the relative error
X *		    Else
X *			Use the absolute error
X *		    End if
X *		    Get absolute value of error
X *		    If error exceeds limit or error force flag set
X *			Print error notification on stderr
X *		    End if
X *		    If this error is max for given function then
X *			Remember this error for summary
X *		    End if
X *		End if
X *	    End while
X *	End dotests
X *
X */
X
X
Xdotests (argv)
Xchar *argv[];
X{
X    char buffer[256];		/* Directive buffer */
X    char function[64];		/* Specified function name */
X    COMPLEX argument;		/* Specified function argument */
X    double expected;		/* Specified expected result */
X    double result;		/* Actual result */
X    double error;		/* Relative or absolute error */
X    double abs_err;		/* Absolute value of error */
X    struct test *testp;		/* Pointer to function test */
X    struct test *lookup ();	/* Returns function test pointer */
X    register char *strp;	/* Pointer to next token in string */
X    extern char *strtok ();
X    extern double atof ();
X
X    ENTER ("dotests");
X    while (fgets (buffer, sizeof(buffer), stdin) != NULL) {
X	strcpy (function, "{null}");
X	argument.real = 0.0;
X	argument.imag = 0.0;
X	expected = 0.0;
X	sscanf (buffer, "%s %le %le %le",
X	function, &argument.real, &argument.imag, &expected);
X        testp = lookup (function);
X        if (testp == NULL) {
X            fprintf (stderr, "%s: unknown function \"%s\".\n",
X	    	argv[0], function);
X        } else {
X	    result = (*testp -> func)(argument);
X	    if (vflag) {
X	        printf ("%s(%le + j %le) = %30.23le.\n",
X		function, argument.real, argument.imag, result);
X	    }
X	    if (expected != 0.0) {
X	        error = (result - expected) / expected;
X	    } else {
X	        error = result;
X	    }
X	    if (error < 0.0) {
X		abs_err = -error;
X	    } else {
X		abs_err = error;
X	    }
X            if ((abs_err > max_abs_err) || eflag) {
X		fprintf (stderr, "%s: error in \"%s\"\n", argv[0], function);
X		fprintf (stderr, "\treal (arg)\t%25.20le\n", argument.real);
X		fprintf (stderr, "\timag (arg)\t%25.20le\n", argument.imag);
X		fprintf (stderr, "\tresult\t\t%25.20le\n", result);
X		fprintf (stderr, "\texpected\t%25.20le\n", expected);
X            }
X	    if (abs_err > testp -> max_err) {
X	        testp -> max_err = abs_err;
X	    }
X        }
X    }
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	options   process command line options
X *
X *  PSEUDO CODE
X *
X *	Begin options
X *	    Reset all flags to FALSE by default
X *	    Initialize flag argument scan pointer
X *	    If there is a second command line argument then
X *		If the argument specifies flags then
X *		    While there is an unprocessed flag
X *			Switch on flag
X *			Case "force error flag":
X *			    Set the "force error" flag
X *			    Break switch
X *			Case "print summary":
X *			    Set "print summary" flag
X *			    Break switch
X *			Case "verbose":
X *			    Set "verbose" flag
X *			    Break switch
X *			Default:
X *			    Tell user unknown flag
X *			    Break switch
X *			End switch
X *		    End while
X *		End if
X *	    End if
X *	End options
X *
X */
X
X
Xoptions (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    register int flag;
X    extern int getopt ();
X    extern char *optarg;
X
X    ENTER ("options");
X    eflag = sflag = vflag = FALSE;
X    while ((flag = getopt (argc, argv, "#:el:sv")) != EOF) {
X	switch (flag) {
X	    case '#':
X	        DEBUGPUSH (optarg);
X		break;
X	    case 'e':
X		eflag = TRUE;
X		break;
X	    case 'l':
X	        sscanf (optarg, "%le", &max_abs_err);
X		DEBUG3 ("args", "max_abs_err = %le", max_abs_err);
X		break;
X	    case 's':
X		sflag = TRUE;
X		break;
X	    case 'v':
X		vflag = TRUE;
X		break;
X	}
X    }
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	loopup   lookup test in known test list
X *
X *  DESCRIPTION
X *
X *	Given the name of a desired test, looks up the test
X *	in the known test list and returns a pointer to the
X *	test structure.
X *
X *	Since the table is so small we simply use a linear
X *	search.
X *
X *  PSEUDO CODE
X *
X *	Begin lookup
X *	    For each known test
X *		If the test's name matches the desired test name
X *		    Return pointer to the test structure
X *		End if
X *	    End for
X *	End lookup
X *
X */
X
Xstruct test *lookup (funcname)
Xchar *funcname;
X{
X    struct test *testp;
X    struct test *rtnval;
X
X    ENTER ("lookup");
X    rtnval = (struct test *) NULL;
X    for (testp = tests; testp -> name != NULL && rtnval == NULL; testp++) {
X	if (!strcmp (testp -> name, funcname)) {
X	    rtnval = testp;
X 	}
X    }
X    LEAVE ();
X    return (rtnval);
X}
X
X
X/*
X *  FUNCTION
X *
X *	statistics   print final statistics if desired
X *
X *  PSEUDO CODE
X *
X *	Begin statistics
X *	    If a final statistics (summary) is desired then
X *		For each test in the known test list
X *		    Print the maximum error encountered
X *		End for
X *	    End if
X *	End statistics
X *
X */
X
Xstatistics ()
X{
X    struct test *tp;
X
X    ENTER ("statistics");
X    if (sflag) {
X        for (tp = tests; tp -> name != NULL; tp++) {
X	    printf ("%s:\tmaximum relative error %le\n", 
X	    	tp -> name, tp -> max_err);
X	}
X    }
X    LEAVE ();
X}
SHAR_EOF
if test 10044 -ne "`wc -c 'c2d.c'`"
then
	echo shar: error transmitting "'c2d.c'" '(should have been 10044 characters)'
fi
echo shar: extracting "'d2d.c'" '(11125 characters)'
if test -f 'd2d.c'
then
	echo shar: over-writing existing file "'d2d.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'd2d.c'
X/************************************************************************
X *									*
X *				N O T I C E				*
X *									*
X *			Copyright Abandoned, 1987, Fred Fish		*
X *									*
X *	This previously copyrighted work has been placed into the	*
X *	public domain by the author (Fred Fish) and may be freely used	*
X *	for any purpose, private or commercial.  I would appreciate	*
X *	it, as a courtesy, if this notice is left in all copies and	*
X *	derivative works.  Thank you, and enjoy...			*
X *									*
X *	The author makes no warranty of any kind with respect to this	*
X *	product and explicitly disclaims any implied warranties of	*
X *	merchantability or fitness for any particular purpose.		*
X *									*
X ************************************************************************
X */
X
X
X/*
X *  FILE
X *
X *	d2d.c   test double to double math functions
X *
X *  KEY WORDS
X *
X *	portable math library
X *	test functions
X *
X *  DESCRIPTION
X *
X *	Tests double precision functions for the Portable Math
X *	Library.  Tests those functions which expect a single
X *	double precision argument and return a double.
X *
X *	Most of the test data in the current data file (d2d.dat)
X *	was generated using double precision FORTRAN arithmetic
X *	on a Decsystem-20.
X *
X *	Note that the ordering of functions is important for
X *	optimum error information.  Since some functions call
X *	others in the library, the functions being called should
X *	be tested first.  Naturally, an error in a lower level
X *	function will cause propagation of errors up to higher
X *	level functions.
X *
X *  USAGE
X *
X *	d2d [-esv] [-l limit]
X *
X *		-e	=>	force error for each test
X *				to verify error handling
X *
X *		-l	=>	report errors greater than
X *				specified limit (default 10**-6)
X *
X *		-s	=>	print summary after tests
X *
X *		-v	=>	print each function, argument,
X *				and result
X *
X *	Test directives are read from the standard input, which
X *	may be redirected to the provided test file (d2d.dat),
X *	and any relative errors are automatically written to standard
X *	output if they exceed a maximum allowable limit.
X *	Each test directive has the form:
X *
X *		<name> <argument> <expected result>
X *
X *	Each field is separated by a one or more space character(s).
X *	The first field, "name", is the name of the function
X *	to test (sqrt, ln, exp, etc).  The second field
X *	is the argument to use in calling the specified function.
X *	The third field is the expected result.
X *		
X *  PROGRAMMER
X *
X *	Fred Fish
X *
X */
X
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X#define MAX_ABS_ERR 1.0e-6	/* Set to catch only gross errors */
X
Xstatic int vflag;		/* Flag for verbose option */
Xstatic int eflag;		/* Simulate an error to error printout */
Xstatic int sflag;		/* Flag to show final statistics */
X
Xstatic double max_abs_err = MAX_ABS_ERR;
X
Xextern double dabs ();
Xextern double acos ();
Xextern double acosh ();
Xextern double asin ();
Xextern double asinh ();
Xextern double atan ();
Xextern double atanh ();
Xextern double cos ();
Xextern double cosh ();
Xextern double exp ();
Xextern double log ();
Xextern double log10 ();
Xextern double sin ();
Xextern double sinh ();
Xextern double sqrt ();
Xextern double tan ();
Xextern double tanh ();
X
X
X
X/*
X *	Define all recognized test functions.  Each function
X *	must have an entry in this table, where each
X *	entry contains the information specified in the 
X *	structure "test".
X *
X */
X
Xstruct test {			/* Structure of each function to be tested */
X    char *name;			/* Name of the function to test */
X    double (*func)();		/* Pointer to the function's entry point */
X    double max_err;		/* Error accumulator for this function */
X};
X
Xstatic struct test tests[] = {	/* Table of all recognized functions */
X    "dabs", dabs, 0.0,		/* Absolute value */
X    "acos", acos, 0.0,		/* Arc cosine (in radians) */
X    "acosh", acosh, 0.0,	/* Hyperbolic arc cosine (in radians) */
X    "asin", asin, 0.0,		/* Arc sine (in radians) */
X    "asinh", asinh, 0.0,	/* Hyperbolic arc sine (in radians) */
X    "atan", atan, 0.0,		/* Arc tangent (in radians) */
X    "atanh", atanh, 0.0,	/* Hyperbolic arc tangent (in radians) */
X    "cos", cos, 0.0,		/* Cosine (argument in radians) */
X    "cosh", cosh, 0.0,		/* Hyperbolic cosine (argument in radians) */
X    "exp", exp, 0.0,		/* Exponential */
X    "log", log, 0.0,		/* Natural logarithm */
X    "log10", log10, 0.0,	/* Log to base 10 */
X    "sin", sin, 0.0,		/* Sine (argument in radians) */
X    "sinh", sinh, 0.0,		/* Hyperbolic sine (argument in radians) */
X    "sqrt", sqrt, 0.0,		/* Garden variety square root */
X    "tan", tan, 0.0,		/* Tangent (argument in radians) */
X    "tanh", tanh, 0.0,		/* Hyperbolic tangent (argument in radians) */
X    NULL, NULL, 0.0		/* Function list end marker */
X};
X
X
X/*
X *  FUNCTION
X *
X *	main   entry point for d2d test utility
X *
X *  PSEUDO CODE
X *
X *	Begin main
X *	    Process any options in command line.
X *	    Do all tests requested by stdin directives.
X *	    Report final statistics (if enabled).
X *	End main
X *
X */
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    VOID dotests ();
X    
X    DBUG_ENTER ("main");
X    DBUG_PROCESS (argv[0]);
X    options (argc, argv);
X    dotests (argv);
X    statistics ();
X    DBUG_RETURN (0);
X}
X
X
X/*
X *  FUNCTION
X *
X *	dotests   process each test from stdin directives
X *
X *  ERROR REPORTING
X *
X *	Note that in most cases, the error criterion is based
X *	on relative error, defined as:
X *
X *	    error = (result - expected) / expected
X *
X *	Naturally, if the expected result is zero, some
X *	other criterion must be used.  In this case, the
X *	absolute error is used.  That is:
X *
X *	    error = result
X *
X *  PSEUDO CODE
X *
X *	Begin dotests
X *	    While a test directive is successfully read from stdin
X *		Default function name to "{null}"
X *		Default argument to 0.0
X *		Default expected result to 0.0
X *		Extract function name, argument and expected result
X *		Lookup test in available test list
X *		If no test was found then
X *		    Tell user that unknown function was specified
X *		Else
X *		    Call function with argument and save result
X *		    If the verify flag is set then
X *			Print function name, argument, and result
X *		    End if
X *		    If the expected result is not zero then
X *			Compute the relative error
X *		    Else
X *			Use the absolute error
X *		    End if
X *		    Get absolute value of error
X *		    If error exceeds limit or error force flag set
X *			Print error notification on stderr
X *		    End if
X *		    If this error is max for given function then
X *			Remember this error for summary
X *		    End if
X *		End if
X *	    End while
X *	End dotests
X *
X */
X
X
XVOID dotests (argv)
Xchar *argv[];
X{
X    char buffer[256];		/* Directive buffer */
X    char function[64];		/* Specified function name */
X    double argument;		/* Specified function argument */
X    double expected;		/* Specified expected result */
X    double result;		/* Actual result */
X    double error;		/* Relative or absolute error */
X    double abs_err;		/* Absolute value of error */
X    struct test *testp;		/* Pointer to function test */
X    struct test *lookup ();	/* Returns function test pointer */
X    register char *strp;	/* Pointer to next token in string */
X    extern char *strtok ();
X    extern double atof ();
X
X    DBUG_ENTER ("dotests");
X    while (fgets (buffer, sizeof(buffer), stdin) != NULL) {
X	strcpy (function, "{null}");
X	argument = 0.0;
X	expected = 0.0;
X	sscanf (buffer, "%s %le %le", function, &argument, &expected);
X        testp = lookup (function);
X        if (testp == NULL) {
X            fprintf (stderr, "%s: unknown function \"%s\".\n",
X	    	argv[0], function);
X        } else {
X	    result = (*testp -> func)(argument);
X	    if (vflag) {
X	        printf ("%s(%le) = %30.23le.\n", function, argument, result);
X	    }
X	    if (expected != 0.0) {
X	        error = (result - expected) / expected;
X	    } else {
X	        error = result;
X	    }
X	    if (error < 0.0) {
X		abs_err = -error;
X	    } else {
X		abs_err = error;
X	    }
X            if ((abs_err > max_abs_err) || eflag) {
X		fprintf (stderr, "%s: error in \"%s\"\n", argv[0], function);
X		fprintf (stderr, "\targument\t%25.20le\n", argument);
X		fprintf (stderr, "\tresult\t\t%25.20le\n", result);
X		fprintf (stderr, "\texpected\t%25.20le\n", expected);
X            }
X	    if (abs_err > testp -> max_err) {
X	        testp -> max_err = abs_err;
X	    }
X        }
X    }
X    DBUG_VOID_RETURN;
X}
X
X
X/*
X *  FUNCTION
X *
X *	options   process command line options
X *
X *  PSEUDO CODE
X *
X *	Begin options
X *	    Reset all flags to FALSE by default
X *	    Initialize flag argument scan pointer
X *	    If there is a second command line argument then
X *		If the argument specifies flags then
X *		    While there is an unprocessed flag
X *			Switch on flag
X *			Case "force error flag":
X *			    Set the "force error" flag
X *			    Break switch
X *			Case "print summary":
X *			    Set "print summary" flag
X *			    Break switch
X *			Case "verbose":
X *			    Set "verbose" flag
X *			    Break switch
X *			Default:
X *			    Tell user unknown flag
X *			    Break switch
X *			End switch
X *		    End while
X *		End if
X *	    End if
X *	End options
X *
X */
X
X
Xoptions (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    register int flag;
X    extern int getopt ();
X    extern char *optarg;
X
X    DBUG_ENTER ("options");
X    eflag = sflag = vflag = FALSE;
X    while ((flag = getopt (argc, argv, "#:el:sv")) != EOF) {
X	switch (flag) {
X	    case '#':
X	        DBUG_PUSH (optarg);
X		break;
X	    case 'e':
X		eflag = TRUE;
X		break;
X	    case 'l':
X	        sscanf (optarg, "%le", &max_abs_err);
X		DBUG_3 ("args", "max_abs_err = %le", max_abs_err);
X		break;
X	    case 's':
X		sflag = TRUE;
X		break;
X	    case 'v':
X		vflag = TRUE;
X		break;
X	}
X    }
X    DBUG_VOID_RETURN;
X}
X
X
X/*
X *  FUNCTION
X *
X *	loopup   lookup test in known test list
X *
X *  DESCRIPTION
X *
X *	Given the name of a desired test, looks up the test
X *	in the known test list and returns a pointer to the
X *	test structure.
X *
X *	Since the table is so small we simply use a linear
X *	search.
X *
X *  PSEUDO CODE
X *
X *	Begin lookup
X *	    For each known test
X *		If the test's name matches the desired test name
X *		    Return pointer to the test structure
X *		End if
X *	    End for
X *	End lookup
X *
X */
X
Xstruct test *lookup (funcname)
Xchar *funcname;
X{
X    struct test *testp;
X    struct test *rtnval;
X
X    DBUG_ENTER ("lookup");
X    rtnval = (struct test *) NULL;
X    for (testp = tests; testp -> name != NULL && rtnval == NULL; testp++) {
X	if (!strcmp (testp -> name, funcname)) {
X	    rtnval = testp;
X 	}
X    }
X    DBUG_RETURN (rtnval);
X}
X
X
X/*
X *  FUNCTION
X *
X *	statistics   print final statistics if desired
X *
X *  PSEUDO CODE
X *
X *	Begin statistics
X *	    If a final statistics (summary) is desired then
X *		For each test in the known test list
X *		    Print the maximum error encountered
X *		End for
X *	    End if
X *	End statistics
X *
X */
X
Xstatistics ()
X{
X    struct test *tp;
X
X    DBUG_ENTER ("statistics");
X    if (sflag) {
X        for (tp = tests; tp -> name != NULL; tp++) {
X	    printf ("%s:\tmaximum relative error %le\n", 
X	    	tp -> name, tp -> max_err);
X	}
X    }
X    DBUG_VOID_RETURN;
X}
SHAR_EOF
if test 11125 -ne "`wc -c 'd2d.c'`"
then
	echo shar: error transmitting "'d2d.c'" '(should have been 11125 characters)'
fi
echo shar: extracting "'dd2d.c'" '(9819 characters)'
if test -f 'dd2d.c'
then
	echo shar: over-writing existing file "'dd2d.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'dd2d.c'
X/************************************************************************
X *									*
X *				N O T I C E				*
X *									*
X *			Copyright Abandoned, 1987, Fred Fish		*
X *									*
X *	This previously copyrighted work has been placed into the	*
X *	public domain by the author (Fred Fish) and may be freely used	*
X *	for any purpose, private or commercial.  I would appreciate	*
X *	it, as a courtesy, if this notice is left in all copies and	*
X *	derivative works.  Thank you, and enjoy...			*
X *									*
X *	The author makes no warranty of any kind with respect to this	*
X *	product and explicitly disclaims any implied warranties of	*
X *	merchantability or fitness for any particular purpose.		*
X *									*
X ************************************************************************
X */
X
X/*
X *  FILE
X *
X *	dd2d.c   test dual double to double math functions
X *
X *  KEY WORDS
X *
X *	portable math library
X *	test functions
X *
X *  DESCRIPTION
X *
X *	Tests double precision functions for the Portable Math
X *	Library.  Tests those functions which expect two
X *	double precision arguments and return a double.
X *
X *	Most of the test data in the current data file (dd2d.dat)
X *	was generated using double precision FORTRAN arithmetic
X *	on a Decsystem-20.
X *
X *	Note that the ordering of functions is important for
X *	optimum error information.  Since some functions call
X *	others in the library, the functions being called should
X *	be tested first.  Naturally, an error in a lower level
X *	function will cause propagation of errors up to higher
X *	level functions.
X *
X *  USAGE
X *
X *	dd2d [-esv] [-l limit]
X *
X *		-e	=>	force error for each test
X *				to verify error handling
X *
X *		-l	=>	report errors greater than
X *				specified limit (default 10**-6)
X *
X *		-s	=>	print summary after tests
X *
X *		-v	=>	print each function, argument,
X *				and result
X *
X *	Test directives are read from the standard input, which
X *	may be redirected to the provided test file (dd2d.dat),
X *	and any relative errors are automatically written to standard
X *	output if they exceed a maximum allowable limit.
X *	Each test directive has the form:
X *
X *		<name> <arg1> <arg2> <expected result>
X *
X *	Each field is separated by a one or more space character(s).
X *	The first field, "name", is the name of the function
X *	to test (sqrt, ln, exp, etc).  The second and third fields
X *	are the arguments to use in calling the specified function.
X *	The last field is the expected result.
X *		
X *  PROGRAMMER
X *
X *	Fred Fish
X *	Tempe, Az 85281
X *	(602) 966-8871
X *
X */
X
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X#define MAX_ABS_ERR 1.0e-6	/* Set to catch only gross errors */
X
Xstatic int vflag;		/* Flag for verbose option */
Xstatic int eflag;		/* Simulate an error to error printout */
Xstatic int sflag;		/* Flag to show final statistics */
X
Xstatic double max_abs_err = MAX_ABS_ERR;
X
Xextern double atan2 ();
Xextern double max ();
Xextern double min ();
X
X
X/*
X *	Define all recognized test functions.  Each function
X *	must have an entry in this table, where each
X *	entry contains the information specified in the 
X *	structure "test".
X *
X */
X
Xstruct test {			/* Structure of each function to be tested */
X    char *name;			/* Name of the function to test */
X    double (*func)();		/* Pointer to the function's entry point */
X    double max_err;		/* Error accumulator for this function */
X};
X
Xstatic struct test tests[] = {	/* Table of all recognized functions */
X    "atan2", atan2, 0.0,	/* Arc tangent with two args */
X    "max", max, 0.0,		/* Maximum value */
X    "min", min, 0.0,		/* Minimum value */
X    NULL, NULL, 0.0		/* Function list end marker */
X};
X
X
X/*
X *  FUNCTION
X *
X *	main   entry point for dd2d test utility
X *
X *  PSEUDO CODE
X *
X *	Begin main
X *	    Process any options in command line.
X *	    Do all tests requested by stdin directives.
X *	    Report final statistics (if enabled).
X *	End main
X *
X */
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    options (argc, argv);
X    dotests (argv);
X    statistics ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	dotests   process each test from stdin directives
X *
X *  ERROR REPORTING
X *
X *	Note that in most cases, the error criterion is based
X *	on relative error, defined as:
X *
X *	    error = (result - expected) / expected
X *
X *	Naturally, if the expected result is zero, some
X *	other criterion must be used.  In this case, the
X *	absolute error is used.  That is:
X *
X *	    error = result
X *
X *  PSEUDO CODE
X *
X *	Begin dotests
X *	    While a test directive is successfully read from stdin
X *		Default function name to "{null}"
X *		Default argument 1 to 0.0
X *		Default argument 2 to 0.0
X *		Default expected result to 0.0
X *		Extract function name, argument and expected result
X *		Lookup test in available test list
X *		If no test was found then
X *		    Tell user that unknown function was specified
X *		Else
X *		    Call function with argument and save result
X *		    If the verify flag is set then
X *			Print function name, argument, and result
X *		    End if
X *		    If the expected result is not zero then
X *			Compute the relative error
X *		    Else
X *			Use the absolute error
X *		    End if
X *		    Get absolute value of error
X *		    If error exceeds limit or error force flag set
X *			Print error notification on stderr
X *		    End if
X *		    If this error is max for given function then
X *			Remember this error for summary
X *		    End if
X *		End if
X *	    End while
X *	End dotests
X *
X */
X
X
Xdotests (argv)
Xchar *argv[];
X{
X    char buffer[256];		/* Directive buffer */
X    char function[64];		/* Specified function name */
X    double arg1;		/* Specified function argument 1 */
X    double arg2;		/* Specified function argument 2 */
X    double expected;		/* Specified expected result */
X    double result;		/* Actual result */
X    double error;		/* Relative or absolute error */
X    double abs_err;		/* Absolute value of error */
X    struct test *testp;		/* Pointer to function test */
X    struct test *lookup ();	/* Returns function test pointer */
X    register char *strp;	/* Pointer to next token in string */
X    extern char *strtok ();
X    extern double atof ();
X
X    while (fgets (buffer, sizeof(buffer), stdin) != NULL) {
X	strcpy (function, "{null}");
X	arg1 = 0.0;
X	arg2 = 0.0;
X	expected = 0.0;
X	sscanf (buffer, "%s %le %le %le", function, &arg1, &arg2, &expected);
X        testp = lookup (function);
X        if (testp == NULL) {
X            fprintf (stderr, "%s: unknown function \"%s\".\n",
X	    	argv[0], function);
X        } else {
X	    result = (*testp -> func)(arg1, arg2);
X	    if (vflag) {
X	        printf ("%s(%le,%le) = %30.23le.\n",
X		function, arg1, arg2, result);
X	    }
X	    if (expected != 0.0) {
X	        error = (result - expected) / expected;
X	    } else {
X	        error = result;
X	    }
X	    if (error < 0.0) {
X		abs_err = -error;
X	    } else {
X		abs_err = error;
X	    }
X            if ((abs_err > max_abs_err) || eflag) {
X		fprintf (stderr, "%s: error in \"%s\"\n", argv[0], function);
X		fprintf (stderr, "\targument 1\t%25.20le\n", arg1);
X		fprintf (stderr, "\targument 2\t%25.20le\n", arg2);
X		fprintf (stderr, "\tresult\t\t%25.20le\n", result);
X		fprintf (stderr, "\texpected\t%25.20le\n", expected);
X            }
X	    if (abs_err > testp -> max_err) {
X	        testp -> max_err = abs_err;
X	    }
X        }
X    }
X}
X
X
X/*
X *  FUNCTION
X *
X *	options   process command line options
X *
X *  PSEUDO CODE
X *
X *	Begin options
X *	    Reset all flags to FALSE by default
X *	    Initialize flag argument scan pointer
X *	    If there is a second command line argument then
X *		If the argument specifies flags then
X *		    While there is an unprocessed flag
X *			Switch on flag
X *			Case "force error flag":
X *			    Set the "force error" flag
X *			    Break switch
X *			Case "print summary":
X *			    Set "print summary" flag
X *			    Break switch
X *			Case "verbose":
X *			    Set "verbose" flag
X *			    Break switch
X *			Default:
X *			    Tell user unknown flag
X *			    Break switch
X *			End switch
X *		    End while
X *		End if
X *	    End if
X *	End options
X *
X */
X
X
Xoptions (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    register int flag;
X    extern int getopt ();
X    extern char *optarg;
X
X    eflag = sflag = vflag = FALSE;
X    while ((flag = getopt (argc, argv, "#:el:sv")) != EOF) {
X	switch (flag) {
X	    case '#':
X		break;
X	    case 'e':
X		eflag = TRUE;
X		break;
X	    case 'l':
X	        sscanf (optarg, "%le", &max_abs_err);
X		break;
X	    case 's':
X		sflag = TRUE;
X		break;
X	    case 'v':
X		vflag = TRUE;
X		break;
X	}
X    }
X}
X
X
X/*
X *  FUNCTION
X *
X *	loopup   lookup test in known test list
X *
X *  DESCRIPTION
X *
X *	Given the name of a desired test, looks up the test
X *	in the known test list and returns a pointer to the
X *	test structure.
X *
X *	Since the table is so small we simply use a linear
X *	search.
X *
X *  PSEUDO CODE
X *
X *	Begin lookup
X *	    For each known test
X *		If the test's name matches the desired test name
X *		    Return pointer to the test structure
X *		End if
X *	    End for
X *	End lookup
X *
X */
X
Xstruct test *lookup (funcname)
Xchar *funcname;
X{
X    struct test *testp;
X    struct test *rtnval;
X
X    rtnval = (struct test *) NULL;
X    for (testp = tests; testp -> name != NULL && rtnval == NULL; testp++) {
X	if (!strcmp (testp -> name, funcname)) {
X	    rtnval = testp;
X 	}
X    }
X    return (rtnval);
X}
X
X
X/*
X *  FUNCTION
X *
X *	statistics   print final statistics if desired
X *
X *  PSEUDO CODE
X *
X *	Begin statistics
X *	    If a final statistics (summary) is desired then
X *		For each test in the known test list
X *		    Print the maximum error encountered
X *		End for
X *	    End if
X *	End statistics
X *
X */
X
Xstatistics ()
X{
X    struct test *tp;
X
X    if (sflag) {
X        for (tp = tests; tp -> name != NULL; tp++) {
X	    printf ("%s:\tmaximum relative error %le\n", 
X	    	tp -> name, tp -> max_err);
X	}
X    }
X}
SHAR_EOF
if test 9819 -ne "`wc -c 'dd2d.c'`"
then
	echo shar: error transmitting "'dd2d.c'" '(should have been 9819 characters)'
fi
echo shar: extracting "'c2c.c'" '(11504 characters)'
if test -f 'c2c.c'
then
	echo shar: over-writing existing file "'c2c.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'c2c.c'
X/************************************************************************
X *									*
X *				N O T I C E				*
X *									*
X *			Copyright Abandoned, 1987, Fred Fish		*
X *									*
X *	This previously copyrighted work has been placed into the	*
X *	public domain by the author (Fred Fish) and may be freely used	*
X *	for any purpose, private or commercial.  I would appreciate	*
X *	it, as a courtesy, if this notice is left in all copies and	*
X *	derivative works.  Thank you, and enjoy...			*
X *									*
X *	The author makes no warranty of any kind with respect to this	*
X *	product and explicitly disclaims any implied warranties of	*
X *	merchantability or fitness for any particular purpose.		*
X *									*
X ************************************************************************
X */
X
X/*
X *  FILE
X *
X *	c2c.c   test complex to complex math functions
X *
X *  KEY WORDS
X *
X *	portable math library
X *	test functions
X *
X *  DESCRIPTION
X *
X *	Tests double precision functions for the Portable Math
X *	Library.  Tests those functions which expect a single
X *	double precision complex argument and return a double
X *	precision complex result.
X *
X *	Most of the test data in the current data file (c2c.dat)
X *	was generated using double precision FORTRAN arithmetic
X *	on a Decsystem-20.
X *
X *	Note that the ordering of functions is important for
X *	optimum error information.  Since some functions call
X *	others in the library, the functions being called should
X *	be tested first.  Naturally, an error in a lower level
X *	function will cause propagation of errors up to higher
X *	level functions.
X *
X *  USAGE
X *
X *	c2c [-esv] [-l limit]
X *
X *		-e	=>	force error for each test
X *				to verify error handling
X *
X *		-l	=>	report errors greater than
X *				specified limit (default 10**-6)
X *
X *		-s	=>	print summary after tests
X *
X *		-v	=>	print each function, argument,
X *				and result
X *
X *	Test directives are read from the standard input, which
X *	may be redirected to the provided test file (c2c.dat),
X *	and any relative errors are automatically written to standard
X *	output if they exceed a maximum allowable limit.
X *	Each test directive has the form:
X *
X *		<name> <argument> <expected result>
X *
X *	Each field is separated by a one or more space character(s).
X *	Both the argument and the expected result are given
X *	in the form:
X *
X *		<real> <imag>
X *
X *	where <real> is the real part and <imag> is the
X *	imaginary part, separated by one or more spaces.
X *		
X *		
X *  NOTE
X *
X *	This program uses both the csubt and the cdiv routines,
X *	which are pml functions!.  Thus if either of these screw
X *	up, the results will be unpredictable.  BEWARE!
X *
X *  PROGRAMMER
X *
X *	Fred Fish
X *	Tempe, Az 85281
X *
X */
X
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X#define MAX_ABS_ERR 1.0e-6	/* Set to catch only gross errors */
X
Xstatic int vflag;		/* Flag for verbose option */
Xstatic int eflag;		/* Simulate an error to error printout */
Xstatic int sflag;		/* Flag to show final statistics */
X
Xstatic double max_abs_err = MAX_ABS_ERR;
X
X/*
X *	External functions which are used internally.
X */
X 
Xextern char *strtok ();
Xextern double atof ();
Xextern double cabs ();
Xextern COMPLEX csubt ();
Xextern COMPLEX cdiv ();
X
X/*
X *	External functions to be tested.
X */
X 
Xextern COMPLEX cacos();
Xextern COMPLEX casin();
Xextern COMPLEX catan();
Xextern COMPLEX ccos();
Xextern COMPLEX ccosh();
Xextern COMPLEX cexp();
Xextern COMPLEX clog();
Xextern COMPLEX crcp();
Xextern COMPLEX csin();
Xextern COMPLEX csinh();
Xextern COMPLEX csqrt();
Xextern COMPLEX ctan();
Xextern COMPLEX ctanh();
X
X
X/*
X *	Define all recognized test functions.  Each function
X *	must have an entry in this table, where each
X *	entry contains the information specified in the 
X *	structure "test".
X *
X */
X
Xstruct test {			/* Structure of each function to be tested */
X    char *name;			/* Name of the function to test */
X    COMPLEX (*func)();		/* Pointer to the function's entry point */
X    double max_err;		/* Error accumulator for this function */
X};
X
Xstatic struct test tests[] = {	/* Table of all recognized functions */
X    "cacos", cacos, 0.0, 	/* Complex arc cosine */
X    "casin", casin, 0.0, 	/* Complex arc sine */
X    "catan", catan, 0.0, 	/* Complex arc tangent */
X    "ccos", ccos, 0.0,	 	/* Complex cosine */
X    "ccosh", ccosh, 0.0,	/* Complex hyperbolic cosine */
X    "cexp", cexp, 0.0, 		/* Complex exponential */
X    "clog", clog, 0.0, 		/* Complex natural logarithm */
X    "crcp", crcp, 0.0, 		/* Complex reciprocal */
X    "csin", csin, 0.0, 		/* Complex sine */
X    "csinh", csinh, 0.0, 	/* Complex hyperbolic sine */
X    "csqrt", csqrt, 0.0, 	/* Complex square root */
X    "ctan", ctan, 0.0, 		/* Complex tangent */
X    "ctanh", ctanh, 0.0, 	/* Complex hyperbolic tangent */
X    NULL, NULL, 0.0		/* Function list end marker */
X};
X
X
X/*
X *  FUNCTION
X *
X *	main   entry point for c2c test utility
X *
X *  PSEUDO CODE
X *
X *	Begin main
X *	    Process any options in command line.
X *	    Do all tests requested by stdin directives.
X *	    Report final statistics (if enabled).
X *	End main
X *
X */
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    ENTER ("main");
X    DEBUGWHO (argv[0]);
X    options (argc, argv);
X    dotests (argv);
X    statistics ();
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	dotests   process each test from stdin directives
X *
X *  ERROR REPORTING
X *
X *	Note that in most cases, the error criterion is based
X *	on relative error, defined as:
X *
X *	    error = (result - expected) / expected
X *
X *	Naturally, if the expected result is zero, some
X *	other criterion must be used.  In this case, the
X *	absolute error is used.  That is:
X *
X *	    error = result
X *
X *  PSEUDO CODE
X *
X *	Begin dotests
X *	    While a test directive is successfully read from stdin
X *		Default function name to "{null}"
X *		Default real part of argument to 0.0
X *		Default imaginary part of argument to 0.0
X *		Default expected result to 0.0
X *		Extract function name, argument and expected result
X *		Lookup test in available test list
X *		If no test was found then
X *		    Tell user that unknown function was specified
X *		Else
X *		    Call function with argument and save result
X *		    If the verify flag is set then
X *			Print function name, argument, and result
X *		    End if
X *		    If the expected result is not zero then
X *			Compute the relative error
X *		    Else
X *			Use the absolute error
X *		    End if
X *		    Get absolute value of error
X *		    If error exceeds limit or error force flag set
X *			Print error notification on stderr
X *		    End if
X *		    If this error is max for given function then
X *			Remember this error for summary
X *		    End if
X *		End if
X *	    End while
X *	End dotests
X *
X */
X
X
Xdotests (argv)
Xchar *argv[];
X{
X    char buffer[256];		/* Directive buffer */
X    char function[64];		/* Specified function name */
X    COMPLEX argument;		/* Specified function argument */
X    COMPLEX expected;		/* Specified expected result */
X    COMPLEX result;		/* Actual result */
X    COMPLEX error;		/* Relative or absolute error */
X    double abs_err;		/* Absolute value of error */
X    struct test *testp;		/* Pointer to function test */
X    struct test *lookup ();	/* Returns function test pointer */
X    register char *strp;	/* Pointer to next token in string */
X
X    ENTER ("dotests");
X    while (fgets (buffer, sizeof(buffer), stdin) != NULL) {
X	strcpy (function, "{null}");
X	argument.real = argument.imag = 0.0;
X	expected.real = expected.imag = 0.0;
X	sscanf (buffer, "%s %le %le %le %le", function,
X	&argument.real, &argument.imag, &expected.real, &expected.imag);
X        testp = lookup (function);
X        if (testp == NULL) {
X            fprintf (stderr, "%s: unknown function \"%s\".\n",
X	    	argv[0], function);
X        } else {
X	    result = (*testp -> func)(argument);
X	    if (vflag) {
X	        printf ("%s(%le + j %le) \n   = %30.23le + j %30.23le.\n",
X		function, argument.real, argument.imag, result.real,
X		result.imag);
X	    }
X	    if (expected.real != 0.0 || expected.imag != 0.0) {
X		error = csubt (result, expected);
X		error = cdiv (error, expected);
X	    } else {
X		error = result;
X	    }
X	    abs_err = cabs (error);
X            if ((abs_err > max_abs_err) || eflag) {
X		fprintf (stderr, "%s: error in \"%s\"\n", argv[0], function);
X		fprintf (stderr, "\treal (arg)\t\t%25.20le\n", argument.real);
X		fprintf (stderr, "\timag (arg)\t\t%25.20le\n", argument.imag);
X		fprintf (stderr, "\treal (result)\t\t%25.20le\n",result.real);
X		fprintf (stderr, "\timag (result)\t\t%25.20le\n",result.imag);
X		fprintf (stderr, "\treal (expected)\t\t%25.20le\n",expected.real);
X		fprintf (stderr, "\timag (expected)\t\t%25.20le\n",expected.imag);
X            }
X	    if (abs_err > testp -> max_err) {
X	        testp -> max_err = abs_err;
X	    }
X        }
X    }
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	options   process command line options
X *
X *  PSEUDO CODE
X *
X *	Begin options
X *	    Reset all flags to FALSE by default
X *	    Initialize flag argument scan pointer
X *	    If there is a second command line argument then
X *		If the argument specifies flags then
X *		    While there is an unprocessed flag
X *			Switch on flag
X *			Case "force error flag":
X *			    Set the "force error" flag
X *			    Break switch
X *			Case "print summary":
X *			    Set "print summary" flag
X *			    Break switch
X *			Case "verbose":
X *			    Set "verbose" flag
X *			    Break switch
X *			Default:
X *			    Tell user unknown flag
X *			    Break switch
X *			End switch
X *		    End while
X *		End if
X *	    End if
X *	End options
X *
X */
X
X
Xoptions (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    register int flag;
X    extern int getopt ();
X    extern char *optarg;
X
X    ENTER ("options");
X    eflag = sflag = vflag = FALSE;
X    while ((flag = getopt (argc, argv, "#:el:sv")) != EOF) {
X	switch (flag) {
X	    case '#':
X	        DEBUGPUSH (optarg);
X		break;
X	    case 'e':
X		eflag = TRUE;
X		break;
X	    case 'l':
X	        sscanf (optarg, "%le", &max_abs_err);
X		DEBUG3 ("args", "max_abs_err = %le", max_abs_err);
X		break;
X	    case 's':
X		sflag = TRUE;
X		break;
X	    case 'v':
X		vflag = TRUE;
X		break;
X	}
X    }
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	loopup   lookup test in known test list
X *
X *  DESCRIPTION
X *
X *	Given the name of a desired test, looks up the test
X *	in the known test list and returns a pointer to the
X *	test structure.
X *
X *	Since the table is so small we simply use a linear
X *	search.
X *
X *  PSEUDO CODE
X *
X *	Begin lookup
X *	    For each known test
X *		If the test's name matches the desired test name
X *		    Return pointer to the test structure
X *		End if
X *	    End for
X *	End lookup
X *
X */
X
Xstruct test *lookup (funcname)
Xchar *funcname;
X{
X    struct test *testp;
X    struct test *rtnval;
X
X    ENTER ("lookup");
X    rtnval = (struct test *) NULL;
X    for (testp = tests; testp -> name != NULL && rtnval == NULL; testp++) {
X	if (!strcmp (testp -> name, funcname)) {
X	    rtnval = testp;
X 	}
X    }
X    LEAVE ();
X    return (rtnval);
X}
X
X
X/*
X *  FUNCTION
X *
X *	statistics   print final statistics if desired
X *
X *  PSEUDO CODE
X *
X *	Begin statistics
X *	    If a final statistics (summary) is desired then
X *		For each test in the known test list
X *		    Print the maximum error encountered
X *		End for
X *	    End if
X *	End statistics
X *
X */
X
Xstatistics ()
X{
X    struct test *tp;
X
X    ENTER ("statistics");
X    if (sflag) {
X        for (tp = tests; tp -> name != NULL; tp++) {
X	    printf ("%s:\tmaximum relative error %le\n", 
X	    	tp -> name, tp -> max_err);
X	}
X    }
X    LEAVE ();
X}
SHAR_EOF
if test 11504 -ne "`wc -c 'c2c.c'`"
then
	echo shar: error transmitting "'c2c.c'" '(should have been 11504 characters)'
fi
echo shar: extracting "'cc2c.c'" '(11091 characters)'
if test -f 'cc2c.c'
then
	echo shar: over-writing existing file "'cc2c.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'cc2c.c'
X/************************************************************************
X *									*
X *				N O T I C E				*
X *									*
X *			Copyright Abandoned, 1987, Fred Fish		*
X *									*
X *	This previously copyrighted work has been placed into the	*
X *	public domain by the author (Fred Fish) and may be freely used	*
X *	for any purpose, private or commercial.  I would appreciate	*
X *	it, as a courtesy, if this notice is left in all copies and	*
X *	derivative works.  Thank you, and enjoy...			*
X *									*
X *	The author makes no warranty of any kind with respect to this	*
X *	product and explicitly disclaims any implied warranties of	*
X *	merchantability or fitness for any particular purpose.		*
X *									*
X ************************************************************************
X */
X
X/*
X *  FILE
X *
X *	cc2c.c   test complex to complex math functions
X *
X *  KEY WORDS
X *
X *	portable math library
X *	test functions
X *
X *  DESCRIPTION
X *
X *	Tests double precision functions for the Portable Math
X *	Library.  Tests those functions which expect two
X *	double precision complex arguments and return a double
X *	precision complex result.
X *
X *	Most of the test data in the current data file (cc2c.dat)
X *	was generated using double precision FORTRAN arithmetic
X *	on a Decsystem-20.
X *
X *	Note that the ordering of functions is important for
X *	optimum error information.  Since some functions call
X *	others in the library, the functions being called should
X *	be tested first.  Naturally, an error in a lower level
X *	function will cause propagation of errors up to higher
X *	level functions.
X *
X *  USAGE
X *
X *	cc2c [-esv] [-l limit]
X *
X *		-e	=>	force error for each test
X *				to verify error handling
X *
X *		-l	=>	report errors greater than
X *				specified limit (default 10**-6)
X *
X *		-s	=>	print summary after tests
X *
X *		-v	=>	print each function, argument,
X *				and result
X *
X *	Test directives are read from the standard input, which
X *	may be redirected to the provided test file (cc2c.dat),
X *	and any relative errors are automatically written to standard
X *	output if they exceed a maximum allowable limit.
X *	Each test directive has the form:
X *
X *		<name> <arg1> <arg2> <expected result>
X *
X *	Each field is separated by a one or more space character(s).
X *	Both the argument and the expected result are given
X *	in the form:
X *
X *		<real> <imag>
X *
X *	where <real> is the real part and <imag> is the
X *	imaginary part, separated by one or more spaces.
X *		
X *		
X *  NOTE
X *
X *	This program uses both the csubt and the cdiv routines,
X *	which are pml functions!.  Thus if either of these screw
X *	up, the results will be unpredictable.  BEWARE!
X *
X *  PROGRAMMER
X *
X *	Fred Fish
X *	Tempe, Az 85281
X *
X */
X
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X#define MAX_ABS_ERR 1.0e-6	/* Set to catch only gross errors */
X
Xstatic int vflag;		/* Flag for verbose option */
Xstatic int eflag;		/* Simulate an error to error printout */
Xstatic int sflag;		/* Flag to show final statistics */
X
Xstatic double max_abs_err = MAX_ABS_ERR;
X
X/*
X *	External functions which are used internally.
X */
X 
Xextern char *strtok ();
Xextern double atof ();
Xextern double cabs ();
Xextern COMPLEX csubt ();
Xextern COMPLEX cdiv ();
X
X/*
X *	External functions to be tested.
X */
X 
Xextern COMPLEX cadd();
Xextern COMPLEX csubt();
Xextern COMPLEX cdiv();
Xextern COMPLEX cmult();
X
X
X/*
X *	Define all recognized test functions.  Each function
X *	must have an entry in this table, where each
X *	entry contains the information specified in the 
X *	structure "test".
X *
X */
X
Xstruct test {			/* Structure of each function to be tested */
X    char *name;			/* Name of the function to test */
X    COMPLEX (*func)();		/* Pointer to the function's entry point */
X    double max_err;		/* Error accumulator for this function */
X};
X
Xstatic struct test tests[] = {	/* Table of all recognized functions */
X    "cadd", cadd, 0.0, 		/* Complex addition */
X    "csubt", csubt, 0.0, 	/* Complex subtraction */
X    "cdiv", cdiv, 0.0, 		/* Complex division */
X    "cmult", cmult, 0.0,	/* Complex multiplication */
X    NULL, NULL, 0.0		/* Function list end marker */
X};
X
X
X/*
X *  FUNCTION
X *
X *	main   entry point for cc2c test utility
X *
X *  PSEUDO CODE
X *
X *	Begin main
X *	    Process any options in command line.
X *	    Do all tests requested by stdin directives.
X *	    Report final statistics (if enabled).
X *	End main
X *
X */
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    ENTER ("main");
X    DEBUGWHO (argv[0]);
X    options (argc, argv);
X    dotests (argv);
X    statistics ();
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	dotests   process each test from stdin directives
X *
X *  ERROR REPORTING
X *
X *	Note that in most cases, the error criterion is based
X *	on relative error, defined as:
X *
X *	    error = (result - expected) / expected
X *
X *	Naturally, if the expected result is zero, some
X *	other criterion must be used.  In this case, the
X *	absolute error is used.  That is:
X *
X *	    error = result
X *
X *  PSEUDO CODE
X *
X *	Begin dotests
X *	    While a test directive is successfully read from stdin
X *		Default function name to "{null}"
X *		Default real part of argument to 0.0
X *		Default imaginary part of argument to 0.0
X *		Default expected result to 0.0
X *		Extract function name, argument and expected result
X *		Lookup test in available test list
X *		If no test was found then
X *		    Tell user that unknown function was specified
X *		Else
X *		    Call function with argument and save result
X *		    If the verify flag is set then
X *			Print function name, argument, and result
X *		    End if
X *		    If the expected result is not zero then
X *			Compute the relative error
X *		    Else
X *			Use the absolute error
X *		    End if
X *		    Get absolute value of error
X *		    If error exceeds limit or error force flag set
X *			Print error notification on stderr
X *		    End if
X *		    If this error is max for given function then
X *			Remember this error for summary
X *		    End if
X *		End if
X *	    End while
X *	End dotests
X *
X */
X
X
Xdotests (argv)
Xchar *argv[];
X{
X    char buffer[256];		/* Directive buffer */
X    char function[64];		/* Specified function name */
X    COMPLEX arg1;		/* Specified function argument 1 */
X    COMPLEX arg2;		/* Specified function argument 2 */
X    COMPLEX expected;		/* Specified expected result */
X    COMPLEX result;		/* Actual result */
X    COMPLEX error;		/* Relative or absolute error */
X    double abs_err;		/* Absolute value of error */
X    struct test *testp;		/* Pointer to function test */
X    struct test *lookup ();	/* Returns function test pointer */
X    register char *strp;	/* Pointer to next token in string */
X
X    ENTER ("dotests");
X    while (fgets (buffer, sizeof(buffer), stdin) != NULL) {
X	strcpy (function, "{null}");
X	arg1.real = arg1.imag = 0.0;
X	arg2.real = arg2.imag = 0.0;
X	expected.real = expected.imag = 0.0;
X	sscanf (buffer, "%s %le %le %le %le %le %le", function,
X		&arg1.real, &arg1.imag, &arg2.real, &arg2.imag,
X		&expected.real, &expected.imag);
X        testp = lookup (function);
X        if (testp == NULL) {
X            fprintf (stderr, "%s: unknown function \"%s\".\n",
X	    	argv[0], function);
X        } else {
X	    result = (*testp -> func)(arg1, arg2);
X	    if (vflag) {
X	        printf ("%s(%le + j %le, %le + j %le)\n",
X			function, arg1.real, arg1.imag, arg2.real, arg2.imag);
X		printf ("  = %30.23le + j %30.23le.\n", result.real,
X			result.imag);
X	    }
X	    if (expected.real != 0.0 || expected.imag != 0.0) {
X		error = csubt (result, expected);
X		error = cdiv (error, expected);
X	    } else {
X		error = result;
X	    }
X	    abs_err = cabs (error);
X            if ((abs_err > max_abs_err) || eflag) {
X		fprintf (stderr, "%s: error in \"%s\"\n", argv[0], function);
X		fprintf (stderr, "\treal (arg1)\t\t%25.20le\n", arg1.real);
X		fprintf (stderr, "\timag (arg1)\t\t%25.20le\n", arg1.imag);
X		fprintf (stderr, "\treal (arg2)\t\t%25.20le\n", arg2.real);
X		fprintf (stderr, "\timag (arg2)\t\t%25.20le\n", arg2.imag);
X		fprintf (stderr, "\treal (result)\t\t%25.20le\n",result.real);
X		fprintf (stderr, "\timag (result)\t\t%25.20le\n",result.imag);
X		fprintf (stderr, "\treal (expected)\t\t%25.20le\n",expected.real);
X		fprintf (stderr, "\timag (expected)\t\t%25.20le\n",expected.imag);
X            }
X	    if (abs_err > testp -> max_err) {
X	        testp -> max_err = abs_err;
X	    }
X        }
X    }
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	options   process command line options
X *
X *  PSEUDO CODE
X *
X *	Begin options
X *	    Reset all flags to FALSE by default
X *	    Initialize flag argument scan pointer
X *	    If there is a second command line argument then
X *		If the argument specifies flags then
X *		    While there is an unprocessed flag
X *			Switch on flag
X *			Case "force error flag":
X *			    Set the "force error" flag
X *			    Break switch
X *			Case "print summary":
X *			    Set "print summary" flag
X *			    Break switch
X *			Case "verbose":
X *			    Set "verbose" flag
X *			    Break switch
X *			Default:
X *			    Tell user unknown flag
X *			    Break switch
X *			End switch
X *		    End while
X *		End if
X *	    End if
X *	End options
X *
X */
X
X
Xoptions (argc, argv)
Xint argc;
Xchar *argv[];
X{
X    register int flag;
X    extern int getopt ();
X    extern char *optarg;
X
X    ENTER ("options");
X    eflag = sflag = vflag = FALSE;
X    while ((flag = getopt (argc, argv, "#:el:sv")) != EOF) {
X	switch (flag) {
X	    case '#':
X	        DEBUGPUSH (optarg);
X		break;
X	    case 'e':
X		eflag = TRUE;
X		break;
X	    case 'l':
X	        sscanf (optarg, "%le", &max_abs_err);
X		DEBUG3 ("args", "max_abs_err = %le", max_abs_err);
X		break;
X	    case 's':
X		sflag = TRUE;
X		break;
X	    case 'v':
X		vflag = TRUE;
X		break;
X	}
X    }
X    LEAVE ();
X}
X
X
X/*
X *  FUNCTION
X *
X *	loopup   lookup test in known test list
X *
X *  DESCRIPTION
X *
X *	Given the name of a desired test, looks up the test
X *	in the known test list and returns a pointer to the
X *	test structure.
X *
X *	Since the table is so small we simply use a linear
X *	search.
X *
X *  PSEUDO CODE
X *
X *	Begin lookup
X *	    For each known test
X *		If the test's name matches the desired test name
X *		    Return pointer to the test structure
X *		End if
X *	    End for
X *	End lookup
X *
X */
X
Xstruct test *lookup (funcname)
Xchar *funcname;
X{
X    struct test *testp;
X    struct test *rtnval;
X
X    ENTER ("lookup");
X    rtnval = (struct test *) NULL;
X    for (testp = tests; testp -> name != NULL && rtnval == NULL; testp++) {
X	if (!strcmp (testp -> name, funcname)) {
X	    rtnval = testp;
X 	}
X    }
X    LEAVE ();
X    return (rtnval);
X}
X
X
X/*
X *  FUNCTION
X *
X *	statistics   print final statistics if desired
X *
X *  PSEUDO CODE
X *
X *	Begin statistics
X *	    If a final statistics (summary) is desired then
X *		For each test in the known test list
X *		    Print the maximum error encountered
X *		End for
X *	    End if
X *	End statistics
X *
X */
X
Xstatistics ()
X{
X    struct test *tp;
X
X    ENTER ("statistics");
X    if (sflag) {
X        for (tp = tests; tp -> name != NULL; tp++) {
X	    printf ("%s:\tmaximum relative error %le\n", 
X	    	tp -> name, tp -> max_err);
X	}
X    }
X    LEAVE ();
X}
SHAR_EOF
if test 11091 -ne "`wc -c 'cc2c.c'`"
then
	echo shar: error transmitting "'cc2c.c'" '(should have been 11091 characters)'
fi
echo shar: extracting "'Makefile.sun'" '(432 characters)'
if test -f 'Makefile.sun'
then
	echo shar: over-writing existing file "'Makefile.sun'"
fi
sed 's/^X//' << \SHAR_EOF > 'Makefile.sun'
XCC = cc
XCFLAGS =	-DNO_DBUG -O -I../pmlsrc
XLIBS =		../pmlsrc/libpml.a -v
X
Xall :		d2d dd2d c2d c2c cc2c
X
Xd2d :		d2d.o
X		$(CC) -o d2d d2d.o $(LIBS)
X
Xdd2d :		dd2d.o
X		$(CC) -o dd2d dd2d.o $(LIBS)
X		
Xc2d :		c2d.o
X		$(CC) -o c2d c2d.o $(LIBS)
X
Xc2c :		c2c.o
X		$(CC) -o c2c c2c.o $(LIBS)
X		
Xcc2c :		cc2c.o
X		$(CC) -o cc2c cc2c.o $(LIBS)
X		
X
X#
X#	Clean up the directory.
X#
X
Xclean:
X	rm -f c2c c2d cc2c d2d dd2d *.BAK *.bak *.tmp nohup.out *.o
SHAR_EOF
if test 432 -ne "`wc -c 'Makefile.sun'`"
then
	echo shar: error transmitting "'Makefile.sun'" '(should have been 432 characters)'
fi
echo shar: extracting "'Makefile.minix'" '(423 characters)'
if test -f 'Makefile.minix'
then
	echo shar: over-writing existing file "'Makefile.minix'"
fi
sed 's/^X//' << \SHAR_EOF > 'Makefile.minix'
XCC = mgcc
XCFLAGS =	-DNO_DBUG -O -I../pmlsrc
XLIBS =		-lpml32 -v
X
Xall :		d2d dd2d c2d c2c cc2c
X
Xd2d :		d2d.o
X		$(CC) -o d2d d2d.o $(LIBS)
X
Xdd2d :		dd2d.o
X		$(CC) -o dd2d dd2d.o $(LIBS)
X		
Xc2d :		c2d.o
X		$(CC) -o c2d c2d.o $(LIBS)
X
Xc2c :		c2c.o
X		$(CC) -o c2c c2c.o $(LIBS)
X		
Xcc2c :		cc2c.o
X		$(CC) -o cc2c cc2c.o $(LIBS)
X		
X
X#
X#	Clean up the directory.
X#
X
Xclean:
X	rm -f c2c c2d cc2c d2d dd2d *.BAK *.bak *.tmp nohup.out *.o
SHAR_EOF
if test 423 -ne "`wc -c 'Makefile.minix'`"
then
	echo shar: error transmitting "'Makefile.minix'" '(should have been 423 characters)'
fi
echo shar: extracting "'Makefile.tos'" '(494 characters)'
if test -f 'Makefile.tos'
then
	echo shar: over-writing existing file "'Makefile.tos'"
fi
sed 's/^X//' << \SHAR_EOF > 'Makefile.tos'
XCC = cgcc
XCFLAGS =	-DNO_DBUG -O -I../pmlsrc
XLIBS =		/dsrg/bammi/cross-gcc/lib/libpml.a -v
X
Xall :		d2d.ttp dd2d.ttp c2d.ttp c2c.ttp cc2c.ttp
X
Xd2d.ttp :		d2d.o
X		$(CC) -o d2d.ttp d2d.o $(LIBS)
X
Xdd2d.ttp :		dd2d.o
X		$(CC) -o dd2d.ttp dd2d.o $(LIBS)
X		
Xc2d.ttp :		c2d.o
X		$(CC) -o c2d.ttp c2d.o $(LIBS)
X
Xc2c.ttp :		c2c.o
X		$(CC) -o c2c.ttp c2c.o $(LIBS)
X		
Xcc2c.ttp :		cc2c.o
X		$(CC) -o cc2c.ttp cc2c.o $(LIBS)
X		
X
X#
X#	Clean up the directory.
X#
X
Xclean:
X	rm -f *.ttp *.BAK *.bak *.tmp nohup.out *.o
SHAR_EOF
if test 494 -ne "`wc -c 'Makefile.tos'`"
then
	echo shar: error transmitting "'Makefile.tos'" '(should have been 494 characters)'
fi
echo shar: done with directory "'pmltests'"
cd ..
#	End of shell archive
exit 0
usenet: {decvax,sun}!cwjcc!dsrgsun!bammi	jwahar r. bammi
csnet:       bammi@dsrgsun.ces.CWRU.edu
arpa:        bammi@dsrgsun.ces.CWRU.edu
compuServe:  71515,155