📄 testvect.c
字号:
/* Test vectors for math functions. See C9X section F.9. On some systems it may be necessary to modify the default exception settings of the floating point arithmetic unit. *//*Cephes Math Library Release 2.7: May, 1998Copyright 1998 by Stephen L. Moshier*/#include <stdio.h>int isfinitel (long double);/* Some compilers will not accept these expressions. */#define ZINF 1#define ZMINF 2#define ZNANL 3#define ZPIL 4#define ZPIO2L 4extern long double INFINITYL, NANL, NEGZEROL;long double MINFL;extern long double PIL, PIO2L, PIO4L, MACHEPL;long double MPIL;long double MPIO2L;long double MPIO4L;long double THPIO4L = 2.35619449019234492884698L;long double MTHPIO4L = -2.35619449019234492884698L;long double SQRT2L = 1.414213562373095048802E0L;long double SQRTHL = 7.071067811865475244008E-1L;long double ZEROL = 0.0L;long double HALFL = 0.5L;long double MHALFL = -0.5L;long double ONEL = 1.0L;long double MONEL = -1.0L;long double TWOL = 2.0L;long double MTWOL = -2.0L;long double THREEL = 3.0L;long double MTHREEL = -3.0L;/* Functions of one variable. */long double logl (long double);long double expl (long double);long double atanl (long double);long double sinl (long double);long double cosl (long double);long double tanl (long double);long double acosl (long double);long double asinl (long double);long double acoshl (long double);long double asinhl (long double);long double atanhl (long double);long double sinhl (long double);long double coshl (long double);long double tanhl (long double);long double exp2l (long double);long double expm1l (long double);long double log10l (long double);long double log1pl (long double);long double log2l (long double);long double fabsl (long double);long double erfl (long double);long double erfcl (long double);long double gammal (long double);long double lgaml (long double);long double floorl (long double);long double ceill (long double);long double cbrtl (long double);struct oneargument { char *name; /* Name of the function. */ long double (*func) (long double); long double *arg1; long double *answer; int thresh; /* Error report threshold. */ };#if 0 {"sinl", sinl, 32767.L, 1.8750655394138942394239E-1L, 0}, {"cosl", cosl, 32767.L, 9.8226335176928229845654E-1L, 0}, {"tanl", tanl, 32767.L, 1.9089234430221485740826E-1L, 0}, {"sinl", sinl, 8388607.L, 9.9234509376961249835628E-1L, 0}, {"cosl", cosl, 8388607.L, -1.2349580912475928183718E-1L, 0}, {"tanl", tanl, 8388607.L, -8.0354556223613614748329E0L, 0}, {"sinl", sinl, 2147483647.L, -7.2491655514455639054829E-1L, 0}, {"cosl", cosl, 2147483647.L, -6.8883669187794383467976E-1L, 0}, {"tanl", tanl, 2147483647.L, 1.0523779637351339136698E0L, 0}, {"sinl", sinl, PIO4L, 7.0710678118654752440084E-1L, 0}, {"cosl", cosl, PIO2L, -2.50827880633416613471e-20L, 0},#endifstruct oneargument test1[] ={ {"atanl", atanl, &ONEL, &PIO4L, 0}, {"sinl", sinl, &PIO2L, &ONEL, 0}, {"cosl", cosl, &PIO4L, &SQRTHL, 0}, {"acosl", acosl, &NANL, &NANL, 0}, {"acosl", acosl, &ONEL, &ZEROL, 0}, {"acosl", acosl, &TWOL, &NANL, 0}, {"acosl", acosl, &MTWOL, &NANL, 0}, {"asinl", asinl, &NANL, &NANL, 0}, {"asinl", asinl, &ZEROL, &ZEROL, 0}, {"asinl", asinl, &NEGZEROL, &NEGZEROL, 0}, {"asinl", asinl, &TWOL, &NANL, 0}, {"asinl", asinl, &MTWOL, &NANL, 0}, {"atanl", atanl, &NANL, &NANL, 0}, {"atanl", atanl, &ZEROL, &ZEROL, 0}, {"atanl", atanl, &NEGZEROL, &NEGZEROL, 0}, {"atanl", atanl, &INFINITYL, &PIO2L, 0}, {"atanl", atanl, &MINFL, &MPIO2L, 0}, {"cosl", cosl, &NANL, &NANL, 0}, {"cosl", cosl, &ZEROL, &ONEL, 0}, {"cosl", cosl, &NEGZEROL, &ONEL, 0}, {"cosl", cosl, &INFINITYL, &NANL, 0}, {"cosl", cosl, &MINFL, &NANL, 0}, {"sinl", sinl, &NANL, &NANL, 0}, {"sinl", sinl, &NEGZEROL, &NEGZEROL, 0}, {"sinl", sinl, &ZEROL, &ZEROL, 0}, {"sinl", sinl, &INFINITYL, &NANL, 0}, {"sinl", sinl, &MINFL, &NANL, 0}, {"tanl", tanl, &NANL, &NANL, 0}, {"tanl", tanl, &ZEROL, &ZEROL, 0}, {"tanl", tanl, &NEGZEROL, &NEGZEROL, 0}, {"tanl", tanl, &INFINITYL, &NANL, 0}, {"tanl", tanl, &MINFL, &NANL, 0}, {"acoshl", acoshl, &NANL, &NANL, 0}, {"acoshl", acoshl, &ONEL, &ZEROL, 0}, {"acoshl", acoshl, &INFINITYL, &INFINITYL, 0}, {"acoshl", acoshl, &HALFL, &NANL, 0}, {"acoshl", acoshl, &MONEL, &NANL, 0}, {"asinhl", asinhl, &NANL, &NANL, 0}, {"asinhl", asinhl, &ZEROL, &ZEROL, 0}, {"asinhl", asinhl, &NEGZEROL, &NEGZEROL, 0}, {"asinhl", asinhl, &INFINITYL, &INFINITYL, 0}, {"asinhl", asinhl, &MINFL, &MINFL, 0}, {"atanhl", atanhl, &NANL, &NANL, 0}, {"atanhl", atanhl, &ZEROL, &ZEROL, 0}, {"atanhl", atanhl, &NEGZEROL, &NEGZEROL, 0}, {"atanhl", atanhl, &ONEL, &INFINITYL, 0}, {"atanhl", atanhl, &MONEL, &MINFL, 0}, {"atanhl", atanhl, &TWOL, &NANL, 0}, {"atanhl", atanhl, &MTWOL, &NANL, 0}, {"coshl", coshl, &NANL, &NANL, 0}, {"coshl", coshl, &ZEROL, &ONEL, 0}, {"coshl", coshl, &NEGZEROL, &ONEL, 0}, {"coshl", coshl, &INFINITYL, &INFINITYL, 0}, {"coshl", coshl, &MINFL, &INFINITYL, 0}, {"sinhl", sinhl, &NANL, &NANL, 0}, {"sinhl", sinhl, &ZEROL, &ZEROL, 0}, {"sinhl", sinhl, &NEGZEROL, &NEGZEROL, 0}, {"sinhl", sinhl, &INFINITYL, &INFINITYL, 0}, {"sinhl", sinhl, &MINFL, &MINFL, 0}, {"tanhl", tanhl, &NANL, &NANL, 0}, {"tanhl", tanhl, &ZEROL, &ZEROL, 0}, {"tanhl", tanhl, &NEGZEROL, &NEGZEROL, 0}, {"tanhl", tanhl, &INFINITYL, &ONEL, 0}, {"tanhl", tanhl, &MINFL, &MONEL, 0}, {"expl", expl, &NANL, &NANL, 0}, {"expl", expl, &ZEROL, &ONEL, 0}, {"expl", expl, &NEGZEROL, &ONEL, 0}, {"expl", expl, &INFINITYL, &INFINITYL, 0}, {"expl", expl, &MINFL, &ZEROL, 0}, {"exp2l", exp2l, &NANL, &NANL, 0}, {"exp2l", exp2l, &ZEROL, &ONEL, 0}, {"exp2l", exp2l, &NEGZEROL, &ONEL, 0}, {"exp2l", exp2l, &INFINITYL, &INFINITYL, 0}, {"exp2l", exp2l, &MINFL, &ZEROL, 0}, {"expm1l", expm1l, &NANL, &NANL, 0}, {"expm1l", expm1l, &ZEROL, &ZEROL, 0}, {"expm1l", expm1l, &NEGZEROL, &NEGZEROL, 0}, {"expm1l", expm1l, &INFINITYL, &INFINITYL, 0}, {"expm1l", expm1l, &MINFL, &MONEL, 0}, {"logl", logl, &NANL, &NANL, 0}, {"logl", logl, &ZEROL, &MINFL, 0}, {"logl", logl, &NEGZEROL, &MINFL, 0}, {"logl", logl, &ONEL, &ZEROL, 0}, {"logl", logl, &MONEL, &NANL, 0}, {"logl", logl, &INFINITYL, &INFINITYL, 0}, {"log10l", log10l, &NANL, &NANL, 0}, {"log10l", log10l, &ZEROL, &MINFL, 0}, {"log10l", log10l, &NEGZEROL, &MINFL, 0}, {"log10l", log10l, &ONEL, &ZEROL, 0}, {"log10l", log10l, &MONEL, &NANL, 0}, {"log10l", log10l, &INFINITYL, &INFINITYL, 0}, {"log1pl", log1pl, &NANL, &NANL, 0}, {"log1pl", log1pl, &ZEROL, &ZEROL, 0}, {"log1pl", log1pl, &NEGZEROL, &NEGZEROL, 0}, {"log1pl", log1pl, &MONEL, &MINFL, 0}, {"log1pl", log1pl, &MTWOL, &NANL, 0}, {"log1pl", log1pl, &INFINITYL, &INFINITYL, 0}, {"log2l", log2l, &NANL, &NANL, 0}, {"log2l", log2l, &ZEROL, &MINFL, 0}, {"log2l", log2l, &NEGZEROL, &MINFL, 0}, {"log2l", log2l, &MONEL, &NANL, 0}, {"log2l", log2l, &INFINITYL, &INFINITYL, 0}, /* {"fabsl", fabsl, &NANL, &NANL, 0}, */ {"fabsl", fabsl, &ONEL, &ONEL, 0}, {"fabsl", fabsl, &MONEL, &ONEL, 0}, {"fabsl", fabsl, &ZEROL, &ZEROL, 0}, {"fabsl", fabsl, &NEGZEROL, &ZEROL, 0}, {"fabsl", fabsl, &INFINITYL, &INFINITYL, 0}, {"fabsl", fabsl, &MINFL, &INFINITYL, 0}, {"cbrtl", cbrtl, &NANL, &NANL, 0}, {"cbrtl", cbrtl, &ZEROL, &ZEROL, 0}, {"cbrtl", cbrtl, &NEGZEROL, &NEGZEROL, 0}, {"cbrtl", cbrtl, &INFINITYL, &INFINITYL, 0}, {"cbrtl", cbrtl, &MINFL, &MINFL, 0}, {"erfl", erfl, &NANL, &NANL, 0}, {"erfl", erfl, &ZEROL, &ZEROL, 0}, {"erfl", erfl, &NEGZEROL, &NEGZEROL, 0}, {"erfl", erfl, &INFINITYL, &ONEL, 0}, {"erfl", erfl, &MINFL, &MONEL, 0}, {"erfcl", erfcl, &NANL, &NANL, 0}, {"erfcl", erfcl, &INFINITYL, &ZEROL, 0}, {"erfcl", erfcl, &MINFL, &TWOL, 0}, {"gammal", gammal, &NANL, &NANL, 0}, {"gammal", gammal, &INFINITYL, &INFINITYL, 0}, {"gammal", gammal, &MONEL, &NANL, 0}, {"gammal", gammal, &ZEROL, &NANL, 0}, {"gammal", gammal, &MINFL, &NANL, 0}, {"lgaml", lgaml, &NANL, &NANL, 0}, {"lgaml", lgaml, &INFINITYL, &INFINITYL, 0}, {"lgaml", lgaml, &MONEL, &INFINITYL, 0}, {"lgaml", lgaml, &ZEROL, &INFINITYL, 0}, {"lgaml", lgaml, &MINFL, &INFINITYL, 0}, {"ceill", ceill, &NANL, &NANL, 0}, {"ceill", ceill, &ZEROL, &ZEROL, 0}, {"ceill", ceill, &NEGZEROL, &NEGZEROL, 0}, {"ceill", ceill, &INFINITYL, &INFINITYL, 0}, {"ceill", ceill, &MINFL, &MINFL, 0}, {"floorl", floorl, &NANL, &NANL, 0}, {"floorl", floorl, &ZEROL, &ZEROL, 0}, {"floorl", floorl, &NEGZEROL, &NEGZEROL, 0}, {"floorl", floorl, &INFINITYL, &INFINITYL, 0}, {"floorl", floorl, &MINFL, &MINFL, 0}, {"null", NULL, &ZEROL, &ZEROL, 0},};/* Functions of two variables. */long double atan2l (long double, long double);long double powl (long double, long double);struct twoarguments { char *name; /* Name of the function. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -