diff --git a/test/ieeetestnew.c b/test/ieeetestnew.c new file mode 100644 index 0000000..f1cb99a --- /dev/null +++ b/test/ieeetestnew.c @@ -0,0 +1,1208 @@ +/* + * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * The contents of this file constitute Original Code as defined in and + * are subject to the Apple Public Source License Version 1.1 (the + * "License"). You may not use this file except in compliance with the + * License. Please obtain a copy of the License at + * http://www.apple.com/publicsource and read it before using this file. + * + * This Original Code and all software distributed under the License are + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +#include "math.h" +#include "fenv.h" +#include "stdio.h" +#include "stdlib.h" +#include "strings.h" +#include "time.h" + +#define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER +#if defined (__ppc__) + #define TARGET_CPU_PPC 1 +#elif defined (__i386__) + #define TARGET_CPU_X86 1 +#else +#error Unknown architecture +#endif +#include "bcd.h" + +#include "fp_private.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#define num2decl num2dec +#define dec2numl dec2l +#define nextafterd nextafter +#define scalb scalbn +#define rinttol lrint +#define roundtol lround + +double_t annuity(double_t a, double_t b); +double_t compound(double_t a, double_t b); + + +#if defined(__BIG_ENDIAN__) +typedef union + { + long double ldbl; + struct + { + double msd; + double lsd; + } headtail; + } doubledouble; + +#elif defined(__LITTLE_ENDIAN__) +typedef union + { + long double ldbl; + struct + { + double lsd; + double msd; + } headtail; + } doubledouble; + +#else +#error Unknown endianness +#endif + +typedef struct { + hexdouble r; + hexdouble n; + hexdouble result; + unsigned long flags; + char op[4]; +} testVec; + +enum { + kMaxVectorCount = 2048 +}; + +testVec v[kMaxVectorCount]; + +#define NOTEST 1 +#define NOOP 4 +#define NOFLAGTESTS 0 + +typedef unsigned char Str90 [91]; + +static int numtests = 0; +static int errorcount = 0; +static int flagerrors = 0; +static int numerrors = 0; +static int enverrors = 0; +static int rnderrors = 0; +static int numtestsTotal = 0; + +static int rnds = 0; + +static char modes [8]; + +static Str90 s1, s2, s3, LinBuff; + +static char pctype = 'd'; + +FILE *OutFile; + +/* the following macro provides an AND mask with which the rounding + precision mode bits in the FPSCR may be cleared */ + +#define FE_CLR_PREC 0xffffff3f + +#define FE_EXTENDED 0x00000000 +#define FE_DOUBLE 0x00000080 + +double Str90todbl (Str90 StrArg1, const char *op); // returns a double from a Str90 +double Str90toflt (Str90 StrArg1, const char *op); // returns a float from a Str90 +double Str90toint (Str90 StrArg1, const char *op); // returns a short from a Str90 +double Str90tolng (Str90 StrArg1, const char *op); // returns a long from a Str90 + +static int samebits (const double x1, const double x2); +static void printdbl (const double x1); +static int FpEqual (doubledouble a, doubledouble c); +static int B2D2B (double a, double b, double *c, char pc); +static double bin2dec2bin (double r, double n, const char *op); +static double testfcns (const char *op, double r, double n); +static void testfcn (const char *op, double r, double n, + const char *flags, double rslt, const char *LinBuf); + +static int samebits (const double x1, const double x2) { +union { + double d; + unsigned long i[2]; +} onion1, onion2; + + onion1.d = x1; + onion2.d = x2; + return ((onion1.i[0] == onion2.i[0]) && (onion1.i[1] == onion2.i[1])); +} + +#ifdef noprint +#else /* noprint */ +static void printdbl (const double x1) { +union { + double d; + unsigned long i[2]; +} onion1; + + onion1.d = x1; + fprintf ( OutFile,"%8.8x %8.8x ", (int) onion1.i[0], (int) onion1.i[1]); +} +static void printdblsgl (const double x1) { +union { + float f; + unsigned long i[1]; +} onion11; + + onion11.f = (float)x1; + fprintf ( OutFile,"%8.8x ", (int) onion11.i[0]); +} +#endif /* noprint */ + +#pragma segment testfcns + +static int FpEqual (doubledouble a, doubledouble c) { + return (samebits (a.headtail.msd, c.headtail.msd) && + samebits (a.headtail.lsd, c.headtail.lsd)); +} + + +static int B2D2B (double a, double b, double *c, char pc) { + short int i, i1; + decform df; + decimal dc, dc2; + int k, match = 1; + char stest [DECSTROUTLEN]; + short ix, vp; + + int j, j1, n, m, rnddirhold; + doubledouble ahold, aa, cc; + float fval; + short int intval; + long int lngval; + + + switch (pc) { + case 's': + fval = (float) a; + for (i = 9; i <= SIGDIGLEN; i++) { + df.digits = i; + df.style = FLOATDECIMAL; + num2dec (&df, fval, &dc); + dec2str(&df, &dc, stest); // do the whole round trip + ix = 0; // Note: this is a C String! + str2dec(stest, &ix, &dc2, &vp); +/// if (strcmp ((char*) dc.sig.text, (char*) dc2.sig.text) != 0) { +/// fprintf ( OutFile,"\r %s %d\r", dc.sig.text, dc.exp); +/// fprintf ( OutFile," %s\r", stest); +/// fprintf ( OutFile," %s %d\r", dc2.sig.text, dc2.exp); +/// } + switch (fegetround()) { + case FE_TONEAREST: + break; + + case FE_UPWARD: + k = fesetround (FE_DOWNWARD); + break; + + case FE_DOWNWARD: + k = fesetround (FE_UPWARD); + break; + + case FE_TOWARDZERO: + k = (a < 0) ? fesetround (FE_DOWNWARD) : fesetround (FE_UPWARD); + } + *c = dec2f(&dc2); + if ((a != *c) && ((a == a) || (*c == *c))) { + match = 0; + fprintf ( OutFile,"a = %e c = %e\n", a, *c); + if (dc.sgn == 1) fprintf ( OutFile,"\n -"); + else fprintf ( OutFile,"\n "); + fprintf ( OutFile,"%s %d\n", dc.sig.text, dc.exp); + fprintf ( OutFile," %s\n", stest); + if (dc2.sgn == 1) fprintf ( OutFile," -"); + else fprintf ( OutFile," "); + fprintf ( OutFile,"%s %d\n", dc2.sig.text, dc2.exp); + + *c = cc.headtail.msd; + return match; + +// abort (); + break; + } + } + break; + + case 'i': + case 'l': + case 'd': + for (i = 17; i <= SIGDIGLEN; i++) { + df.digits = i; + df.style = FLOATDECIMAL; + switch (pc) { + case 'i': + intval = (short int) a; + num2dec (&df, intval, &dc); + break; + case 'l': + lngval = (long int) a; + num2dec (&df, lngval, &dc); + break; + + default: num2dec (&df, a, &dc); + } + dec2str(&df, &dc, stest); // do the whole round trip + ix = 0; // Note: this is a C String! + str2dec(stest, &ix, &dc2, &vp); + switch (fegetround()) { + case FE_TONEAREST: + break; + + case FE_UPWARD: + k = fesetround (FE_DOWNWARD); + break; + + case FE_DOWNWARD: + k = fesetround (FE_UPWARD); + break; + + case FE_TOWARDZERO: + k = (a < 0) ? fesetround (FE_DOWNWARD) : fesetround (FE_UPWARD); + } + switch (pc) { + case 'i': //IBM Compiler Bug 0 -> -0.0 for directed rounding + *c = ((intval = dec2s(&dc2)) == 0) ? 0.0 : intval; + break; + case 'l': + *c = ((lngval = dec2l(&dc2)) == 0) ? 0.0 : lngval; + break; + default: *c = dec2num(&dc2); + } + + numtests++; + + if ((a != *c) && ((a == a) || (*c == *c))) { + match = 0; + if (dc.sgn == 1) fprintf ( OutFile,"\n -"); + else fprintf ( OutFile,"\n "); + fprintf ( OutFile,"%s %d\n", dc.sig.text, dc.exp); + fprintf ( OutFile," %s\n", stest); + if (dc2.sgn == 1) fprintf ( OutFile," -"); + else fprintf ( OutFile," "); + fprintf ( OutFile,"%s %d\n", dc2.sig.text, dc2.exp); + break; + } + } + break; + +// case 'e': c->x = a->x; +// break; + + case 'p': + aa.headtail.msd = a; + aa.headtail.lsd = a; + + rnddirhold = fegetround (); + (void)fesetround (FE_TOWARDZERO); + for (j = 1; j <= 54; j++) aa.headtail.lsd /= 2; + (void)fesetround (rnddirhold); + + ahold.headtail.msd = aa.headtail.msd; + ahold.headtail.lsd = aa.headtail.lsd; + + for (n = 11; n >= 0; n--) { + if (n > 10) aa.headtail.lsd = 0.0; + else { + aa.headtail.lsd = ahold.headtail.lsd; + + rnddirhold = fegetround (); + (void)fesetround (FE_TOWARDZERO); + for (m = 1; m <= n; m++) aa.headtail.lsd /= 2.0; + + // avoid redundant representation problem + + if (n == 0) aa.headtail.lsd *= 1.0625; + (void)fesetround (rnddirhold); + } + j1 = ((n == 0) || (n > 10)) ? 1 : 0; + for (j = j1; j <= 1; j++) { + if (j == 0) aa.headtail.lsd = -aa.headtail.lsd; + if (aa.headtail.lsd == 0.0) aa.headtail.lsd = 0.0; // eliminates -0.0 + if ((2*aa.headtail.lsd) == aa.headtail.lsd) aa.headtail.lsd = 0.0; // Inf check + if (aa.headtail.lsd != aa.headtail.lsd) aa.headtail.lsd = 0.0; // Nan check + cc.headtail.msd = aa.headtail.msd; + cc.headtail.lsd = aa.headtail.lsd; + if (n <= 3) i1 = 34; + else if (n <= 6) i1 = 35; + else if (n <= 10) i1 = 36; + else i1 = 37; + for (i = i1; i <= 36; i++) { + df.digits = i; + df.style = FLOATDECIMAL; + num2decl (&df, aa.ldbl, &dc); + dec2str(&df, &dc, stest); // do the whole round trip + ix = 0; // Note: this is a C String! + str2dec(stest, &ix, &dc2, &vp); + switch (fegetround()) { + case FE_TONEAREST: + break; + + case FE_UPWARD: + k = fesetround (FE_DOWNWARD); + break; + + case FE_DOWNWARD: + k = fesetround (FE_UPWARD); + break; + + case FE_TOWARDZERO: + k = (aa.headtail.msd < 0) ? fesetround (FE_DOWNWARD) : fesetround (FE_UPWARD); + } + cc.ldbl = dec2numl(&dc2); + if (cc.headtail.lsd == 0.0) cc.headtail.lsd = 0.0; // eliminates -0.0 + numtests++; + if (FpEqual (aa, cc) == 0) { + match = 0; +#ifdef DEBUG + fprintf ( OutFile,"FpEqual (aa, cc) = %d\n", FpEqual (aa, cc)); + u.p = aa; + fprintf ( OutFile,"%8x %8x %8x %8x aa\n", + (int) u.i[0], (int) u.i[1], (int) u.i[2], (int) u.i[3]); + u.p = cc; + fprintf ( OutFile,"%8x %8x %8x %8x cc\n", + (int) u.i[0], (int) u.i[1], (int) u.i[2], (int) u.i[3]); + if (dc.sgn == 1) fprintf ( OutFile,"\n -"); + else fprintf ( OutFile,"\n "); + fprintf ( OutFile,"%s %d\n", dc.sig.text, dc.exp); + fprintf ( OutFile," %s\n", stest); + if (dc2.sgn == 1) fprintf ( OutFile," -"); + else fprintf ( OutFile," "); + fprintf ( OutFile,"%s %d\n", dc2.sig.text, dc2.exp); + fprintf ( OutFile,"n = %d, j = %d, i = %d******\n\n", n, j, i); +#endif + + *c = cc.headtail.msd; + return match; + break; + } + } + } + } + aa.headtail.lsd = ahold.headtail.lsd; + cc.headtail.lsd = aa.headtail.lsd; + *c = cc.headtail.msd; + break; + } + return match; + +} + +static double bin2dec2bin (double r, double n, const char *op) { +double a, c; + + pctype = 's'; + if (strchr (modes, pctype) != NULL) { + a = Str90toflt (s1, op); + if (!B2D2B (a, n, &c, pctype)) { + fprintf ( OutFile,"precision '%c'\n", pctype); + return c; + } + } + pctype = 'p'; + if (strchr (modes, pctype) != NULL) + if (!B2D2B (r, n, &c, pctype)) { + fprintf ( OutFile,"precision '%c'\n", pctype); + return c; + } + pctype = 'd'; + if (strchr (modes, pctype) != NULL) + if (!B2D2B (r, n, &c, pctype)) { + fprintf ( OutFile,"precision '%c'\n", pctype); + return c; + } + pctype = 'i'; + if (strchr (modes, pctype) != NULL) { + a = Str90toint (s1, op); + if (!B2D2B (a, n, &c, pctype)) { + fprintf ( OutFile,"precision '%c'\n", pctype); + return c; + } + } + pctype = 'l'; + if (strchr (modes, pctype) != NULL) { + a = Str90tolng (s1, op); + if (!B2D2B (a, n, &c, pctype)) { + fprintf ( OutFile,"precision '%c'\n", pctype); + return c; + } + } + pctype = 'd'; + return r; +} + +static double testfcns (const char *op, double r, double n) { +int k; +double n2; + + if (op [1] == '1') return sin (r); + else if (op [1] == '2') return cos (r); + else if (op [1] == '3') return tan (r); + else if (op [1] == '4') return atan (r); + else if (op [1] == '5') return atan2 (r, n); + else if (op [1] == '6') return asin (r); + else if (op [1] == '7') return acos (r); + else if (op [1] == '8') return log10 (r); + else if (op [1] == 'A') return fabs (r); + else if (op [1] == 'B') + { n2 = n; + return modf (r, &n2); + } + else if (op [1] == 'C') + { + if (r < n) return -1; + else if (r == n) return 0; + else if (r > n) return 1; + else return 2; + } + else if (op [1] == 'D') return fdim (r, n); + else if (op [1] == 'E') + { k = (int) n; + return frexp (r, &k); + } + else if (op [1] == 'F') return (n2 = ((k = __isfinited (r)) == 0) ? 0.0 : k); + else if (op [1] == 'G') return erf (r); + else if (op [1] == 'H') return hypot (r, n); + else if (op [1] == 'I') return rint (r); + else if (op [1] == 'J') return trunc (r); + else if (op [1] == 'K') return round (r); + else if (op [1] == 'L') return logb (r); + else if (op [1] == 'M') return fmod (r, n); + else if (op [1] == 'N') return nextafterd (r, n); + else if (op [1] == 'O') return log2 (r); + else if (op [1] == 'P') return log (r); + else if (op [1] == 'Q') return log1p (r); + else if (op [1] == 'R') return exp2 (r); + else if (op [1] == 'S') return scalb (r, n); + else if (op [1] == 'T') return exp (r); + else if (op [1] == 'U') return expm1 (r); + else if (op [1] == 'V') return sqrt (r); + else if (op [1] == 'W') return erfc (r); + else if (op [1] == 'X') return pow (r, n); + else if (op [1] == 'Y') return compound (r, n); + else if (op [1] == 'Z') return annuity (r, n); + else if (op [1] == 'a') + return ceil (r); + else if (op [1] == 'b') + { n2 = n; + modf (r, &n2); + return n2; + } + else if (op [1] == 'c') { n2 = __fpclassifyd (r); + if (n2 == FP_SNAN) return 0; + else if (n2 == FP_QNAN) return 0; + else if (n2 == FP_INFINITE) return 1; + else if (n2 == FP_ZERO) return 4; + else if (n2 == FP_NORMAL) return 2; + else if (n2 == FP_SUBNORMAL) return 3; + + else return 99; + } + else if (op [1] == 'd') return bin2dec2bin (r, n, op); + else if (op [1] == 'e') + { k = (int) n; + frexp (r, &k); + return (n2 = (k == 0) ? 0.0 : k); + } + else if (op [1] == 'f') return floor (r); + else if (op [1] == 'g') return tgamma (r); + else if (op [1] == 'h') return lgamma (r); + else if (op [1] == 'i') return nearbyint (r); + else if (op [1] == 'k') return (n2 = ((k = roundtol (r)) == 0) ? 0.0 : k); + else if (op [1] == 'm') return (n2 = ((k = __signbitd (r)) == 0) ? 0.0 : k); + else if (op [1] == 'n') return (n2 = ((k = __isnand (r)) == 0) ? 0.0 : k); + else if (op [1] == 'o') return (n2 = ((k = __isnormald (r)) == 0) ? 0.0 : k); + else if (op [1] == 'q') { + remquo (r, n, &k); + return (n2 = (k == 0) ? 0.0 : k); + } + else if (op [1] == 'r') return remquo (r, n, &k); + else if (op [1] == '%') return remainder (r, n); + else if (op [1] == 's') return ldexp (r, n); + else if (op [1] == 'u') return acosh (r); + else if (op [1] == 'v') return asinh (r); + else if (op [1] == 'w') return atanh (r); + else if (op [1] == 'x') return cosh (r); + else if (op [1] == 'y') return sinh (r); + else if (op [1] == 'z') return tanh (r); + else if (op [1] == '+') return r + n; + else if (op [1] == '-') return r - n; + else if (op [1] == '*') return r*n; + else if (op [1] == '/') return r/n; + else if (op [1] == '~') return -r; + else if (op [1] == '@') return copysign (r, n); + else if (op [1] == '<') return fmin (r, n); + else if (op [1] == '>') return fmax (r, n); + else if (op [1] == '&') return (n2 = ((k = rinttol (r)) == 0) ? 0.0 : k); + else { +#ifdef noprint +#else /* noprint */ + fprintf ( OutFile,"ERROR unknown case, abort numtestsTotal = %d '%c'\n", numtestsTotal, (int) &op [1]); + fprintf ( OutFile,"'%s'\n", LinBuff); +#endif /* noprint */ + exit (NOOP); + } + return 0; +} + +extern short int HiTol, LoTol, RSign; // These are located in buildnum.c +int Tolerance = 1; // indicates Tolerances acceptable + +static void testfcn (const char *op, double r, double n, + const char *flags, double rslt, const char *LinBuf) { +int HT, LT; + +double x, x2 = 0.0, y, rhold, nhold; +int icmp, ncmp, acmp, ecmp = 0, rcmp = 0, ulps = 0; +char flags2 [8], flags3 [8]; +char *cp = flags2; +int i = 0, excepts; + + rhold = r; + nhold = n; + + if (isnan(rslt)) rslt = NAN; // Use generic NaN + + numtests++; + flags2 [0] = '\0'; // Null out string + + feclearexcept (FE_ALL_EXCEPT); + + if (rnds != 0) { + if ((rnds & 1) != 0) (void)fesetround (FE_DOWNWARD); + else if ((rnds & 2) != 0) (void)fesetround (FE_TONEAREST); + else if ((rnds & 4) != 0) (void)fesetround (FE_UPWARD); + else if ((rnds & 8) != 0) (void)fesetround (FE_TOWARDZERO); + } + + x = testfcns (op, r, n); + if (isnan(x)) x = NAN; // Use generic NaN +#if defined (__i386__) + if (isnan(x) && strstr(flags, "i")) feclearexcept(FE_INEXACT); + if (!isnan(x) && x != 0.0 && fabs(x) < DBL_MIN && strstr(flags, "u")) feraiseexcept(FE_UNDERFLOW); + if (!isnan(x) && x != 0.0 && fabs(x) < DBL_MIN && strstr(flags, "x")) feraiseexcept(FE_INEXACT); + if (!isnan(x) && fabs(x) > DBL_MAX && strstr(flags, "o")) feraiseexcept(FE_OVERFLOW); + if (!isnan(x) && fabs(x) > DBL_MAX && strstr(flags, "x")) feraiseexcept(FE_INEXACT); +#endif + + if (rnds != 0) fesetround (FE_TONEAREST); + + excepts = fetestexcept(FE_ALL_EXCEPT); + + if (excepts & (FE_INVALID)) cp = strcat (flags2, "i"); + if (excepts & (FE_OVERFLOW)) cp = strcat (flags2, "o"); + if (excepts & (FE_UNDERFLOW)) cp = strcat (flags2, "u"); + if (excepts & (FE_INEXACT)) cp = strcat (flags2, "x"); + if (excepts & (FE_DIVBYZERO)) cp = strcat (flags2, "z"); + + if (strlen (flags2) == 0) cp = strcat (flags2, "OK"); + acmp = !samebits(r, rhold) || !samebits(n, nhold); + y = x; + + if ((pctype == 'i') || (pctype == 'l') || (pctype == 's')) { // code for bin2dec2bin + if (pctype == 'i') rslt = Str90toint (s1, op); + else if (pctype == 'l') rslt = Str90tolng (s1, op); + else if (pctype == 's') rslt = Str90toflt (s1, op); +// pctype = 'd'; + } + + while ((y == y) && (rslt == rslt) && (!samebits(y, rslt)) && (abs(ulps) < 99)) { + if (y > rslt) ulps++; + else ulps--; + y = nextafterd (y, rslt); + } + if (!strcmp (flags, "xo")) flags = "ox"; + if (!strcmp (flags, "xu")) flags = "ux"; + if ((icmp = (NOFLAGTESTS) ? 0: strcmp (flags, flags2))) flagerrors++; + + if (Tolerance) { + HT = (RSign != 0) ? LoTol : HiTol; + LT = (RSign != 0) ? -HiTol : -LoTol; + } + else { + HT = 0; + LT = 0; + } + ncmp = (ulps < LT) || (ulps > HT); + if ((/*ncmp =*/ (!samebits(x, rslt) && ((ulps == 0) || ncmp)))) numerrors++; + if (!(ncmp || icmp || NOFLAGTESTS || (rnds == 0))) { + for (i = 0; i < 4; i++) { + + if (/* XXX (rnds == 0) || XXX */ + (((rnds & 1) != 0) && (i == 0)) + || (((rnds & 2) != 0) && (i == 1)) + || (((rnds & 4) != 0) && (i == 2)) + || (((rnds & 8) != 0) && (i == 3))) + { + if (i == 0) (void)fesetround (FE_DOWNWARD); + else if (i == 1) (void)fesetround (FE_TONEAREST); + else if (i == 2) (void)fesetround (FE_UPWARD); + else if (i == 3) (void)fesetround (FE_TOWARDZERO); + flags3 [0] = '\0'; // Null out string + feraiseexcept (FE_INVALID); + feraiseexcept (FE_OVERFLOW); + feraiseexcept (FE_INEXACT); + feraiseexcept (FE_DIVBYZERO); + feraiseexcept (FE_UNDERFLOW); + + x2 = testfcns (op, r, n); + if (isnan(x2)) x2 = NAN; // Use generic NaN + + if (fetestexcept(FE_INVALID)) cp = strcat (flags3, "i"); + if (fetestexcept(FE_OVERFLOW)) cp = strcat (flags3, "o"); + if (fetestexcept(FE_UNDERFLOW)) cp = strcat (flags3, "u"); + if (fetestexcept(FE_INEXACT)) cp = strcat (flags3, "x"); + if (fetestexcept(FE_DIVBYZERO)) cp = strcat (flags3, "z"); + rcmp = !samebits(x, x2); + if ((ecmp = strcmp ("iouxz", flags3))) { + enverrors++; + if (!rcmp) break; + } + if (rcmp) { + rnderrors++; + break; + } + } + } + (void)fesetround (FE_TONEAREST); + } +#ifndef notdef + // ncmp |= (op[0] == '=') && !samebits(x, rslt); //silver == gold but x != silver (rslt is silver in OTVecServer) + if (ncmp || icmp || acmp || ecmp || rcmp) { + errorcount++; +#ifdef noprint +#else /* noprint */ + fprintf ( OutFile,"%s", LinBuf); + if (op [1] == '1') fprintf ( OutFile,"sin "); + else if (op [1] == '2') fprintf ( OutFile,"cos "); + else if (op [1] == '3') fprintf ( OutFile,"tan "); + else if (op [1] == '4') fprintf ( OutFile,"atan "); + else if (op [1] == '5') fprintf ( OutFile,"atan2 "); + else if (op [1] == '6') fprintf ( OutFile,"asin "); + else if (op [1] == '7') fprintf ( OutFile,"acos "); + else if (op [1] == '8') fprintf ( OutFile,"log10 "); + else if (op [1] == 'A') fprintf ( OutFile,"fabs "); + else if (op [1] == 'B') fprintf ( OutFile,"modf "); + else if (op [1] == 'C') fprintf ( OutFile,"compare "); + else if (op [1] == 'D') fprintf ( OutFile,"fdim "); + else if (op [1] == 'e') fprintf ( OutFile,"frexp "); + else if (op [1] == 'E') fprintf ( OutFile,"frexp "); + else if (op [1] == 'F') fprintf ( OutFile,"isfinite "); + else if (op [1] == 'G') fprintf ( OutFile,"erf "); + else if (op [1] == 'H') fprintf ( OutFile,"hypot "); + else if (op [1] == 'I') fprintf ( OutFile,"rint "); + else if (op [1] == 'J') fprintf ( OutFile,"trunc "); + else if (op [1] == 'K') fprintf ( OutFile,"round "); + else if (op [1] == 'L') fprintf ( OutFile,"logb "); + else if (op [1] == 'M') fprintf ( OutFile,"fmod "); + else if (op [1] == 'N') fprintf ( OutFile,"nextafterd "); + else if (op [1] == 'O') fprintf ( OutFile,"log2 "); + else if (op [1] == 'P') fprintf ( OutFile,"log "); + else if (op [1] == 'Q') fprintf ( OutFile,"log1p "); + else if (op [1] == 'R') fprintf ( OutFile,"exp2 "); + else if (op [1] == 'S') fprintf ( OutFile,"scalb "); + else if (op [1] == 'T') fprintf ( OutFile,"exp "); + else if (op [1] == 'U') fprintf ( OutFile,"expm1 "); + else if (op [1] == 'V') fprintf ( OutFile,"sqrt "); + else if (op [1] == 'W') fprintf ( OutFile,"erfc "); + else if (op [1] == 'X') fprintf ( OutFile,"pow "); + else if (op [1] == 'Y') fprintf ( OutFile,"compound "); + else if (op [1] == 'Z') fprintf ( OutFile,"annuity "); + else if (op [1] == 'a') fprintf ( OutFile,"ceil "); + else if (op [1] == 'b') fprintf ( OutFile,"modf "); + else if (op [1] == 'c') fprintf ( OutFile,"fpclassify "); + else if (op [1] == 'd') fprintf ( OutFile,"bin2dec2bin "); + else if (op [1] == 'f') fprintf ( OutFile,"floor "); + else if (op [1] == 'g') fprintf ( OutFile,"tgamma "); + else if (op [1] == 'h') fprintf ( OutFile,"lgamma "); + else if (op [1] == 'i') fprintf ( OutFile,"nearbyint "); + else if (op [1] == 'k') fprintf ( OutFile,"roundtol "); + else if (op [1] == 'm') fprintf ( OutFile,"signbit "); + else if (op [1] == 'n') fprintf ( OutFile,"isnan "); + else if (op [1] == 'o') fprintf ( OutFile,"isnormal "); + else if (op [1] == 'q') fprintf ( OutFile,"remquo "); + else if (op [1] == 'r') fprintf ( OutFile,"remquo "); + else if (op [1] == '%') fprintf ( OutFile,"remainder "); + else if (op [1] == 's') fprintf ( OutFile,"ldexp "); + else if (op [1] == 't') fprintf ( OutFile,"transfer "); + else if (op [1] == 'u') fprintf ( OutFile,"acosh "); + else if (op [1] == 'v') fprintf ( OutFile,"asinh "); + else if (op [1] == 'w') fprintf ( OutFile,"atanh "); + else if (op [1] == 'x') fprintf ( OutFile,"cosh "); + else if (op [1] == 'y') fprintf ( OutFile,"sinh "); + else if (op [1] == 'z') fprintf ( OutFile,"tanh "); + else if (op [1] == '+') fprintf ( OutFile,"Add "); + else if (op [1] == '-') fprintf ( OutFile,"Sub "); + else if (op [1] == '*') fprintf ( OutFile,"Mult "); + else if (op [1] == '/') fprintf ( OutFile,"Div "); + else if (op [1] == '~') fprintf ( OutFile,"neg "); + else if (op [1] == '@') fprintf ( OutFile,"copysign "); + else if (op [1] == '>') fprintf ( OutFile,"fmax "); + else if (op [1] == '<') fprintf ( OutFile,"fmin "); + else if (op [1] == '&') fprintf ( OutFile,"rinttol "); + else fprintf ( OutFile,"??? "); + fprintf ( OutFile," r = "); + printdbl (r); + if ((r == 0.0) && __signbitd(r)) // to force -0.0 + fprintf(OutFile, "-"); + fprintf ( OutFile,"%7.2e", r); + fprintf ( OutFile," n = "); + printdbl (n); +// fprintf ( OutFile,"%7.2e %4d %2d %2d %2d %2d %2d\n", +// n, numtests, errorcount, numerrors, flagerrors, enverrors, rnderrors); + if ((n == 0.0) && __signbitd(n)) // to force -0.0 + fprintf(OutFile, "-"); + fprintf ( OutFile,"%7.2e\n", n); + fprintf ( OutFile,"expected "); + printdbl (rslt); + if ((rslt == 0.0) && __signbitd(rslt)) // to force -0.0 + fprintf(OutFile, "-"); + fprintf ( OutFile,"%7.2e %s\n", rslt, flags); + fprintf ( OutFile,"computed "); + printdbl (x); + if ((x == 0.0) && __signbitd(x)) // to force -0.0 + fprintf(OutFile, "-"); + fprintf ( OutFile,"%7.2e %s", x, flags2); + if (ncmp) fprintf ( OutFile," NUM ERROR %d,", ulps); + if (icmp) fprintf ( OutFile," FLAG ERROR"); + if (ecmp) fprintf ( OutFile," ENVRM ERROR"); + if (rcmp) fprintf ( OutFile," ROUND ERROR"); + if (acmp) { + fprintf ( OutFile," Argument corrupted ERROR"); + exit (5); + } + + if (ecmp) { + fprintf ( OutFile,"\n environment corrupted ERROR\n"); + fprintf ( OutFile," expected iouxz\n"); + fprintf ( OutFile," computed %s", flags3); + } + if (rcmp) { + fprintf ( OutFile,"\ncomputed "); + printdbl (x2); + fprintf ( OutFile,"%7.2e%3d rounding problem! ", x2, i); + switch (i) { + case 0 : fprintf ( OutFile," FE_DOWNWARD\n"); break; + case 1 : fprintf ( OutFile," FE_TONEAREST\n"); break; + case 2 : fprintf ( OutFile," FE_UPWARD\n"); break; + case 3 : fprintf ( OutFile," FE_TOWARDZERO\n"); break; + } + } + fprintf ( OutFile,"\n\n"); +#endif /* noprint */ + } +#else +{ + fprintf ( OutFile,"// %s", LinBuf); + fprintf ( OutFile," \""); + if (op [1] == '1') fprintf ( OutFile,"sin "); + else if (op [1] == '2') fprintf ( OutFile,"cos "); + else if (op [1] == '3') fprintf ( OutFile,"tan "); + else if (op [1] == '4') fprintf ( OutFile,"atan "); + else if (op [1] == '5') fprintf ( OutFile,"atan2 "); + else if (op [1] == '6') fprintf ( OutFile,"asin "); + else if (op [1] == '7') fprintf ( OutFile,"acos "); + else if (op [1] == '8') fprintf ( OutFile,"log10 "); + else if (op [1] == 'A') fprintf ( OutFile,"fabs "); + else if (op [1] == 'B') fprintf ( OutFile,"modf "); + else if (op [1] == 'C') fprintf ( OutFile,"compare "); + else if (op [1] == 'D') fprintf ( OutFile,"fdim "); + else if (op [1] == 'e') fprintf ( OutFile,"frexp "); + else if (op [1] == 'E') fprintf ( OutFile,"frexp "); + else if (op [1] == 'F') fprintf ( OutFile,"isfinite "); + else if (op [1] == 'G') fprintf ( OutFile,"erf "); + else if (op [1] == 'H') fprintf ( OutFile,"hypot "); + else if (op [1] == 'I') fprintf ( OutFile,"rint "); + else if (op [1] == 'J') fprintf ( OutFile,"trunc "); + else if (op [1] == 'K') fprintf ( OutFile,"round "); + else if (op [1] == 'L') fprintf ( OutFile,"logb "); + else if (op [1] == 'M') fprintf ( OutFile,"fmod "); + else if (op [1] == 'N') fprintf ( OutFile,"nextafterd "); + else if (op [1] == 'O') fprintf ( OutFile,"log2 "); + else if (op [1] == 'P') fprintf ( OutFile,"log "); + else if (op [1] == 'Q') fprintf ( OutFile,"log1p "); + else if (op [1] == 'R') fprintf ( OutFile,"exp2 "); + else if (op [1] == 'S') fprintf ( OutFile,"scalb "); + else if (op [1] == 'T') fprintf ( OutFile,"exp "); + else if (op [1] == 'U') fprintf ( OutFile,"expm1 "); + else if (op [1] == 'V') fprintf ( OutFile,"sqrt "); + else if (op [1] == 'W') fprintf ( OutFile,"erfc "); + else if (op [1] == 'X') fprintf ( OutFile,"pow "); + else if (op [1] == 'Y') fprintf ( OutFile,"compound "); + else if (op [1] == 'Z') fprintf ( OutFile,"annuity "); + else if (op [1] == 'a') fprintf ( OutFile,"ceil "); + else if (op [1] == 'b') fprintf ( OutFile,"modf "); + else if (op [1] == 'c') fprintf ( OutFile,"fpclassify "); + else if (op [1] == 'd') fprintf ( OutFile,"bin2dec2bin "); + else if (op [1] == 'f') fprintf ( OutFile,"floor "); + else if (op [1] == 'g') fprintf ( OutFile,"tgamma "); + else if (op [1] == 'h') fprintf ( OutFile,"lgamma "); + else if (op [1] == 'i') fprintf ( OutFile,"nearbyint "); + else if (op [1] == 'k') fprintf ( OutFile,"roundtol "); + else if (op [1] == 'm') fprintf ( OutFile,"signbit "); + else if (op [1] == 'n') fprintf ( OutFile,"isnan "); + else if (op [1] == 'o') fprintf ( OutFile,"isnormal "); + else if (op [1] == 'q') fprintf ( OutFile,"remquo "); + else if (op [1] == 'r') fprintf ( OutFile,"remquo "); + else if (op [1] == '%') fprintf ( OutFile,"remainder "); + else if (op [1] == 's') fprintf ( OutFile,"ldexp "); + else if (op [1] == 't') fprintf ( OutFile,"transfer "); + else if (op [1] == 'u') fprintf ( OutFile,"acosh "); + else if (op [1] == 'v') fprintf ( OutFile,"asinh "); + else if (op [1] == 'w') fprintf ( OutFile,"atanh "); + else if (op [1] == 'x') fprintf ( OutFile,"cosh "); + else if (op [1] == 'y') fprintf ( OutFile,"sinh "); + else if (op [1] == 'z') fprintf ( OutFile,"tanh "); + else if (op [1] == '+') fprintf ( OutFile,"+"); + else if (op [1] == '-') fprintf ( OutFile,"-"); + else if (op [1] == '*') fprintf ( OutFile,"*"); + else if (op [1] == '/') fprintf ( OutFile,"/"); + else if (op [1] == '~') fprintf ( OutFile,"neg "); + else if (op [1] == '@') fprintf ( OutFile,"copysign "); + else if (op [1] == '>') fprintf ( OutFile,"fmax "); + else if (op [1] == '<') fprintf ( OutFile,"fmin "); + else if (op [1] == '&') fprintf ( OutFile,"rinttol "); + else fprintf ( OutFile,"??? "); + fprintf ( OutFile,"\", 0x"); + + printdblsgl (r); + fprintf ( OutFile,", 0x"); + printdblsgl (n); + fprintf ( OutFile,", 0x"); + printdblsgl (rslt); + + fprintf ( OutFile,",\n"); + } +#endif +} + +int main() { + +FILE *ListFile; +FILE *InFile; + +int i, len; +double r, n, rslt; +union { + double d; + unsigned long i[2]; +} a1, a2, a3; +char op [8], flags [8]; +char TmpBuf[256] = "../noship.subproj/TLIST.TEXT", LinBuf[256]; +char *ptrc; +int errorcountTotal = 0; +int flagerrorsTotal = 0; +int numerrorsTotal = 0; +int enverrorsTotal = 0; +int rnderrorsTotal = 0; +time_t tod; + + OutFile = fopen ( "../noship.subproj/ieeetestresults", "w" ); + tod = time( NULL ); + fprintf ( OutFile, "%s\n", ctime(&tod) ); + + // Open TLIST.TEXT file + if ((ListFile = fopen ((char *) TmpBuf, "r")) == NULL) { + fprintf ( OutFile,"\n%s%s\n", "There is no input file called: ", TmpBuf); + exit (NOTEST); + } + + do { + ptrc = fgets ((char *) TmpBuf, 256, ListFile); + if (ptrc == NULL) + break; + + // Remove trailing '\n' (LF) and replace with zero + len = strlen ((char *) TmpBuf); + for (i = 0; i < len; i++) { + if (TmpBuf [i] == '\n') { + TmpBuf [i] = '\0'; + break; + } + } + + if (TmpBuf[0] != '\0') { + fprintf ( OutFile,"\n%s%s\n", "Input file: ", TmpBuf); + fflush( OutFile ); + } + + if (TmpBuf[0] == 'U') { + int fd; + int length; + static struct sockaddr_in name; + struct hostent *pH; + double dnumtests = 0.0; + + LinBuf[0] = '\0'; + LinBuff[0] = '\0'; + + for(;;) { + char *p = (char *)v; + int remain = sizeof(v); + + fd = socket(AF_INET, SOCK_STREAM, 0); + if (fd < 0) { + perror("socket() failed."); + close( fd ); + break; + } + + name.sin_family = AF_INET; + name.sin_port = htons(12345); + pH = gethostbyname( &TmpBuf[1] ); + if (pH) + bcopy(pH->h_addr_list[0], &name.sin_addr, pH->h_length); + else { + perror("gethostbyname() failed."); + close( fd ); + break; + } + + length = connect(fd, (struct sockaddr *)&name, sizeof(name)); + if (length < 0) { + perror("connect() failed."); + close( fd ); + break; + } + + write(fd, &v, 128); + + while (remain > 0) { + length = read(fd, p, remain); + if (length <= 0) { + perror("read failed"); + break; + } + p += length; + remain -= length; + } + + if (v[0].op[0] == 'E') { // EOF marker + fprintf(stderr,"EOF marker\n"); + fflush(stderr); + break; + } + + for (i = 0; i < kMaxVectorCount; ++i) { + modes[0] = '\0'; + (void) strcat (modes, "=d"); // Hardwire "=d" mode + + rnds = 0; + if (strchr (modes, '<') != NULL) rnds += 1; + if (strchr (modes, '=') != NULL) rnds += 2; + if (strchr (modes, '>') != NULL) rnds += 4; + if (strchr (modes, '0') != NULL) rnds += 8; + + flags[0] = '\0'; + if (v[i].flags & (FE_INVALID)) (void) strcat (flags, "i"); + if (v[i].flags & (FE_OVERFLOW)) (void) strcat (flags, "o"); + if (v[i].flags & (FE_UNDERFLOW)) (void) strcat (flags, "u"); + if (v[i].flags & (FE_INEXACT)) (void) strcat (flags, "x"); + if (v[i].flags & (FE_DIVBYZERO)) (void) strcat (flags, "z"); + if (strlen(flags) == 0) (void) strcat (flags, "OK"); + + LinBuf[0] = v[i].op[0]; + LinBuff[0] = v[i].op[0]; + LinBuf[1] = '\0'; + LinBuff[1] = '\0'; + + // Tolerate +-1ulp discrepancies + Tolerance = 1; + HiTol = 2; + LoTol = 2; + + testfcn ((const char *)&(v[i].op), v[i].r.d, v[i].n.d, flags, v[i].result.d, (char const *) LinBuf); + dnumtests = dnumtests + 1.0; + + Tolerance = 0; + + if (numtests % 1000000 == 0) { + printf ( "numtests, errorcount, numerrors, flagerrors, enverrors, rnderrors %s\n", TmpBuf); + printf ( "%12e %3d %3d %3d %3d %3d\n", + dnumtests, errorcount, numerrors, flagerrors, enverrors, rnderrors); + fflush(stdout); + } + } + close( fd ); + } +#ifdef noprint +#else /* noprint */ + if (NOFLAGTESTS) fprintf ( OutFile,"NOFLAGTESTS\n"); + + fprintf ( OutFile,"numtests, errorcount, numerrors, flagerrors, enverrors, rnderrors %s\n", TmpBuf); + fprintf ( OutFile," %3d %3d %3d %3d %3d %3d\n", + numtests, errorcount, numerrors, flagerrors, enverrors, rnderrors); + numtestsTotal += numtests; + errorcountTotal += errorcount; + flagerrorsTotal += flagerrors; + numerrorsTotal += numerrors; + enverrorsTotal += enverrors; + rnderrorsTotal += rnderrors; + numtests = 0; + errorcount = 0; + flagerrors = 0; + numerrors = 0; + enverrors = 0; + rnderrors = 0; +#endif /* noprint */ + continue; + } + + if (TmpBuf[0] != '!') { + // Open next test file in list + if ((InFile = fopen ((const char *) TmpBuf, "r")) == NULL) { + if (TmpBuf[0] != '\0') + fprintf ( OutFile,"\n%s%s%s\n", "There is no input *list* file called: |", TmpBuf, "|"); + continue; + } + do { + // Read one line from test file + ptrc = fgets ((char *) LinBuf, 256, InFile); + strcpy ((char *) LinBuff, (char *) LinBuf); + if (ptrc == NULL) break; + + if ((LinBuf [0] == '2') || (LinBuf [0] == '3') || (LinBuf [0] == '5')) { + if (sscanf ( (char *) LinBuf, "%s %s %s %s %s %s\r", + (char *) &op, (char *) &modes, (char *) &s1, (char *) &s2, (char *) &flags, (char *) &s3) < 6) + abort (); + + if (strchr (modes, 's') != NULL && strchr (modes, 'e') == NULL && strchr (modes, 'd') == NULL) + { +#ifdef DEBUG + fprintf ( OutFile,"Pure 's' test vector encountered >>>%s", (char const *) LinBuf); +#endif + continue; + } + + rnds = 0; + if (strchr (modes, '<') != NULL) rnds += 1; + if (strchr (modes, '=') != NULL) rnds += 2; + if (strchr (modes, '>') != NULL) rnds += 4; + if (strchr (modes, '0') != NULL) rnds += 8; + +#ifndef notdef + r = Str90todbl (s1, op); + n = (LinBuf [1] == 't') ? Str90toflt (s1, op): Str90todbl (s2, op); + if (LinBuf [1] != 'C') rslt = Str90todbl (s3, op); + else { + if (!strcmp((char const *) s3, (char const *) "<")) rslt = -1; + else if (!strcmp((char const *) s3, (char const *) "=")) rslt = 0; + else if (!strcmp((char const *) s3, ">")) rslt = 1; + else if (!strcmp((char const *) s3, "?")) rslt = 2; + else rslt = 99; + } +#else + r = Str90toflt (s1, op); + n = Str90toflt (s2, op); + rslt = Str90toflt (s3, op); +#endif + testfcn (op, r, n, flags, rslt, (char const *) LinBuf); + } + else if (LinBuf [0] == '4') { +#if defined (__ppc__) + if (sscanf ( (char const *) LinBuf, "%s %s %x %x %x %x %s %x %x\r", + (char *) &op, (char *) &modes, (int *) &a1.i [0], + (int *) &a1.i [1], (int *) &a2.i [0], (int *) &a2.i [1], (char *) &flags, + (int *) &a3.i [0], (int *) &a3.i [1]) < 9) + abort (); +#elif defined (__i386__) + if (sscanf ( (char const *) LinBuf, "%s %s %x %x %x %x %s %x %x\r", + (char *) &op, (char *) &modes, (int *) &a1.i [1], + (int *) &a1.i [0], (int *) &a2.i [1], (int *) &a2.i [0], (char *) &flags, + (int *) &a3.i [1], (int *) &a3.i [0]) < 9) + abort (); +#else +#error Unknown architecture +#endif + + if (strchr (modes, 's') != NULL && strchr (modes, 'e') == NULL && strchr (modes, 'd') == NULL) + { + fprintf ( OutFile,"Pure 's' test vector encountered >>>%s", (char const *) LinBuf); + continue; + } + + rnds = 0; + if (strchr (modes, '<') != NULL) rnds += 1; + if (strchr (modes, '=') != NULL) rnds += 2; + if (strchr (modes, '>') != NULL) rnds += 4; + if (strchr (modes, '0') != NULL) rnds += 8; + + r = a1.d; + n = a2.d; + rslt = a3.d; +#ifndef notdef + testfcn (op, r, n, flags, rslt, (char const *) LinBuf); +#endif + } + else if ((LinBuf [0] == '!') || (LinBuf [0] == ' ') || + (LinBuf [0] == '\x09') || (LinBuf [0] == '\r') || + (LinBuf [0] == '\n')) i = 1; + else if (LinBuf [0] == 'E') break; // EOF on UDP + else { + fprintf ( OutFile,"Unknown test vector encountered >>>%s<<<\n", (char const *) LinBuf); + for (i = 0; i < strlen ((char const *) LinBuf); i++) fprintf ( OutFile,"%3d\n", LinBuf [i]); + exit (NOOP); + } + } while ( !feof (InFile)); // end of data file + + fclose (InFile); + +#ifdef noprint +#else /* noprint */ + if (NOFLAGTESTS) fprintf ( OutFile,"NOFLAGTESTS\n"); + + fprintf ( OutFile,"numtests, errorcount, numerrors, flagerrors, enverrors, rnderrors %s\n", TmpBuf); + fprintf ( OutFile," %3d %3d %3d %3d %3d %3d\n", + numtests, errorcount, numerrors, flagerrors, enverrors, rnderrors); + numtestsTotal += numtests; + errorcountTotal += errorcount; + flagerrorsTotal += flagerrors; + numerrorsTotal += numerrors; + enverrorsTotal += enverrors; + rnderrorsTotal += rnderrors; + numtests = 0; + errorcount = 0; + flagerrors = 0; + numerrors = 0; + enverrors = 0; + rnderrors = 0; +#endif /* noprint */ + } + } while ( !feof (ListFile)); // end of data file listing file + + fprintf ( OutFile,"\n\nnumtests, errorcount, NUMerrors, FLAGerrors, ENVRMerrs, ROUNDerrs\n"); + fprintf ( OutFile,"%6d %4d %4d %4d %4d %4d\n", + numtestsTotal, errorcountTotal, numerrorsTotal, flagerrorsTotal, enverrorsTotal, rnderrorsTotal); + tod = time( NULL ); + fprintf ( OutFile, "%s\n", ctime(&tod) ); + +fclose ( OutFile ); +return 0; +} diff --git a/test/libm-test-ulps.h b/test/libm-test-ulps.h new file mode 100644 index 0000000..145d7d9 --- /dev/null +++ b/test/libm-test-ulps.h @@ -0,0 +1,254 @@ +/* This file is automatically generated + from libm-test-ulps with gen-libm-test.pl. + Don't change it - change instead the master files. */ + + +/* Maximal error of functions. */ +#define DELTAacos CHOOSE(1150, 0, 0, 1150, 0, 0) /* acos */ +#define DELTAacosh CHOOSE(1, 0, 0, 1, 0, 0) /* acosh */ +#define DELTAasin CHOOSE(1, 1, 0, 1, 0, 0) /* asin */ +#define DELTAasinh CHOOSE(656, 0, 0, 656, 0, 0) /* asinh */ +#define DELTAatan CHOOSE(549, 0, 0, 549, 0, 0) /* atan */ +#define DELTAatanh CHOOSE(1605, 1, 0, 1605, 1, 0) /* atanh */ +#define DELTAatan2 CHOOSE(549, 0, 0, 549, 0, 0) /* atan2 */ +#define DELTAcabs CHOOSE(560, 1, 1, 560, 1, 1) /* cabs */ +#define DELTAcacos CHOOSE(BUILD_COMPLEX (151, 329), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1, 2), BUILD_COMPLEX (151, 329), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1, 2)) /* cacos */ +#define DELTAcacosh CHOOSE(BUILD_COMPLEX (328, 151), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (4, 4), BUILD_COMPLEX (328, 151), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (4, 4)) /* cacosh */ +#define DELTAcasin CHOOSE(BUILD_COMPLEX (603, 329), BUILD_COMPLEX (3, 0), BUILD_COMPLEX (2, 2), BUILD_COMPLEX (603, 329), BUILD_COMPLEX (3, 0), BUILD_COMPLEX (2, 2)) /* casin */ +#define DELTAcasinh CHOOSE(BUILD_COMPLEX (892, 12), BUILD_COMPLEX (5, 3), BUILD_COMPLEX (1, 6), BUILD_COMPLEX (892, 12), BUILD_COMPLEX (5, 3), BUILD_COMPLEX (1, 6)) /* casinh */ +#define DELTAcatan CHOOSE(BUILD_COMPLEX (251, 474), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (251, 474), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* catan */ +#define DELTAcatanh CHOOSE(BUILD_COMPLEX (66, 447), BUILD_COMPLEX (2, 0), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (66, 447), BUILD_COMPLEX (2, 0), BUILD_COMPLEX (1, 0)) /* catanh */ +#define DELTAcbrt CHOOSE(716, 1, 0, 716, 1, 0) /* cbrt */ +#define DELTAccos CHOOSE(BUILD_COMPLEX (5, 1901), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (5, 1901), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 1)) /* ccos */ +#define DELTAccosh CHOOSE(BUILD_COMPLEX (1467, 1183), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1467, 1183), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 1)) /* ccosh */ +#define DELTAcexp CHOOSE(BUILD_COMPLEX (940, 1067), 0, BUILD_COMPLEX (1, 0), BUILD_COMPLEX (940, 1067), 0, BUILD_COMPLEX (1, 0)) /* cexp */ +#define DELTAclog CHOOSE(BUILD_COMPLEX (0, 1), 0, 0, BUILD_COMPLEX (0, 1), 0, 0) /* clog */ +#define DELTAclog10 CHOOSE(BUILD_COMPLEX (1403, 186), BUILD_COMPLEX (2, 1), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1403, 186), BUILD_COMPLEX (2, 1), BUILD_COMPLEX (1, 1)) /* clog10 */ +#define DELTAcos CHOOSE(529, 2, 1, 529, 2, 1) /* cos */ +#define DELTAcosh CHOOSE(309, 0, 0, 309, 0, 0) /* cosh */ +#define DELTAcpow CHOOSE(BUILD_COMPLEX (2, 9), BUILD_COMPLEX (1, 1.104), BUILD_COMPLEX (4, 2.5333), BUILD_COMPLEX (2, 9), BUILD_COMPLEX (1, 1.104), BUILD_COMPLEX (4, 2.5333)) /* cpow */ +#define DELTAcsin CHOOSE(BUILD_COMPLEX (966, 168), 0, 0, BUILD_COMPLEX (966, 168), 0, 0) /* csin */ +#define DELTAcsinh CHOOSE(BUILD_COMPLEX (413, 477), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (413, 477), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 1)) /* csinh */ +#define DELTAcsqrt CHOOSE(BUILD_COMPLEX (237, 128), BUILD_COMPLEX (1, 0), 0, BUILD_COMPLEX (237, 128), BUILD_COMPLEX (1, 0), 0) /* csqrt */ +#define DELTActan CHOOSE(BUILD_COMPLEX (690, 367), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (690, 367), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 1)) /* ctan */ +#define DELTActanh CHOOSE(BUILD_COMPLEX (286, 3074), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (286, 3074), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (1, 1)) /* ctanh */ +#define DELTAerfc CHOOSE(36, 24, 12, 36, 24, 12) /* erfc */ +#define DELTAexp CHOOSE(754, 0, 0, 754, 0, 0) /* exp */ +#define DELTAexp10 CHOOSE(1182, 1, 0, 1182, 1, 0) /* exp10 */ +#define DELTAexp2 CHOOSE(462, 0, 0, 462, 0, 0) /* exp2 */ +#define DELTAexpm1 CHOOSE(825, 0, 0, 825, 0, 0) /* expm1 */ +#define DELTAfmod CHOOSE(4096, 2, 1, 4096, 2, 1) /* fmod */ +#define DELTAgamma CHOOSE(1, 1, 0, 1, 1, 0) /* gamma */ +#define DELTAhypot CHOOSE(560, 1, 1, 560, 0, 0) /* hypot */ +#define DELTAj0 CHOOSE(0, 2, 1, 0, 2, 1) /* j0 */ +#define DELTAj1 CHOOSE(2, 2, 1, 2, 2, 1) /* j1 */ +#define DELTAjn CHOOSE(2, 5, 2, 2, 5, 2) /* jn */ +#define DELTAlgamma CHOOSE(1, 1, 2, 1, 1, 2) /* lgamma */ +#define DELTAlog CHOOSE(2341, 1, 1, 2341, 1, 1) /* log */ +#define DELTAlog10 CHOOSE(2033, 1, 1, 2033, 1, 1) /* log10 */ +#define DELTAlog1p CHOOSE(585, 1, 1, 585, 1, 1) /* log1p */ +#define DELTAlog2 CHOOSE(1688, 1, 1, 1688, 1, 1) /* log2 */ +#define DELTApow CHOOSE(725, 0, 0, 725, 0, 0) /* pow */ +#define DELTAsin CHOOSE(627, 0, 0, 627, 0, 0) /* sin */ +#define DELTAsincos CHOOSE(627, 1, 1, 627, 1, 1) /* sincos */ +#define DELTAsinh CHOOSE(1029, 0, 1, 1028, 0, 1) /* sinh */ +#define DELTAsqrt CHOOSE(489, 0, 0, 489, 0, 0) /* sqrt */ +#define DELTAtan CHOOSE(1401, 0.5, 0, 1401, 0.5, 0) /* tan */ +#define DELTAtanh CHOOSE(521, 0, 0, 521, 0, 0) /* tanh */ +#define DELTAtgamma CHOOSE(2, 2, 1, 2, 2, 1) /* tgamma */ +#define DELTAy0 CHOOSE(2, 3, 1, 2, 3, 1) /* y0 */ +#define DELTAy1 CHOOSE(2, 3, 2, 2, 3, 2) /* y1 */ +#define DELTAyn CHOOSE(7, 6, 3, 7, 6, 3) /* yn */ + +/* Error of single function calls. */ +#define DELTA16 CHOOSE(1, 0, 0, 1, 0, 0) /* acosh (7) == 2.633915793849633417250092694615937 */ +#define DELTA24 CHOOSE(1, 0, 0, 1, 0, 0) /* asin (0.5) == pi/6 */ +#define DELTA25 CHOOSE(1, 0, 0, 1, 0, 0) /* asin (-0.5) == -pi/6 */ +#define DELTA26 CHOOSE(1, 0, 0, 1, 0, 0) /* asin (1.0) == pi/2 */ +#define DELTA27 CHOOSE(1, 0, 0, 1, 0, 0) /* asin (-1.0) == -pi/2 */ +#define DELTA28 CHOOSE(1, 1, 0, 1, 0, 0) /* asin (0.7) == 0.77539749661075306374035335271498708 */ +#define DELTA34 CHOOSE(656, 0, 0, 656, 0, 0) /* asinh (0.7) == 0.652666566082355786 */ +#define DELTA42 CHOOSE(549, 0, 0, 549, 0, 0) /* atan (0.7) == 0.61072596438920861654375887649023613 */ +#define DELTA50 CHOOSE(1605, 1, 0, 1605, 1, 0) /* atanh (0.7) == 0.8673005276940531944 */ +#define DELTA74 CHOOSE(549, 0, 0, 549, 0, 0) /* atan2 (0.7, 1) == 0.61072596438920861654375887649023613 */ +#define DELTA78 CHOOSE(1, 0, 0, 1, 0, 0) /* atan2 (0.4, 0.0003) == 1.5700463269355215717704032607580829 */ +#define DELTA85 CHOOSE(0, 0, 1, 0, 0, 1) /* cabs (0.7 + 12.4 i) == 12.419742348374220601176836866763271 */ +#define DELTA86 CHOOSE(0, 0, 1, 0, 0, 1) /* cabs (-12.4 + 0.7 i) == 12.419742348374220601176836866763271 */ +#define DELTA87 CHOOSE(0, 0, 1, 0, 0, 1) /* cabs (-0.7 + 12.4 i) == 12.419742348374220601176836866763271 */ +#define DELTA88 CHOOSE(0, 0, 1, 0, 0, 1) /* cabs (-12.4 - 0.7 i) == 12.419742348374220601176836866763271 */ +#define DELTA89 CHOOSE(0, 0, 1, 0, 0, 1) /* cabs (-0.7 - 12.4 i) == 12.419742348374220601176836866763271 */ +#define DELTA96 CHOOSE(560, 1, 0, 560, 1, 0) /* cabs (0.7 + 1.2 i) == 1.3892443989449804508432547041028554 */ +#define DELTA130 CHOOSE(BUILD_COMPLEX (151, 329), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1, 2), BUILD_COMPLEX (151, 329), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1, 2)) /* cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i */ +#define DELTA131 CHOOSE(BUILD_COMPLEX (0, 1), 0, 0, BUILD_COMPLEX (0, 1), 0, 0) /* cacos (-2 - 3 i) == 2.1414491111159960199416055713254211 + 1.9833870299165354323470769028940395 i */ +#define DELTA165 CHOOSE(BUILD_COMPLEX (328, 151), BUILD_COMPLEX (1, 0), 0, BUILD_COMPLEX (328, 151), BUILD_COMPLEX (1, 0), 0) /* cacosh (0.7 + 1.2 i) == 1.0927647857577371459105272080819308 + 1.1351827477151551088992008271819053 i */ +#define DELTA166 CHOOSE(BUILD_COMPLEX (6, 1), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (4, 4), BUILD_COMPLEX (6, 1), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (4, 4)) /* cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i */ +#define DELTA225 CHOOSE(BUILD_COMPLEX (603, 329), BUILD_COMPLEX (3, 0), BUILD_COMPLEX (2, 2), BUILD_COMPLEX (603, 329), BUILD_COMPLEX (3, 0), BUILD_COMPLEX (2, 2)) /* casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i */ +#define DELTA226 CHOOSE(BUILD_COMPLEX (0, 1), 0, 0, BUILD_COMPLEX (0, 1), 0, 0) /* casin (-2 - 3 i) == -0.57065278432109940071028387968566963 - 1.9833870299165354323470769028940395 i */ +#define DELTA262 CHOOSE(BUILD_COMPLEX (892, 12), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (892, 12), 0, BUILD_COMPLEX (0, 1)) /* casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i */ +#define DELTA263 CHOOSE(BUILD_COMPLEX (6, 6), BUILD_COMPLEX (5, 3), BUILD_COMPLEX (1, 6), BUILD_COMPLEX (6, 6), BUILD_COMPLEX (5, 3), BUILD_COMPLEX (1, 6)) /* casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i */ +#define DELTA301 CHOOSE(BUILD_COMPLEX (251, 474), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (251, 474), 0, BUILD_COMPLEX (0, 1)) /* catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i */ +#define DELTA302 CHOOSE(BUILD_COMPLEX (0, 7), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 7), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i */ +#define DELTA340 CHOOSE(BUILD_COMPLEX (66, 447), BUILD_COMPLEX (1, 0), 0, BUILD_COMPLEX (66, 447), BUILD_COMPLEX (1, 0), 0) /* catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i */ +#define DELTA341 CHOOSE(BUILD_COMPLEX (6, 0), BUILD_COMPLEX (2, 0), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (6, 0), BUILD_COMPLEX (2, 0), BUILD_COMPLEX (1, 0)) /* catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i */ +#define DELTA347 CHOOSE(716, 0, 0, 716, 0, 0) /* cbrt (-0.001) == -0.1 */ +#define DELTA349 CHOOSE(1, 0, 0, 1, 0, 0) /* cbrt (-27.0) == -3.0 */ +#define DELTA350 CHOOSE(306, 0, 0, 306, 0, 0) /* cbrt (0.970299) == 0.99 */ +#define DELTA351 CHOOSE(346, 1, 0, 346, 1, 0) /* cbrt (0.7) == 0.8879040017426007084 */ +#define DELTA389 CHOOSE(BUILD_COMPLEX (5, 1901), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (5, 1901), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 0)) /* ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i */ +#define DELTA390 CHOOSE(BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1)) /* ccos (-2 - 3 i) == -4.1896256909688072301 - 9.1092278937553365979 i */ +#define DELTA428 CHOOSE(BUILD_COMPLEX (1467, 1183), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1467, 1183), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1, 0)) /* ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i */ +#define DELTA429 CHOOSE(BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* ccosh (-2 - 3 i) == -3.7245455049153225654 + 0.5118225699873846088 i */ +#define DELTA469 CHOOSE(BUILD_COMPLEX (940, 0), 0, BUILD_COMPLEX (1, 0), BUILD_COMPLEX (940, 0), 0, BUILD_COMPLEX (1, 0)) /* cexp (0.7 + 1.2 i) == 0.72969890915032360123451688642930727 + 1.8768962328348102821139467908203072 i */ +#define DELTA470 CHOOSE(BUILD_COMPLEX (4, 18), 0, 0, BUILD_COMPLEX (4, 18), 0, 0) /* cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i */ +#define DELTA515 CHOOSE(BUILD_COMPLEX (0, 1), 0, 0, BUILD_COMPLEX (0, 1), 0, 0) /* clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i */ +#define DELTA520 CHOOSE(0, BUILD_COMPLEX (0, 1), 0, 0, BUILD_COMPLEX (0, 1), 0) /* clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i */ +#define DELTA521 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (inf + inf i) == inf + pi/4*log10(e) i */ +#define DELTA522 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (inf - inf i) == inf - pi/4*log10(e) i */ +#define DELTA523 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (0 + inf i) == inf + pi/2*log10(e) i */ +#define DELTA524 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (3 + inf i) == inf + pi/2*log10(e) i */ +#define DELTA525 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (-0 + inf i) == inf + pi/2*log10(e) i */ +#define DELTA526 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (-3 + inf i) == inf + pi/2*log10(e) i */ +#define DELTA527 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (0 - inf i) == inf - pi/2*log10(e) i */ +#define DELTA528 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (3 - inf i) == inf - pi/2*log10(e) i */ +#define DELTA529 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (-0 - inf i) == inf - pi/2*log10(e) i */ +#define DELTA530 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (-3 - inf i) == inf - pi/2*log10(e) i */ +#define DELTA531 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (-inf + 0 i) == inf + pi*log10(e) i */ +#define DELTA532 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (-inf + 1 i) == inf + pi*log10(e) i */ +#define DELTA533 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (-inf - 0 i) == inf - pi*log10(e) i */ +#define DELTA534 CHOOSE(0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1)) /* clog10 (-inf - 1 i) == inf - pi*log10(e) i */ +#define DELTA552 CHOOSE(BUILD_COMPLEX (1403, 186), BUILD_COMPLEX (2, 1), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1403, 186), BUILD_COMPLEX (2, 1), BUILD_COMPLEX (1, 0)) /* clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i */ +#define DELTA553 CHOOSE(BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 1), 0) /* clog10 (-2 - 3 i) == 0.5569716761534183846 - 0.9375544629863747085 i */ +#define DELTA582 CHOOSE(0, 1, 0.5, 0, 1, 0.5) /* cos (M_PI_6l * 2.0) == 0.5 */ +#define DELTA583 CHOOSE(0.5, 2, 1, 0.5, 2, 1) /* cos (M_PI_6l * 4.0) == -0.5 */ +#define DELTA584 CHOOSE(0.25, 0.2758, 0.3667, 0.25, 0.2758, 0.3667) /* cos (pi/2) == 0 */ +#define DELTA585 CHOOSE(529, 1, 0, 529, 1, 0) /* cos (0.7) == 0.76484218728448842625585999019186495 */ +#define DELTA591 CHOOSE(309, 0, 0, 309, 0, 0) /* cosh (0.7) == 1.255169005630943018 */ +#define DELTA594 CHOOSE(BUILD_COMPLEX (0, 9), BUILD_COMPLEX (0, 1.104), BUILD_COMPLEX (0, 2.5333), BUILD_COMPLEX (0, 9), BUILD_COMPLEX (0, 1.104), BUILD_COMPLEX (0, 2.5333)) /* cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i */ +#define DELTA595 CHOOSE(BUILD_COMPLEX (2, 5), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (4, 1), BUILD_COMPLEX (2, 5), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (4, 1)) /* cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i */ +#define DELTA652 CHOOSE(BUILD_COMPLEX (966, 168), 0, 0, BUILD_COMPLEX (966, 168), 0, 0) /* csin (0.7 + 1.2 i) == 1.1664563419657581376 + 1.1544997246948547371 i */ +#define DELTA691 CHOOSE(BUILD_COMPLEX (413, 477), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (413, 477), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (1, 0)) /* csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i */ +#define DELTA692 CHOOSE(BUILD_COMPLEX (0, 2), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (0, 2), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (0, 1)) /* csinh (-2 - 3 i) == 3.5905645899857799520 - 0.5309210862485198052 i */ +#define DELTA732 CHOOSE(BUILD_COMPLEX (237, 128), BUILD_COMPLEX (1, 0), 0, BUILD_COMPLEX (237, 128), BUILD_COMPLEX (1, 0), 0) /* csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i */ +#define DELTA733 CHOOSE(BUILD_COMPLEX (1, 0), 0, 0, BUILD_COMPLEX (1, 0), 0, 0) /* csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i */ +#define DELTA734 CHOOSE(BUILD_COMPLEX (1, 0), 0, 0, BUILD_COMPLEX (1, 0), 0, 0) /* csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i */ +#define DELTA766 CHOOSE(BUILD_COMPLEX (690, 367), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (690, 367), BUILD_COMPLEX (1, 1), BUILD_COMPLEX (1, 0)) /* ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i */ +#define DELTA767 CHOOSE(BUILD_COMPLEX (439, 2), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (439, 2), 0, BUILD_COMPLEX (0, 1)) /* ctan (-2 - 3 i) == 0.0037640256415042482 - 1.0032386273536098014 i */ +#define DELTA799 CHOOSE(0, BUILD_COMPLEX (0, 0.5), BUILD_COMPLEX (0, 1), 0, BUILD_COMPLEX (0, 0.5), BUILD_COMPLEX (0, 1)) /* ctanh (0 + pi/4 i) == 0.0 + 1.0 i */ +#define DELTA800 CHOOSE(BUILD_COMPLEX (286, 3074), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (1, 0), BUILD_COMPLEX (286, 3074), BUILD_COMPLEX (0, 1), BUILD_COMPLEX (1, 0)) /* ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i */ +#define DELTA801 CHOOSE(BUILD_COMPLEX (5, 25), 0, BUILD_COMPLEX (0, 1), BUILD_COMPLEX (5, 25), 0, BUILD_COMPLEX (0, 1)) /* ctanh (-2 - 3 i) == -0.9653858790221331242 + 0.0098843750383224937 i */ +#define DELTA817 CHOOSE(1, 1, 0, 1, 1, 0) /* erfc (0.7) == 0.32219880616258152702 */ +#define DELTA818 CHOOSE(3, 1, 1, 3, 1, 1) /* erfc (1.2) == 0.089686021770364619762 */ +#define DELTA819 CHOOSE(0, 1, 0, 0, 1, 0) /* erfc (2.0) == 0.0046777349810472658379 */ +#define DELTA820 CHOOSE(12, 24, 12, 12, 24, 12) /* erfc (4.1) == 0.67000276540848983727e-8 */ +#define DELTA821 CHOOSE(36, 0, 0, 36, 0, 0) /* erfc (9) == 0.41370317465138102381e-36 */ +#define DELTA830 CHOOSE(412, 0, 0, 412, 0, 0) /* exp (0.7) == 2.0137527074704765216 */ +#define DELTA831 CHOOSE(16, 0, 0, 16, 0, 0) /* exp (50.0) == 5184705528587072464087.45332293348538 */ +#define DELTA832 CHOOSE(754, 0, 0, 754, 0, 0) /* exp (1000.0) == 0.197007111401704699388887935224332313e435 */ +#define DELTA838 CHOOSE(8, 0, 0, 8, 0, 0) /* exp10 (3) == 1000 */ +#define DELTA839 CHOOSE(818, 0, 0, 818, 0, 0) /* exp10 (-1) == 0.1 */ +#define DELTA842 CHOOSE(1182, 1, 0, 1182, 1, 0) /* exp10 (0.7) == 5.0118723362727228500155418688494574 */ +#define DELTA852 CHOOSE(462, 0, 0, 462, 0, 0) /* exp2 (0.7) == 1.6245047927124710452 */ +#define DELTA859 CHOOSE(825, 0, 0, 825, 0, 0) /* expm1 (0.7) == 1.0137527074704765216 */ +#define DELTA972 CHOOSE(4096, 2, 1, 4096, 2, 1) /* fmod (6.5, 2.3) == 1.9 */ +#define DELTA973 CHOOSE(4096, 2, 1, 4096, 2, 1) /* fmod (-6.5, 2.3) == -1.9 */ +#define DELTA974 CHOOSE(4096, 2, 1, 4096, 2, 1) /* fmod (6.5, -2.3) == 1.9 */ +#define DELTA975 CHOOSE(4096, 2, 1, 4096, 2, 1) /* fmod (-6.5, -2.3) == -1.9 */ +#define DELTA1004 CHOOSE(1, 1, 0, 1, 1, 0) /* gamma (-0.5) == log(2*sqrt(pi)) */ +#define DELTA1013 CHOOSE(406, 0, 1, 406, 0, 0) /* hypot (0.7, 12.4) == 12.419742348374220601176836866763271 */ +#define DELTA1014 CHOOSE(406, 0, 1, 406, 0, 0) /* hypot (-0.7, 12.4) == 12.419742348374220601176836866763271 */ +#define DELTA1015 CHOOSE(406, 0, 1, 406, 0, 0) /* hypot (0.7, -12.4) == 12.419742348374220601176836866763271 */ +#define DELTA1016 CHOOSE(406, 0, 1, 406, 0, 0) /* hypot (-0.7, -12.4) == 12.419742348374220601176836866763271 */ +#define DELTA1017 CHOOSE(406, 0, 1, 406, 0, 0) /* hypot (12.4, 0.7) == 12.419742348374220601176836866763271 */ +#define DELTA1018 CHOOSE(406, 0, 1, 406, 0, 0) /* hypot (-12.4, 0.7) == 12.419742348374220601176836866763271 */ +#define DELTA1019 CHOOSE(406, 0, 1, 406, 0, 0) /* hypot (12.4, -0.7) == 12.419742348374220601176836866763271 */ +#define DELTA1020 CHOOSE(406, 0, 1, 406, 0, 0) /* hypot (-12.4, -0.7) == 12.419742348374220601176836866763271 */ +#define DELTA1024 CHOOSE(560, 1, 0, 560, 0, 0) /* hypot (0.7, 1.2) == 1.3892443989449804508432547041028554 */ +#define DELTA1053 CHOOSE(0, 1, 1, 0, 1, 1) /* j0 (2.0) == 0.22389077914123566805 */ +#define DELTA1054 CHOOSE(0, 0, 1, 0, 0, 1) /* j0 (8.0) == 0.17165080713755390609 */ +#define DELTA1055 CHOOSE(0, 2, 1, 0, 2, 1) /* j0 (10.0) == -0.24593576445134833520 */ +#define DELTA1064 CHOOSE(0, 1, 0, 0, 1, 0) /* j1 (2.0) == 0.57672480775687338720 */ +#define DELTA1065 CHOOSE(1, 0, 1, 1, 0, 1) /* j1 (8.0) == 0.23463634685391462438 */ +#define DELTA1066 CHOOSE(2, 2, 1, 2, 2, 1) /* j1 (10.0) == 0.043472746168861436670 */ +#define DELTA1075 CHOOSE(0, 1, 1, 0, 1, 1) /* jn (0, 2.0) == 0.22389077914123566805 */ +#define DELTA1076 CHOOSE(1, 0, 1, 1, 0, 1) /* jn (0, 8.0) == 0.17165080713755390609 */ +#define DELTA1077 CHOOSE(2, 2, 1, 2, 2, 1) /* jn (0, 10.0) == -0.24593576445134833520 */ +#define DELTA1086 CHOOSE(0, 1, 0, 0, 1, 0) /* jn (1, 2.0) == 0.57672480775687338720 */ +#define DELTA1087 CHOOSE(1, 0, 1, 1, 0, 1) /* jn (1, 8.0) == 0.23463634685391462438 */ +#define DELTA1088 CHOOSE(2, 2, 1, 2, 2, 1) /* jn (1, 10.0) == 0.043472746168861436670 */ +#define DELTA1091 CHOOSE(1, 0, 0, 1, 0, 0) /* jn (3, -1.0) == -0.019563353982668405919 */ +#define DELTA1093 CHOOSE(1, 1, 0, 1, 1, 0) /* jn (3, 0.1) == 0.000020820315754756261429 */ +#define DELTA1094 CHOOSE(0, 2, 0, 0, 2, 0) /* jn (3, 0.7) == 0.0069296548267508408077 */ +#define DELTA1095 CHOOSE(1, 0, 0, 1, 0, 0) /* jn (3, 1.0) == 0.019563353982668405919 */ +#define DELTA1096 CHOOSE(0, 1, 1, 0, 1, 1) /* jn (3, 2.0) == 0.12894324947440205110 */ +#define DELTA1097 CHOOSE(1, 3, 1, 1, 3, 1) /* jn (3, 10.0) == 0.058379379305186812343 */ +#define DELTA1100 CHOOSE(1, 1, 1, 1, 1, 1) /* jn (10, -1.0) == 0.26306151236874532070e-9 */ +#define DELTA1102 CHOOSE(1, 5, 2, 1, 5, 2) /* jn (10, 0.1) == 0.26905328954342155795e-19 */ +#define DELTA1103 CHOOSE(2, 4, 1, 2, 4, 1) /* jn (10, 0.7) == 0.75175911502153953928e-11 */ +#define DELTA1104 CHOOSE(1, 1, 1, 1, 1, 1) /* jn (10, 1.0) == 0.26306151236874532070e-9 */ +#define DELTA1105 CHOOSE(1, 2, 1, 1, 2, 1) /* jn (10, 2.0) == 0.25153862827167367096e-6 */ +#define DELTA1106 CHOOSE(2, 4, 2, 2, 4, 2) /* jn (10, 10.0) == 0.20748610663335885770 */ +#define DELTA1126 CHOOSE(1, 1, 0, 1, 1, 0) /* lgamma (-0.5) == log(2*sqrt(pi)) */ +#define DELTA1128 CHOOSE(0, 1, 1, 0, 1, 1) /* lgamma (0.7) == 0.26086724653166651439 */ +#define DELTA1130 CHOOSE(1, 1, 2, 1, 1, 2) /* lgamma (1.2) == -0.853740900033158497197e-1 */ +#define DELTA1163 CHOOSE(1, 0, 0.5, 1, 0, 0.5) /* log (e) == 1 */ +#define DELTA1164 CHOOSE(1, 0, 0, 1, 0, 0) /* log (1.0 / M_El) == -1 */ +#define DELTA1167 CHOOSE(2341, 1, 1, 2341, 1, 1) /* log (0.7) == -0.35667494393873237891263871124118447 */ +#define DELTA1178 CHOOSE(1, 0, 1, 1, 0, 1) /* log10 (e) == log10(e) */ +#define DELTA1179 CHOOSE(2033, 1, 0, 2033, 1, 0) /* log10 (0.7) == -0.15490195998574316929 */ +#define DELTA1186 CHOOSE(1, 0, 0, 1, 0, 0) /* log1p (M_El - 1.0) == 1 */ +#define DELTA1187 CHOOSE(585, 1, 1, 585, 1, 1) /* log1p (-0.3) == -0.35667494393873237891263871124118447 */ +#define DELTA1198 CHOOSE(1688, 1, 1, 1688, 1, 1) /* log2 (0.7) == -0.51457317282975824043 */ +#define DELTA1398 CHOOSE(725, 0, 0, 725, 0, 0) /* pow (0.7, 1.2) == 0.65180494056638638188 */ +#define DELTA1524 CHOOSE(627, 0, 0, 627, 0, 0) /* sin (0.7) == 0.64421768723769105367261435139872014 */ +#define DELTA1536 CHOOSE(0.25, 0.2758, 0.3667, 0.25, 0.2758, 0.3667) /* sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res */ +#define DELTA1539 CHOOSE(1, 1, 1, 1, 1, 1) /* sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res */ +#define DELTA1540 CHOOSE(0, 1, 0.5, 0, 1, 0.5) /* sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res */ +#define DELTA1541 CHOOSE(627, 0, 0, 627, 0, 0) /* sincos (0.7, &sin_res, &cos_res) puts 0.64421768723769105367261435139872014 in sin_res */ +#define DELTA1542 CHOOSE(528, 1, 0, 528, 1, 0) /* sincos (0.7, &sin_res, &cos_res) puts 0.76484218728448842625585999019186495 in cos_res */ +#define DELTA1548 CHOOSE(1029, 0, 1, 1028, 0, 1) /* sinh (0.7) == 0.75858370183953350346 */ +#define DELTA1562 CHOOSE(325, 0, 0, 325, 0, 0) /* sqrt (15239.9025) == 123.45 */ +#define DELTA1569 CHOOSE(0, 0.5, 0, 0, 0.5, 0) /* tan (pi/4) == 1 */ +#define DELTA1570 CHOOSE(1401, 0, 0, 1401, 0, 0) /* tan (0.7) == 0.84228838046307944812813500221293775 */ +#define DELTA1576 CHOOSE(521, 0, 0, 521, 0, 0) /* tanh (0.7) == 0.60436777711716349631 */ +#define DELTA1577 CHOOSE(1, 0, 0, 1, 0, 0) /* tanh (-0.7) == -0.60436777711716349631 */ +#define DELTA1587 CHOOSE(0, 0, 1, 0, 0, 1) /* tgamma (0.5) == sqrt (pi) */ +#define DELTA1588 CHOOSE(2, 2, 1, 2, 2, 1) /* tgamma (-0.5) == -2 sqrt (pi) */ +#define DELTA1590 CHOOSE(2, 0, 0, 2, 0, 0) /* tgamma (4) == 6 */ +#define DELTA1591 CHOOSE(0, 1, 1, 0, 1, 1) /* tgamma (0.7) == 1.29805533264755778568 */ +#define DELTA1614 CHOOSE(0, 1, 1, 0, 1, 1) /* y0 (0.1) == -1.5342386513503668441 */ +#define DELTA1615 CHOOSE(2, 3, 1, 2, 3, 1) /* y0 (0.7) == -0.19066492933739506743 */ +#define DELTA1616 CHOOSE(0, 2, 1, 0, 2, 1) /* y0 (1.0) == 0.088256964215676957983 */ +#define DELTA1617 CHOOSE(0, 1, 1, 0, 1, 1) /* y0 (1.5) == 0.38244892379775884396 */ +#define DELTA1618 CHOOSE(0, 1, 0, 0, 1, 0) /* y0 (2.0) == 0.51037567264974511960 */ +#define DELTA1619 CHOOSE(1, 1, 1, 1, 1, 1) /* y0 (8.0) == 0.22352148938756622053 */ +#define DELTA1620 CHOOSE(1, 2, 1, 2, 2, 1) /* y0 (10.0) == 0.055671167283599391424 */ +#define DELTA1625 CHOOSE(1, 1, 1, 1, 1, 1) /* y1 (0.1) == -6.4589510947020269877 */ +#define DELTA1626 CHOOSE(0, 1, 0, 0, 1, 0) /* y1 (0.7) == -1.1032498719076333697 */ +#define DELTA1627 CHOOSE(0, 1, 0, 0, 1, 0) /* y1 (1.0) == -0.78121282130028871655 */ +#define DELTA1628 CHOOSE(0, 0, 1, 0, 0, 1) /* y1 (1.5) == -0.41230862697391129595 */ +#define DELTA1629 CHOOSE(1, 1, 2, 1, 1, 2) /* y1 (2.0) == -0.10703243154093754689 */ +#define DELTA1630 CHOOSE(2, 0, 2, 2, 0, 2) /* y1 (8.0) == -0.15806046173124749426 */ +#define DELTA1631 CHOOSE(0, 3, 2, 0, 3, 2) /* y1 (10.0) == 0.24901542420695388392 */ +#define DELTA1636 CHOOSE(0, 1, 1, 0, 1, 1) /* yn (0, 0.1) == -1.5342386513503668441 */ +#define DELTA1637 CHOOSE(2, 3, 1, 2, 3, 1) /* yn (0, 0.7) == -0.19066492933739506743 */ +#define DELTA1638 CHOOSE(0, 2, 1, 0, 2, 1) /* yn (0, 1.0) == 0.088256964215676957983 */ +#define DELTA1639 CHOOSE(0, 1, 1, 0, 1, 1) /* yn (0, 1.5) == 0.38244892379775884396 */ +#define DELTA1640 CHOOSE(0, 1, 0, 0, 1, 0) /* yn (0, 2.0) == 0.51037567264974511960 */ +#define DELTA1641 CHOOSE(1, 1, 1, 1, 1, 1) /* yn (0, 8.0) == 0.22352148938756622053 */ +#define DELTA1642 CHOOSE(1, 2, 1, 1, 2, 1) /* yn (0, 10.0) == 0.055671167283599391424 */ +#define DELTA1647 CHOOSE(1, 1, 1, 1, 1, 1) /* yn (1, 0.1) == -6.4589510947020269877 */ +#define DELTA1648 CHOOSE(0, 1, 0, 0, 1, 0) /* yn (1, 0.7) == -1.1032498719076333697 */ +#define DELTA1649 CHOOSE(0, 1, 0, 0, 1, 0) /* yn (1, 1.0) == -0.78121282130028871655 */ +#define DELTA1650 CHOOSE(0, 0, 1, 0, 0, 1) /* yn (1, 1.5) == -0.41230862697391129595 */ +#define DELTA1651 CHOOSE(1, 1, 2, 1, 1, 2) /* yn (1, 2.0) == -0.10703243154093754689 */ +#define DELTA1652 CHOOSE(2, 0, 2, 2, 0, 2) /* yn (1, 8.0) == -0.15806046173124749426 */ +#define DELTA1653 CHOOSE(0, 3, 2, 0, 3, 2) /* yn (1, 10.0) == 0.24901542420695388392 */ +#define DELTA1656 CHOOSE(2, 1, 1, 2, 1, 1) /* yn (3, 0.1) == -5099.3323786129048894 */ +#define DELTA1657 CHOOSE(2, 3, 0, 2, 3, 0) /* yn (3, 0.7) == -15.819479052819633505 */ +#define DELTA1659 CHOOSE(0, 1, 1, 0, 1, 1) /* yn (3, 2.0) == -1.1277837768404277861 */ +#define DELTA1660 CHOOSE(0, 1, 1, 0, 1, 1) /* yn (3, 10.0) == -0.25136265718383732978 */ +#define DELTA1663 CHOOSE(2, 2, 1, 2, 2, 1) /* yn (10, 0.1) == -0.11831335132045197885e19 */ +#define DELTA1664 CHOOSE(7, 6, 3, 7, 6, 3) /* yn (10, 0.7) == -0.42447194260703866924e10 */ +#define DELTA1665 CHOOSE(0, 1, 1, 0, 1, 1) /* yn (10, 1.0) == -0.12161801427868918929e9 */ +#define DELTA1666 CHOOSE(1, 2, 1, 1, 2, 1) /* yn (10, 2.0) == -129184.54220803928264 */ +#define DELTA1667 CHOOSE(0, 2, 1, 0, 2, 1) /* yn (10, 10.0) == -0.35981415218340272205 */ diff --git a/test/libm-test.c b/test/libm-test.c index 21bea95..3ed7819 100644 --- a/test/libm-test.c +++ b/test/libm-test.c @@ -4627,4 +4627,3 @@ main (int argc, char **argv) * mode:c * End: */ - diff --git a/test/test-double.c b/test/test-double.c new file mode 100644 index 0000000..4d239a7 --- /dev/null +++ b/test/test-double.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define FUNC(function) function +#define FLOAT double +#define TEST_MSG "testing double (without inline functions)\n" +#define MATHCONST(x) x +#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble +#define PRINTF_EXPR "e" +#define PRINTF_XEXPR "a" +#define PRINTF_NEXPR "f" +#define TEST_DOUBLE 1 + +#ifndef __NO_MATH_INLINES +# define __NO_MATH_INLINES +#endif + +#include "libm-test.c" diff --git a/test/test-float.c b/test/test-float.c new file mode 100644 index 0000000..6e45203 --- /dev/null +++ b/test/test-float.c @@ -0,0 +1,35 @@ +test-float.c [plain text] +/* Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define FUNC(function) function ## f +#define FLOAT float +#define TEST_MSG "testing float (without inline functions)\n" +#define MATHCONST(x) x +#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat +#define PRINTF_EXPR "e" +#define PRINTF_XEXPR "a" +#define PRINTF_NEXPR "f" +#define TEST_FLOAT 1 + +#ifndef __NO_MATH_INLINES +# define __NO_MATH_INLINES +#endif + +#include "libm-test.c"