/* monotll.c
Floating point function test vectors .
128 - bit long double version .
Arguments and function values are synthesized for NPTS points in
the vicinity of each given tabulated test point . The points are
chosen to be near and on either side of the likely function algorithm
domain boundaries . Since the function programs change their methods
at these points , major coding errors or monotonicity failures might be
detected .
August , 1998
S. L. Moshier */
/* Unit of error tolerance in test[i].thresh. */
static long double MACHEPL = 1 .9259299443872358530559779425849273185381 E-34 L;
/* How many times the above error to allow before printing a complaint.
If TOL < 0, consider absolute error instead of relative error. */
#define TOL 4
/* Number of test points to generate on each side of tabulated point. */
#define NPTS 100
#include <stdio.h>
#include <string.h>
/* Avoid including math.h. */
long double frexpl (long double , int *);
long double ldexpl (long double , int );
/* Functions of one variable. */
long double expl (long double );
long double expm1l (long double );
long double logl (long double );
long double log1pl (long double );
long double sinl (long double );
long double cosl (long double );
long double tanl (long double );
long double atanl (long double );
long double asinl (long double );
long double acosl (long double );
long double sinhl (long double );
long double coshl (long double );
long double tanhl (long double );
long double asinhl (long double );
long double acoshl (long double );
long double atanhl (long double );
long double gammal (long double );
long double lgammal (long double );
long double tgammal (long double );
long double fabsl (long double );
long double floorl (long double );
long double j0l (long double );
long double y0l (long double );
long double j1l (long double );
long double y1l (long double );
long double jnl (int , long double );
long double ynl (int , long double );
/* Data structure of the test. */
struct oneargument
{
char *name; /* Name of the function. */
long double (*func) (long double ); /* Function call. */
long double arg1; /* Function argument, assumed exact. */
long double answer1; /* Exact number, close to function value. */
long double answer2; /* answer1 + answer2 has extended precision. */
long double derivative; /* dy/dx evaluated at x = arg1. */
/* Error report threshold. 2 => 1 ulp approximately
if thresh < 0 then consider absolute error instead of relative error. */
int thresh;
};
struct oneargument test1[] =
{
{"exp" , expl, 1 .0 L, 2 .7182769775390625 L,
4 .85091998273536028747135266249775725 E-6 L,
2 .71828182845904523536028747135266250 E0L, TOL},
{"exp" , expl, -1 .0 L, 3 .678741455078125 e-1 L,
5 .29566362982159552377016146086744581 E-6 L,
3 .67879441171442321595523770161460867 E-1 L, TOL},
{"exp" , expl, 0 .5 L, 1 .648712158203125 L,
9 .11249700314684865078781416357165378 E-6 L,
1 .64872127070012814684865078781416357 L, TOL},
{"exp" , expl, -0 .5 L, 6 .065216064453125 e-1 L,
9 .05326732092360379953499118045344192 E-6 L,
6 .06530659712633423603799534991180453 E-1 L, TOL},
{"exp" , expl, 2 .0 L, 7 .3890533447265625 L,
2 .75420408772723042746057500781318032 E-6 L,
7 .38905609893065022723042746057500781 E0L, TOL},
{"exp" , expl, -2 .0 L, 1 .353302001953125 e-1 L,
5 .08304130019189399949497248440340763 E-6 L,
1 .35335283236612691893999494972484403 E-1 L, TOL},
{"expm1" , expm1l, 1 .0 L, 1 .7182769775390625 L,
4 .85091998273536028747135266249775725 E-6 L,
2 .71828182845904523536028747135266250 E0L, TOL},
{"expm1" , expm1l, 0 .5 L, 0 .648712158203125 L,
9 .11249700314684865078781416357165378 E-6 L,
1 .64872127070012814684865078781416357 L, TOL},
{"expm1" , expm1l, 2 .0 L, 6 .3890533447265625 L,
2 .75420408772723042746057500781318032 E-6 L,
7 .38905609893065022723042746057500781 E0L, TOL},
{"log" , logl, 1 .41421356237309504880168872420969798 L,
3 .465728759765625 E-1 L,
7 .14303410154708616060729088217412434 E-7 L,
7 .07106781186547524400844362104849086 E-1 L, TOL},
{"log" , logl, 7 .07106781186547524400844362104848992 E-1 L,
-3 .46588134765625 E-1 L,
1 .45444856523452913839392709116493369 E-5 L,
1 .41421356237309504880168872420969817 E0L, TOL},
{"log1p" , log1pl, 0 .41421356237309504880168872420969798 L,
3 .465728759765625 E-1 L,
7 .14303410154708616060729088217412434 E-7 L,
7 .07106781186547524400844362104849086 E-1 L, TOL},
{"sin" , sinl, 7 .85398163397448309615660845819875699 E-1 L,
7 .0709228515625 E-1 L,
1 .44960302975244008443621048490239551 E-5 L,
7 .07106781186547524400844362104849055 E-1 , TOL},
{"sin" , sinl, -7 .85398163397448309615660845819875699 E-1 L,
-7 .071075439453125 E-1 L,
7 .62758764975599155637895150976044903 E-7 L,
7 .07106781186547524400844362104849055 E-1 L, TOL},
{"sin" , sinl, 1 .57079632679489661923132169163975140 E0L,
9 .999847412109375 E-1 L,
1 .52587890625 E-5 L,
0 .0 L, TOL},
{"sin" , sinl, -1 .57079632679489661923132169163975140 E0L,
-1 .0 L,
0 .0 L,
0 .0 L, TOL},
{"sin" , sinl, 4 .71238898038468985769396507491925433 E0L,
-1 .0 L,
0 .0 L,
0 .0 L, TOL},
{"sin" , sinl, -4 .71238898038468985769396507491925420 E0L,
1 .0 L,
0 .0 L,
0 .0 L, TOL},
{"cos" , cosl, 3 .92699081698724154807830422909937850 E-1 L,
9 .238739013671875 E-1 L,
5 .63114409925612818318939678829097061 E-6 L,
-3 .82683432365089771728459984030398857 E-1 L, TOL},
{"cos" , cosl, 7 .85398163397448309615660845819875699 E-1 L,
7 .0709228515625 E-1 L,
1 .44960302975244008443621048490546146 E-5 L,
-7 .07106781186547524400844362104849024 E-1 L, TOL},
{"cos" , cosl, 1 .17809724509617246442349126872981355 E0L,
3 .826751708984375 E-1 L,
8 .26146665227172845998403039889680525 E-6 L,
-9 .23879532511286756128183189396788274 E-1 L, TOL},
{"cos" , cosl, 1 .96349540849362077403915211454968925 E0L,
-3 .826904296875 E-1 L,
6 .99732241022827154001596960118331183 E-6 L,
-9 .23879532511286756128183189396788308 E-1 L, TOL},
{"cos" , cosl, 2 .35619449019234492884698253745962710 E0L,
-7 .071075439453125 E-1 L,
7 .62758764975599155637895151006704382 E-7 L,
-7 .07106781186547524400844362104849085 E-1 L, TOL},
{"cos" , cosl, 2 .74889357189106908365481296036956495 E0L,
-9 .2388916015625 E-1 L,
9 .62764496324387181681060321174221497 E-6 L,
-3 .82683432365089771728459984030398937 E-1 L, TOL},
{"cos" , cosl, 3 .14159265358979323846264338327950280 E0L,
-1 .0 L,
0 .0 L,
0 .0 L, TOL},
{"tan" , tanl, 7 .8539816339744830961566084581987569936977 E-1 L,
9 .999847412109375 E-1 L,
1 .5258789062499999999999999999956640949349 E-5 L,
2 .0 L, TOL},
{"tan" , tanl, 1 .1780972450961724644234912687298135490547 E0L,
2 .4141998291015625 L,
1 .3733271532548801688724209697856514083701 E-5 L,
6 .8284271247461900976033774484193950849601 E0L, TOL},
{"tan" , tanl, 1 .96349540849362077403915211454968925 E0L,
-2 .414215087890625 L,
1 .52551752995119831127579030155133768 E-6 L,
6 .82842712474619009760337744841939794 E0L, TOL},
{"tan" , tanl, 2 .35619449019234492884698253745962710 E0L,
-1 .0000152587890625 L,
1 .52587890624999999999999999998699228 E-5 L,
2 .0 L, TOL},
{"tan" , tanl, 2 .74889357189106908365481296036956495 E0L,
-4 .14215087890625 E-1 L,
1 .52551752995119831127579030183253332 E-6 L,
1 .17157287525380990239662255158060392 E0L, TOL},
{"atan" , atanl, 4 .14213562373095048801688724209698081 E-1 L,
3 .926849365234375 E-1 L,
1 .41451752866548078304229099378622950 E-5 L,
8 .53553390593273762200422181052424518 E-1 L, TOL},
{"atan" , atanl, 1 .0 L,
7 .853851318359375 E-1 L,
1 .30315615108096156608458198757210493 E-5 L,
0 .5 L, TOL},
{"atan" , atanl, 2 .41421356237309504880168872420969818 E0L,
1 .1780853271484375 L,
1 .19179477349644234912687298135959800 E-5 L,
1 .46446609406726237799577818947575470 E-1 L, TOL},
{"atan" , atanl, -2 .41421356237309504880168872420969818 E0L,
-1 .1781005859375 L,
3 .34084132753557650873127018640402003 E-6 L,
1 .46446609406726237799577818947575470 E-1 L, TOL},
{"atan" , atanl, -1 .0 L,
-7 .85400390625 E-1 L,
2 .22722755169038433915418012427895071 E-6 L,
0 .5 L, TOL},
{"atan" , atanl, -4 .14213562373095048801688724209698081 E-1 L,
-3 .927001953125 E-1 L,
1 .11361377584519216957709006213770502 E-6 L,
8 .53553390593273762200422181052424518 E-1 L, TOL},
{"asin" , asinl, 3 .82683432365089771728459984030398880 E-1 L,
3 .926849365234375 E-1 L,
1 .41451752866548078304229099378750938 E-5 L,
1 .08239220029239396879944641073277885 E0L, TOL},
{"asin" , asinl, 0 .5 L,
5 .23590087890625 E-1 L,
8 .68770767387307710723054658381403286 E-6 L,
1 .15470053837925152901829756100391491 E0L, TOL},
{"asin" , asinl, 7 .07106781186547524400844362104848992 E-1 L,
7 .853851318359375 E-1 L,
1 .30315615108096156608458198756544240 E-5 L,
1 .41421356237309504880168872420969798 E0L, TOL},
{"asin" , asinl, 9 .23879532511286756128183189396788310 E-1 L,
1 .1780853271484375 L,
1 .19179477349644234912687298136415266 E-5 L,
2 .61312592975275305571328634685437469 E0L, TOL},
{"asin" , asinl, -0 .5 L,
-5 .236053466796875 E-1 L,
6 .57108138862692289276945341618596714 E-6 L,
1 .15470053837925152901829756100391491 E0L, TOL},
{"asin" , asinl, 1 .16415321826934814453125 E-10 L,
1 .16415321826934814453125 E-10 L,
2 .62953635073670601805513180586984061 E-31 L,
1 .00000000000000000000677626357803440 E0L, TOL},
{"asin" , asinl, 0 .625 L,
6 .751251220703125 E-1 L,
6 .41086671914720905626529438801420419 E-6 L,
1 .28102523044069706786602935814149630 E0L, TOL},
{"asin" , asinl, 9 .74999999999999999999999999999999981 E-1 L,
1 .346710205078125 L,
1 .08364149523595315129076204973231659 E-5 L,
4 .50035160370409562029946413944745541 E0L, TOL},
{"acos" , acosl, 1 .95090322016128267848284868477022248 E-1 L,
1 .3744354248046875 L,
1 .13611408470418274064801847825042255 E-5 L,
-1 .01959115820831833788387960797568783 E0L, TOL},
{"acos" , acosl, 3 .82683432365089771728459984030398880 E-1 L,
1 .1780853271484375 L,
1 .19179477349644234912687298135670048 E-5 L,
-1 .08239220029239396879944641073277885 E0L, TOL},
{"acos" , acosl, 0 .5 L,
1 .0471954345703125 L,
2 .11662628524615421446109316762806572 E-6 L,
-1 .15470053837925152901829756100391491 E0L, TOL},
{"acos" , acosl, 7 .07106781186547524400844362104848992 E-1 L,
7 .853851318359375 E-1 L,
1 .30315615108096156608458198757876746 E-5 L,
-1 .41421356237309504880168872420969798 E0L, TOL},
{"acos" , acosl, 9 .23879532511286756128183189396788310 E-1 L,
3 .926849365234375 E-1 L,
1 .41451752866548078304229099378005720 E-5 L,
-2 .61312592975275305571328634685437469 E0L, TOL},
{"acos" , acosl, 9 .80785280403230449126182236134239047 E-1 L,
1 .963348388671875 E-1 L,
1 .47019821745774039152114549688769794 E-5 L,
-5 .12583089548301235759217259235540119 E0L, TOL},
{"acos" , acosl, -0 .5 L,
2 .094390869140625 L,
4 .23325257049230842892218633525613145 E-6 L,
-1 .15470053837925152901829756100391491 E0L, TOL},
{"sinh" , sinhl, 1 .0 L,
1 .1751861572265625 L,
1 .50364172389568823818505956008151557 E-5 L,
1 .54308063481524377847790562075706168 E0L, TOL},
{"sinh" , sinhl, 11355 .5 L,
2 .13776152623792146713900550884909252 E4931L,
9 .07106102767577900425552629248457689 E4896L,
2 .13776152623792146713900550884909261 E4931L, TOL},
{"sinh" , sinhl, 2 .22044604925031308084726333618164062 E-16 L,
2 .22044604925031308084726333618164062 E-16 L,
1 .82460737542293889443193956157541613 E-48 L,
1 .00000000000000000000000000000002465 E0L, TOL},
{"sinh" , sinhl, 40 .0 L,
1 .17692633418509992 E17L, 7 .039499553745174001302586809814832360 E-1 L,
1 .176926334185099927039499553745174044 E17L, TOL},
{"sinh" , sinhl, 6 .938893903907228377647697925567626953 E-18 L, /* 2^-57 */
6 .938893903907228377647697925567626953 E-18 L,
5 .568259812692074262792784306565587261 E-53 L, 1 .0 L, TOL},
{"sinh" , sinhl, 11356 .375 L,
5 .1282233096855457613267954696602303826729 E4931L,
6 .8582733554584347269625352341976754246942 E4896L,
5 .1282233096855457613267954696602304512556 E4931L, TOL},
{"cosh" , coshl, 40 .0 L,
1 .176926334185099927039499553745174054 E17L,
-1 .036733679609227143506056540471143597 E-18 L,
1 .176926334185099927039499553745174001 E17L, TOL},
{"cosh" , coshl, 6 .938893903907228377647697925567626953 E-18 L,
1 .0 L, 2 .407412430484044816319972428231159158 E-35 L,
6 .938893903907228377647697925567627009 E-18 L, TOL},
{"cosh" , coshl, 11356 .375 L,
5 .128223309685545761326795469660230383 E4931L,
6 .858273355458434726962535234197675425 E4896L,
5 .128223309685545761326795469660230451 E4931L, TOL},
{"cosh" , coshl, 11355 .5 L,
2 .13776152623792146713900550884909252 E4931L,
9 .07106102767577900425552629248457689 E4896L,
2 .13776152623792146713900550884909261 E4931L, TOL},
{"cosh" , coshl, 1 .0 L,
1 .5430755615234375 L,
5 .07329180627847790562075706168260153 E-6 L,
1 .17520119364380145688238185059560082 E0L, TOL},
{"cosh" , coshl, 0 .5 L,
1 .12762451171875 L,
1 .45348763078522622516140267201254785 E-6 L,
5 .21095305493747361622425626411491559 E-1 L, TOL},
{"tanh" , tanhl, 0 .5 L,
4 .621124267578125 E-1 L,
4 .73050219725850231848364367254873029 E-6 L,
7 .86447732965927410149698934343636102 E-1 L, TOL},
{"tanh" , tanhl, 5 .49306144334054845697622618461262805 E-1 L,
4 .999847412109375 E-1 L,
1 .52587890624999999999999999999648170 E-5 L,
7 .50000000000000000000000000000000035 E-1 L, TOL},
{"tanh" , tanhl, 0 .625 L,
5 .54595947265625 E-1 L,
3 .77508375729399903909532308359605810 E-6 L,
6 .92419147969988069630753311573341685 E-1 L, TOL},
{"tanh" , tanhl, 40 .0 L,
1 .0 L,
-3 .609702775690830344624256714700054777 E-35 L,
7 .219405551381660689248513429400109424 E-35 L, TOL},
{"tanh" , tanhl, 6 .9388939039072283776476979255676269531250 E-18 L, /* 2^-57 */
6 .9388939039072283776476979255676269531250 E-18 L,
-1 .1136519625384148525585568613131174280582 E-52 L,
9 .9999999999999999999999999999999995185175 E-1 L, TOL},
{"tanh" , tanhl, 2 .775557561562891351059079170227050781 E-17 L, /* 2^-55 */
2 .775557561562891351059079170227050781 E-17 L,
-7 .127372560245855056374763912403949481 E-51 L,
9 .999999999999999999999999999999992296 E-1 L, TOL},
{"tanh" , tanhl, 1 .0 L,
7 .615814208984375 e-1 L,
1 .273505732738811945828260479359041277 E-5 L,
4 .199743416140260693944967390417014449 E-1 L, TOL},
{"asinh" , asinhl, 0 .5 L,
4 .81201171875 E-1 L,
1 .06531846034474977589134243684231352 E-5 L,
8 .94427190999915878563669467492510494 E-1 L, TOL},
{"asinh" , asinhl, 1 .0 L,
8 .813629150390625 E-1 L,
1 .06719804805252326093249797923090282 E-5 L,
7 .07106781186547524400844362104849039 E-1 L, TOL},
{"asinh" , asinhl, 2 .0 L,
1 .443634033203125 L,
1 .44197568534249327674027310526940555 E-6 L,
4 .47213595499957939281834733746255247 E-1 L, TOL},
{"asinh" , asinhl, 1 .3877787807814456755295395851135253906250 E-17 L, /*2^-56*/
1 .3877787807814456755295395851135253906250 E-17 L,
-4 .4546078501536594102342274452524694119585 E-52 L,
9 .9999999999999999999999999999999990370350 E-1 L, TOL},
{"asinh" , asinhl, 1 .8014398509481984 E16L,
38 .1230926513671875 L,
2 .2794298045179477666801997120145244851447 E-6 L,
5 .5511151231257827021181583404540930096529 E-17 L, TOL},
{"acosh" , acoshl, 2 .0 L,
1 .31695556640625 L,
2 .33051856670862504634730796844402698 E-6 L,
5 .77350269189625764509148780501957456 E-1 L, TOL},
{"acosh" , acoshl, 1 .5 L,
9 .624176025390625 E-1 L,
6 .04758014439499551782684873684627037 E-6 L,
8 .94427190999915878563669467492510494 E-1 L, TOL},
{"acosh" , acoshl, 1 .03125 L,
2 .493438720703125 E-1 L,
9 .62177257298785143907541001884302707 E-6 L,
3 .96911150685467059808817882107262579 E0L, TOL},
{"acosh" , acoshl, 2 .68435456 e8L, /* 2 ^ 28 */
20 .10125732421875 L,
1 .091201966396963028457033350626731006 E-5 L,
3 .725290298461914088349394142282115109 E-9 L, TOL},
{"acosh" , acoshl, 1 .8014398509481984 e16L, /* 2 ^ 54 */
38 .1230926513671875 L,
2 .279429804517947766680199710473780530 E-6 L,
5 .551115123125782702118158340454110115 E-17 L, TOL},
{"acosh" , acoshl, 1 .073741824 e9L, /* 2^30 */
21 .487548828125 L,
1 .376923330459171735533070637272346848 E-5 L,
9 .313225746154785160288967834731580446 E-10 L, TOL},
{"atanh" , atanhl, 0 .5 L,
5 .493011474609375 E-1 L,
4 .99687311734569762261846126285232375 E-6 L,
1 .33333333333333333333333333333333333 E0L, TOL},
{"atanh" , atanhl, 6 .938893903907228377647697925567626953125 E-18 ,
6 .938893903907228377647697925567626953125 E-18 , /* 2^-57 */
1 .1136519625384148525585568613131174816786 E-52 , 1 .0 , TOL},
{"j0" , j0l, 16 .0 L, -1 .749114990234375 e-1 L,
1 .24250398083151715974822741805925455 E-5 L,
-9 .03971756613041862386833024580760244 E-2 L, -2 },
{"j0" , j0l, 8 .0 L, 1 .716461181640625 E-1 L,
4 .68897349140609086940785197200106842 E-6 L,
-2 .34636346853914624381276651590454612 E-1 L, -2 },
{"j0" , j0l, 5 .33333333333333333333333333333333333 E0L,
-6 .427001953125 e-2 L,
2 .71515994768793872858212682917411767 E-6 L,
3 .46125605116223455248039758589625114 E-1 L, -2 },
{"j0" , j0l, 4 .0 L, -3 .9715576171875 e-1 L,
5 .95185490262771340923154830195802438 E-6 L,
6 .60433280235491361431854208032750287 E-2 L, -2 },
{"j0" , j0l, 3 .2 L, -3 .201904296875 e-1 L,
2 .26003037709271056745460231434000663 E-6 L,
-2 .61343248780504837362986742359905319 E-1 L, -2 },
{"j0" , j0l, 2 .66666666666666666666666666666666667 E0L,
-1 .275634765625 e-1 L,
2 .48895584953746034929481550434723427 E-6 L,
-4 .51651148392987785778929732830311060 E-1 L, -2 },
{"j0" , j0l, 2 .28571428571428571428571428571428571 E0L,
6 .3262939453125 e-2 L,
7 .41898014310740285267270594759284975 E-6 L,
-5 .42395540605083481518545728422177515 E-1 L, -2 },
{"j0" , j0l, 2 .0 L,
2 .23876953125 e-1 L,
1 .38260162356680518274546499486258252 E-5 L,
-5 .76724807756873387202448242269137087 E-1 L, -2 },
{"y0" , y0l, 16 .0 L,
9 .58099365234375 e-2 L,
1 .06055727490314207096590322941832776 E-6 L,
-1 .77975168939416859630601904359871915 E-1 L, -2 },
{"y0" , y0l, 8 .0 L,
2 .235107421875 e-1 L,
1 .07472000662205273234004986203592748 E-5 L,
1 .58060461731247494255555266187483550 E-1 L, -2 },
{"y0" , y0l, 5 .33333333333333333333333333333333333 E0L,
-3 .387451171875 e-1 L,
1 .48763307492243286439161163883136261 E-5 L,
-3 .30338692743198039852173817311267913 E-2 L, -2 },
{"y0" , y0l, 4 .0 L,
-1 .69525146484375 E-2 L,
1 .17753233725080963648655528467817595 E-5 L,
-3 .97925710557100005253979972450791852 E-1 L, -2 },
{"y0" , y0l, 3 .2 L,
3 .070526123046875 E-1 L,
6 .37827715583546999256417236405953385 E-7 L,
-3 .70711338441274693924314235987044508 E-1 L, -2 },
{"y0" , y0l, 2 .66666666666666666666666666666666667 E0L,
4 .67864990234375 E-1 L,
1 .52461165366402773840048623192120982 E-5 L,
-2 .14907152209457967672108494960545800 E-1 L, -2 },
{"y0" , y0l, 2 .28571428571428571428571428571428571 E0L,
5 .18768310546875 E-1 L,
3 .23404086137065314580351322765266943 E-6 L,
-4 .51747395962233519705260050662299281 E-2 L, -2 },
{"y0" , y0l, 2 .0 L,
5 .103607177734375 E-1 L,
1 .49548763076195966065927271578732681 E-5 L,
1 .07032431540937546888370772277476637 E-1 L, -2 },
{"j1" , j1l, 16 .0 L,
9 .039306640625 e-2 L,
4 .1092550541862386833024580760244495945291 E-6 L,
-1 .8054889746246069646832022412944915898260 E-1 L, -2 },
{"j1" , j1l, 8 .0 L,
2 .346343994140625 e-1 L,
1 .9474398521243812766515904546115487521615 E-6 L,
1 .4232126378081457804320982640316517462483 E-1 L, -2 },
{"j1" , j1l, 5 .3333333333333333333333333333333330765427 E0L,
-3 .4613037109375 e-1 L,
4 .7659775265447519602414103748858036315250 E-6 L,
6 .3124658798958579773603686238379727242328 E-4 L, -2 },
{"j1" , j1l, 4 .0 L,
-6 .60552978515625 e-2 L,
1 .1969828013363856814579196724971272576580 E-5 L,
-3 .8063897785796008825079441325087928479376 E-1 L, -2 },
{"j1" , j1l, 3 .2000000000000000000000000000000001540744 E0L,
2 .613372802734375 e-1 L,
5 .9685070673373629867423599052573498655055 E-6 L,
-4 .0185793490103066896536590238515608924925 E-1 L, -2 },
{"j1" , j1l, 2 .6666666666666666666666666666666665382713 E0L,
4 .516448974609375 e-1 L,
6 .2509320502857789297328303110978154167062 E-6 L,
-2 .9693016825402088220674935499586226461144 E-1 L, -2 },
{"j1" , j1l, 2 .2857142857142857142857142857142856042326 E0L,
5 .42388916015625 e-1 L,
6 .6245894584815185457284221775341820978577 E-6 L,
-1 .7402769058145591576151108347875503008807 E-1 L, -2 },
{"j1" , j1l, 2 .0 L,
5 .7672119140625 e-1 L,
3 .6163506233872024482422691370869203026897 E-6 L,
-6 .4471624737201025549396666484619917634997 E-2 L, -2 },
{"y1" , y1l, 16 .0 L,
1 .779632568359375 e-1 L,
1 .1912103479359630601904359871915459722520 E-5 L,
8 .4687549021998849415158346880737423611524 E-2 L, -2 },
{"y1" , y1l, 8 .0 L,
-1 .580657958984375 e-1 L,
5 .3341671900057444447338125164496726559505 E-6 L,
2 .4327904710397215730926780877205580306573 E-1 L, -2 },
{"y1" , y1l, 5 .3333333333333333333333333333333330765427 E0L,
3 .302001953125 e-2 L,
1 .3849743069803985217381731126879849266308 E-5 L,
-3 .4492409134568573891858434295819796816112 E-1 L, -2 },
{"y1" , y1l, 4 .0 L,
3 .97918701171875 e-1 L,
7 .0093852250052539799724507918522711891816 E-6 L,
-1 .1642216696433999321713012755985118130829 E-1 L, -2 },
{"y1" , y1l, 3 .2000000000000000000000000000000001540744 E0L,
3 .70697021484375 e-1 L,
1 .4316956899693924314235987044537888863453 E-5 L,
1 .9120595686950474169565105767128493632383 E-1 L, -2 },
{"y1" , y1l, 2 .6666666666666666666666666666666665382713 E0L,
2 .1490478515625 e-1 L,
2 .3670532079676721084949605457501811641711 E-6 L,
3 .8729005427236490240034331925211457949310 E-1 L, -2 },
{"y1" , y1l, 2 .2857142857142857142857142857142856042326 E0L,
4 .5166015625 e-2 L,
8 .7239712233519705260050662298731987015100 E-6 L,
4 .9900759601438865416604067629675208716502 E-1 L, -2 },
{"y1" , y1l, 2 .0 L,
-1 .070404052734375 e-1 L,
7 .9737324999531116292277225233633125191018 E-6 L,
5 .6389188842021389304079197886589619161188 E-1 L, -2 },
{"jnl" , NULL, 6 .9388939039072283776476979255676269531250 E-18 L,
6 .9602982143332406209530299018670212642178 E-54 L,
2 .6551531852207537950481339962774251294400 E-59 L,
3 .0092655 e-36 L, -2 },
#if 1
{"lgamma" , lgammal, 8 .0 L, 8 .525146484375 L,
1 .4876690414300165531036347125050759667737 E-5 L,
2 .0156414779556099965363450527747404656959 E0L, 4 },
{"lgamma" , lgammal, 0 .125 L, 2 .0194091796875 E0L,
9 .1778662963453202905211670995899482809521 E-6 L,
-8 .3884926632958548678027429230863429642684 E0L, 4 },
{"lgamma" , lgammal, 0 .375 L, 8 .63067626953125 E-1 L,
6 .3553175224624050890941340154953324706293 E-6 L,
-2 .7539990491451395757640192188045680759926 E0L, 4 },
{"lgamma" , lgammal, 0 .625 L, 3 .608245849609375 E-1 L,
4 .9105280026811849576858227794878573691202 E-6 L,
-1 .4527087645765665672107816120233772668729 E0L, 4 },
{"lgamma" , lgammal, 0 .875 L, 8 .5845947265625 E-2 L,
1 .2759959709323502365583769487702269719126 E-5 L,
-8 .0401707154769538232421854974614639758707 E-1 L, 4 },
{"lgamma" , lgammal, 1 .0 L, 0 .0 L,
0 .0 L, -5 .7721566490153286060651209008240239144696 E-1 L, -4 },
{"lgamma" , lgammal, 1 .125 L, -6 .0028076171875 E-2 L,
4 .8920458354170685941567925698857217805491 E-6 L,
-3 .8849266329585486780274292308634296426837 E-1 L, 4 },
{"lgamma" , lgammal, 1 .375 L, -1 .17767333984375 E-1 L,
1 .2063243296225548637966682011495753460784 E-5 L,
-8 .7332382478472909097352552137901409325952 E-2 L, 4 },
{"lgamma" , lgammal, 1 .625 L, -1 .091766357421875 E-1 L,
2 .5019853921275340206546744374231564700714 E-6 L,
1 .4729123542343343278921838797662273312715 E-1 L, 4 },
{"lgamma" , lgammal, 1 .875 L, -4 .76837158203125 E-2 L,
1 .1030421124200356021962838137727680303452 E-5 L,
3 .3884007130944747481863859311099645955579 E-1 L, 4 },
{"lgamma" , lgammal, 2 .375 L, 2 .0068359375 E-1 L,
1 .4866627455841358885180272611091348667235 E-5 L,
6 .3994034479425436362992017513482586340132 E-1 L, 4 },
{"lgamma" , lgammal, 2 .75 L, 4 .752044677734375 E-1 L,
1 .0199141499630313102466395428861742242065 E-5 L,
8 .1890102497543259227787514194472409043081 E-1 L, 4 },
{"lgamma" , lgammal, 3 .5 L, 1 .2009735107421875 E0L,
9 .1604886724816021881450712995770238915468 E-8 L,
1 .1031566406452431872256903336679111259463 E0L, 4 },
{"lgamma" , lgammal, 4 .5 L, 2 .4537353515625 E0L,
1 .2192799422205041425034357161573318235107 E-6 L,
1 .3888709263595289015114046193821968402320 E0L, 4 },
{"lgamma" , lgammal, 5 .5 L, 3 .9578094482421875 E0L,
4 .5193765287938774008558225909985513044920 E-6 L,
1 .6110931485817511237336268416044190624542 E0L, 4 },
{"lgamma" , lgammal, 6 .5 L, 5 .6625518798828125 E0L,
1 .0179974329028522112312329543730297511212 E-5 L,
1 .7929113303999329419154450234226008806361 E0L, 4 },
{"lgamma" , lgammal, 7 .5 L, 7 .53436279296875 E0L,
1 .4437899829551583676324366857670272790220 E-6 L,
1 .9467574842460867880692911772687547267899 E0L, 4 },
{"lgamma" , lgammal, 8 .5 L, 9 .54925537109375 E0L,
1 .1886207247711737140081127222543124870800 E-5 L,
2 .0800908175794201214026245106020880601232 E0L, 4 },
{"lgamma" , lgammal, 9 .5 L, 1 .16893310546875 E1L,
2 .3661097684825694425775421725106375736779 E-6 L,
2 .1977378764029495331673303929550292365938 E0L, 4 },
{"lgamma" , lgammal, 10 .5 L, 1 .394061279296875 E1L,
1 .2426435013633161237887971849479799452805 E-5 L,
2 .3030010342976863752725935508497660786991 E0L, 4 },
{"lgamma" , lgammal, 11 .5 L, 1 .62919921875 E1L,
8 .2890672413202446037468793783460085279579 E-6 L,
2 .3982391295357816133678316460878613167943 E0L, 4 },
{"lgamma" , lgammal, 12 .5 L, 1 .8734344482421875 E1L,
3 .0295145707016341244572313978963754081384 E-6 L,
2 .4851956512749120481504403417400352298378 E0L, 4 },
{"lgamma" , lgammal, 13 .5 L, 2 .126007080078125 E1L,
5 .3554634511414184110022255966073511107125 E-6 L,
2 .5651956512749120481504403417400352298378 E0, 4 },
{"lgamma" , lgammal, -0 .5 L, 1 .2655029296875 E0L,
9 .1937971453964889457971347059238991475408 E-6 L,
3 .6489973978576520559023667001244459279636 E-2 L, 4 },
{"lgamma" , lgammal, -1 .5 L, 8 .6004638671875 E-1 L,
6 .2865773101451093268167035678732715711736 E-7 L,
7 .0315664064524318722569033366791112594630 E-1 L, 4 },
{"lgamma" , lgammal, -2 .5 L, -5 .6243896484375 E-2 L,
1 .7998670094932740546990234571587705589745 E-7 L,
1 .1031566406452431872256903336679111259463 E0L, -4 },
{"lgamma" , lgammal, -3 .5 L,-1 .30902099609375 E0L,
1 .4311100707953639284847917342554315471302 E-5 L,
1 .3888709263595289015114046193821968402320 E0L, -4 },
{"lgamma" , lgammal, 1 .0 e18L, 4 .0446531673037733888 E19L,
8 .5508840451951888057681732252156677289759 E8L,
4 .1446531673892822311823846184318555736736 E1, 4 },
#endif /* 0 */
#if 0
#define gammal tgammal /* Yuck. */
{"gamma" , gammal, 1 .0 L, 1 .0 L,
0 .0 L, -5 .772156649015328606 e-1 L, 4 },
{"gamma" , gammal, 2 .0 L, 1 .0 L,
0 .0 L, 4 .2278433509846713939 e-1 L, 4 },
{"gamma" , gammal, 3 .0 L, 2 .0 L,
0 .0 L, 1 .845568670196934279 L, 4 },
{"gamma" , gammal, 4 .0 L, 6 .0 L,
0 .0 L, 7 .536706010590802836 L, 4 },
#endif
{NULL, NULL, 0 .0 L, 0 .0 L, 0 .0 L, 1 },
};
/* These take care of extra-precise floating point register problems. */
volatile long double volat1;
volatile long double volat2;
/* Return the next nearest floating point value to X
in the direction of UPDOWN ( + 1 or - 1 ) .
(Might fail if X is denormalized.) */
long double
nextval (x, updown)
long double x;
int updown;
{
long double m;
int i;
volat1 = x;
m = 0 .25 L * MACHEPL * volat1 * updown;
volat2 = volat1 + m;
if (volat2 != volat1)
printf ("successor failed\n" );
for (i = 2 ; i < 10 ; i++)
{
volat2 = volat1 + i * m;
if (volat1 != volat2)
return volat2;
}
printf ("nextval failed\n" );
return volat1;
}
int
main ()
{
long double (*fun1) (long double );
int i, j, errs, tests, err_thresh;
long double x, x0, dy, err;
errs = 0 ;
tests = 0 ;
i = 0 ;
for (;;)
{
/* Function call reference. */
fun1 = test1[i].func;
if (test1[i].name == NULL)
break ;
/*
if ( fun1 = = NULL )
break ;
*/
/* Function argument. */
volat1 = test1[i].arg1;
/* x0 is the given argument, x scans from slightly below to above x0. */
x0 = volat1;
x = volat1;
for (j = 0 ; j <= NPTS; j++)
{
/* delta x */
volat1 = x - x0;
/* delta y */
dy = volat1 * test1[i].derivative;
/* y + delta y */
dy = test1[i].answer2 + dy;
volat1 = test1[i].answer1 + dy;
/* Run the function under test. */
if (fun1 == NULL)
{
if (! strcmp (test1[i].name, "jnl" ))
volat2 = jnl (3 , x);
else
break ;
}
else
volat2 = (*(fun1)) (x);
if (volat2 != volat1)
{
/* Estimate difference between program result
and extended precision function value. */
err = volat2 - test1[i].answer1;
err = err - dy;
/* Compare difference with reporting threshold. */
err_thresh = test1[i].thresh;
if (err_thresh >= 0 )
err = err / volat1; /* relative error */
else
{
err_thresh = -err_thresh; /* absolute error */
/* ...but relative error if function value > 1 */
if (fabsl(volat1) > 1 .0 L)
err = err / volat1;
}
if (fabsl (err) > (err_thresh * MACHEPL))
{
printf ("%d %s(%.36Le) = %.36Le, rel err = %.3Le\n" ,
j, test1[i].name, x, volat2, err);
errs += 1 ;
}
}
x = nextval (x, 1 );
tests += 1 ;
}
x = x0;
x = nextval (x, -1 );
for (j = 1 ; j < NPTS; j++)
{
volat1 = x - x0;
dy = volat1 * test1[i].derivative;
dy = test1[i].answer2 + dy;
volat1 = test1[i].answer1 + dy;
if (fun1 == NULL)
{
if (! strcmp (test1[i].name, "jnl" ))
volat2 = jnl (3 , x);
else
break ;
}
else
volat2 = (*(fun1)) (x);
if (volat2 != volat1)
{
err = volat2 - test1[i].answer1;
err = err - dy;
err_thresh = test1[i].thresh;
if (err_thresh >= 0 )
err = err / volat1; /* relative error */
else
{
err_thresh = -err_thresh;
if (fabsl(volat1) > 1 .0 L)
err = err / volat1;
}
if (fabsl (err) > (err_thresh * MACHEPL))
{
printf ("%d %s(%.36Le) = %.36Le, rel err = %.3Le\n" ,
j, test1[i].name, x, volat2, err);
errs += 1 ;
}
}
x = nextval (x, -1 );
tests += 1 ;
}
i += 1 ;
}
printf ("%d errors in %d tests\n" , errs, tests);
exit (0 );
}
Messung V0.5 in Prozent C=95 H=96 G=95
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet am 2026-06-15)
¤
*© Formatika GbR, Deutschland