| /* Copyright (C) 1997-2014 Free Software Foundation, Inc. |
| This file is part of the GNU C Library. |
| Contributed by Andreas Jaeger <aj@suse.de>, 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, see |
| <http://www.gnu.org/licenses/>. */ |
| |
| /* Part of testsuite for libm. |
| |
| This file is processed by a perl script. The resulting file has to |
| be included by a master file that defines: |
| |
| Macros: |
| FUNC(function): converts general function name (like cos) to |
| name with correct suffix (e.g. cosl or cosf) |
| MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L) |
| FLOAT: floating point type to test |
| - TEST_MSG: informal message to be displayed |
| CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat): |
| chooses one of the parameters as delta for testing |
| equality |
| PRINTF_EXPR Floating point conversion specification to print a variable |
| of type FLOAT with printf. PRINTF_EXPR just contains |
| the specifier, not the percent and width arguments, |
| e.g. "f". |
| PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format. |
| PRINTF_NEXPR Like PRINTF_EXPR, but print nice. */ |
| |
| /* This testsuite has currently tests for: |
| acos, acosh, asin, asinh, atan, atan2, atanh, |
| cbrt, ceil, copysign, cos, cosh, drem, erf, erfc, exp, exp10, exp2, expm1, |
| fabs, fdim, finite, floor, fma, fmax, fmin, fmod, fpclassify, |
| frexp, gamma, hypot, |
| ilogb, isfinite, isinf, isnan, isnormal, issignaling, |
| isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered, |
| j0, j1, jn, |
| ldexp, lgamma, log, log10, log1p, log2, logb, |
| modf, nearbyint, nextafter, nexttoward, |
| pow, pow10, remainder, remquo, rint, lrint, llrint, |
| round, lround, llround, |
| scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc, |
| y0, y1, yn, significand |
| |
| and for the following complex math functions: |
| cabs, cacos, cacosh, carg, casin, casinh, catan, catanh, |
| ccos, ccosh, cexp, cimag, clog, clog10, conj, cpow, cproj, creal, |
| csin, csinh, csqrt, ctan, ctanh. |
| |
| At the moment the following functions and macros aren't tested: |
| lgamma_r, |
| nan. |
| |
| Parameter handling is primitive in the moment: |
| --verbose=[0..3] for different levels of output: |
| 0: only error count |
| 1: basic report on failed tests (default) |
| 2: full report on all tests |
| -v for full output (equals --verbose=3) |
| -u for generation of an ULPs file |
| */ |
| |
| /* "Philosophy": |
| |
| This suite tests some aspects of the correct implementation of |
| mathematical functions in libm. Some simple, specific parameters |
| are tested for correctness but there's no exhaustive |
| testing. Handling of specific inputs (e.g. infinity, not-a-number) |
| is also tested. Correct handling of exceptions is checked |
| against. These implemented tests should check all cases that are |
| specified in ISO C99. |
| |
| NaN values: There exist signalling and quiet NaNs. This implementation |
| only uses quiet NaN as parameter. Where the sign of a NaN is |
| significant, this is not tested. The payload of NaNs is not examined. |
| |
| Inline functions: Inlining functions should give an improvement in |
| speed - but not in precission. The inlined functions return |
| reasonable values for a reasonable range of input values. The |
| result is not necessarily correct for all values and exceptions are |
| not correctly raised in all cases. Problematic input and return |
| values are infinity, not-a-number and minus zero. This suite |
| therefore does not check these specific inputs and the exception |
| handling for inlined mathematical functions - just the "reasonable" |
| values are checked. |
| |
| Beware: The tests might fail for any of the following reasons: |
| - Tests are wrong |
| - Functions are wrong |
| - Floating Point Unit not working properly |
| - Compiler has errors |
| |
| With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error. |
| |
| |
| To Do: All parameter should be numbers that can be represented as |
| exact floating point values. Currently some values cannot be |
| represented exactly and therefore the result is not the expected |
| result. For this we will use 36 digits so that numbers can be |
| represented exactly. */ |
| |
| #ifndef _GNU_SOURCE |
| # define _GNU_SOURCE |
| #endif |
| |
| #include <complex.h> |
| #include <math.h> |
| #include <float.h> |
| #include <fenv.h> |
| #include <limits.h> |
| |
| #include <errno.h> |
| #include <stdlib.h> |
| #include <stdio.h> |
| #include <string.h> |
| #include <argp.h> |
| #include <tininess.h> |
| #include <math-tests.h> |
| |
| /* Structure for ulp data for a test, a function, or the real or |
| imaginary part of a function. */ |
| struct ulp_data |
| { |
| const char *name; |
| FLOAT max_ulp; |
| }; |
| |
| /* This header defines test_ulps, func_ulps, func_real_ulps and |
| func_imag_ulps arrays. */ |
| #include "libm-test-ulps.h" |
| |
| /* Allow platforms without all rounding modes to test properly, |
| assuming they provide an __FE_UNDEFINED in <bits/fenv.h> which |
| causes fesetround() to return failure. */ |
| #ifndef FE_TONEAREST |
| # define FE_TONEAREST __FE_UNDEFINED |
| #endif |
| #ifndef FE_TOWARDZERO |
| # define FE_TOWARDZERO __FE_UNDEFINED |
| #endif |
| #ifndef FE_UPWARD |
| # define FE_UPWARD __FE_UNDEFINED |
| #endif |
| #ifndef FE_DOWNWARD |
| # define FE_DOWNWARD __FE_UNDEFINED |
| #endif |
| |
| /* Possible exceptions */ |
| #define NO_EXCEPTION 0x0 |
| #define INVALID_EXCEPTION 0x1 |
| #define DIVIDE_BY_ZERO_EXCEPTION 0x2 |
| #define OVERFLOW_EXCEPTION 0x4 |
| #define UNDERFLOW_EXCEPTION 0x8 |
| #define INEXACT_EXCEPTION 0x10 |
| /* The next flags signals that those exceptions are allowed but not required. */ |
| #define INVALID_EXCEPTION_OK 0x20 |
| #define DIVIDE_BY_ZERO_EXCEPTION_OK 0x40 |
| #define OVERFLOW_EXCEPTION_OK 0x80 |
| #define UNDERFLOW_EXCEPTION_OK 0x100 |
| /* For "inexact" exceptions, the default is allowed but not required |
| unless INEXACT_EXCEPTION or NO_INEXACT_EXCEPTION is specified. */ |
| #define NO_INEXACT_EXCEPTION 0x200 |
| #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK |
| /* Some special test flags, passed together with exceptions. */ |
| #define IGNORE_ZERO_INF_SIGN 0x400 |
| #define TEST_NAN_SIGN 0x800 |
| #define NO_TEST_INLINE 0x1000 |
| #define XFAIL_TEST 0x2000 |
| /* Indicate errno settings required or disallowed. */ |
| #define ERRNO_UNCHANGED 0x4000 |
| #define ERRNO_EDOM 0x8000 |
| #define ERRNO_ERANGE 0x10000 |
| /* Flags generated by gen-libm-test.pl, not entered here manually. */ |
| #define IGNORE_RESULT 0x20000 |
| |
| /* Values underflowing only for float. */ |
| #ifdef TEST_FLOAT |
| # define UNDERFLOW_EXCEPTION_FLOAT UNDERFLOW_EXCEPTION |
| # define UNDERFLOW_EXCEPTION_OK_FLOAT UNDERFLOW_EXCEPTION_OK |
| #else |
| # define UNDERFLOW_EXCEPTION_FLOAT 0 |
| # define UNDERFLOW_EXCEPTION_OK_FLOAT 0 |
| #endif |
| /* Values underflowing only for double or types with a larger least |
| positive normal value. */ |
| #if defined TEST_FLOAT || defined TEST_DOUBLE \ |
| || (defined TEST_LDOUBLE && LDBL_MIN_EXP >= DBL_MIN_EXP) |
| # define UNDERFLOW_EXCEPTION_DOUBLE UNDERFLOW_EXCEPTION |
| # define UNDERFLOW_EXCEPTION_OK_DOUBLE UNDERFLOW_EXCEPTION_OK |
| #else |
| # define UNDERFLOW_EXCEPTION_DOUBLE 0 |
| # define UNDERFLOW_EXCEPTION_OK_DOUBLE 0 |
| #endif |
| /* Values underflowing only for IBM long double or types with a larger least |
| positive normal value. */ |
| #if defined TEST_FLOAT || (defined TEST_LDOUBLE && LDBL_MIN_EXP > DBL_MIN_EXP) |
| # define UNDERFLOW_EXCEPTION_LDOUBLE_IBM UNDERFLOW_EXCEPTION |
| #else |
| # define UNDERFLOW_EXCEPTION_LDOUBLE_IBM 0 |
| #endif |
| /* Values underflowing on architectures detecting tininess before |
| rounding, but not on those detecting tininess after rounding. */ |
| #define UNDERFLOW_EXCEPTION_BEFORE_ROUNDING (TININESS_AFTER_ROUNDING \ |
| ? 0 \ |
| : UNDERFLOW_EXCEPTION) |
| |
| /* Inline tests disabled for particular types. */ |
| #ifdef TEST_FLOAT |
| # define NO_TEST_INLINE_FLOAT NO_TEST_INLINE |
| #else |
| # define NO_TEST_INLINE_FLOAT 0 |
| #endif |
| #ifdef TEST_DOUBLE |
| # define NO_TEST_INLINE_DOUBLE NO_TEST_INLINE |
| #else |
| # define NO_TEST_INLINE_DOUBLE 0 |
| #endif |
| |
| /* Conditions used by tests generated by gen-auto-libm-tests.c. */ |
| #ifdef TEST_FLOAT |
| # define TEST_COND_flt_32 1 |
| #else |
| # define TEST_COND_flt_32 0 |
| #endif |
| #if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MANT_DIG == 53) |
| # define TEST_COND_dbl_64 1 |
| #else |
| # define TEST_COND_dbl_64 0 |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64 && LDBL_MIN_EXP == -16381 |
| # define TEST_COND_ldbl_96_intel 1 |
| #else |
| # define TEST_COND_ldbl_96_intel 0 |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64 && LDBL_MIN_EXP == -16382 |
| # define TEST_COND_ldbl_96_m68k 1 |
| #else |
| # define TEST_COND_ldbl_96_m68k 0 |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MANT_DIG == 113 |
| # define TEST_COND_ldbl_128 1 |
| #else |
| # define TEST_COND_ldbl_128 0 |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106 |
| # define TEST_COND_ldbl_128ibm 1 |
| #else |
| # define TEST_COND_ldbl_128ibm 0 |
| #endif |
| #if LONG_MAX == 0x7fffffff |
| # define TEST_COND_long32 1 |
| # define TEST_COND_long64 0 |
| #else |
| # define TEST_COND_long32 0 |
| # define TEST_COND_long64 1 |
| #endif |
| #define TEST_COND_before_rounding (!TININESS_AFTER_ROUNDING) |
| #define TEST_COND_after_rounding TININESS_AFTER_ROUNDING |
| |
| #ifdef __x86_64__ |
| # define TEST_COND_x86_64 1 |
| #else |
| # define TEST_COND_x86_64 0 |
| #endif |
| |
| #ifdef __i386__ |
| # define TEST_COND_x86 1 |
| #else |
| # define TEST_COND_x86 0 |
| #endif |
| |
| /* Various constants (we must supply them precalculated for accuracy). */ |
| #define M_PI_6l .52359877559829887307710723054658383L |
| #define M_PI_34l 2.356194490192344928846982537459627163L /* 3*pi/4 */ |
| #define M_PI_34_LOG10El 1.023282265381381010614337719073516828L |
| #define M_PI2_LOG10El 0.682188176920920673742891812715677885L |
| #define M_PI4_LOG10El 0.341094088460460336871445906357838943L |
| #define M_PI_LOG10El 1.364376353841841347485783625431355770L |
| |
| #define ulps_file_name "ULPs" /* Name of the ULPs file. */ |
| static FILE *ulps_file; /* File to document difference. */ |
| static int output_ulps; /* Should ulps printed? */ |
| static char *output_dir; /* Directory where generated files will be written. */ |
| |
| static int noErrors; /* number of errors */ |
| static int noTests; /* number of tests (without testing exceptions) */ |
| static int noExcTests; /* number of tests for exception flags */ |
| static int noErrnoTests;/* number of tests for errno values */ |
| |
| static int verbose; |
| static int output_max_error; /* Should the maximal errors printed? */ |
| static int output_points; /* Should the single function results printed? */ |
| static int ignore_max_ulp; /* Should we ignore max_ulp? */ |
| |
| #define plus_zero CHOOSE (0.0L, 0.0, 0.0f, \ |
| 0.0L, 0.0, 0.0f) |
| #define minus_zero CHOOSE (-0.0L, -0.0, -0.0f, \ |
| -0.0L, -0.0, -0.0f) |
| #define plus_infty CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF, \ |
| HUGE_VALL, HUGE_VAL, HUGE_VALF) |
| #define minus_infty CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF, \ |
| -HUGE_VALL, -HUGE_VAL, -HUGE_VALF) |
| #define qnan_value FUNC (__builtin_nan) ("") |
| #define max_value CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX, \ |
| LDBL_MAX, DBL_MAX, FLT_MAX) |
| #define min_value CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN, \ |
| LDBL_MIN, DBL_MIN, FLT_MIN) |
| #define min_subnorm_value CHOOSE (__LDBL_DENORM_MIN__, \ |
| __DBL_DENORM_MIN__, \ |
| __FLT_DENORM_MIN__, \ |
| __LDBL_DENORM_MIN__, \ |
| __DBL_DENORM_MIN__, \ |
| __FLT_DENORM_MIN__) |
| |
| static FLOAT max_error, real_max_error, imag_max_error; |
| |
| |
| #define BUILD_COMPLEX(real, imag) \ |
| ({ __complex__ FLOAT __retval; \ |
| __real__ __retval = (real); \ |
| __imag__ __retval = (imag); \ |
| __retval; }) |
| |
| #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \ |
| (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1)) |
| #define MIN_EXP CHOOSE ((LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1), \ |
| (LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1)) |
| |
| /* Compare KEY (a string, with the name of a test or a function) with |
| ULP (a pointer to a struct ulp_data structure), returning a value |
| less than, equal to or greater than zero for use in bsearch. */ |
| |
| static int |
| compare_ulp_data (const void *key, const void *ulp) |
| { |
| const char *keystr = key; |
| const struct ulp_data *ulpdat = ulp; |
| return strcmp (keystr, ulpdat->name); |
| } |
| |
| /* Return the ulps for NAME in array DATA with NMEMB elements, or 0 if |
| no ulps listed. */ |
| |
| static FLOAT |
| find_ulps (const char *name, const struct ulp_data *data, size_t nmemb) |
| { |
| const struct ulp_data *entry = bsearch (name, data, nmemb, sizeof (*data), |
| compare_ulp_data); |
| if (entry == NULL) |
| return 0; |
| else |
| return entry->max_ulp; |
| } |
| |
| /* Return the ulps for test NAME. */ |
| |
| static FLOAT |
| find_test_ulps (const char *name) |
| { |
| return find_ulps (name, test_ulps, |
| sizeof (test_ulps) / sizeof (test_ulps[0])); |
| } |
| |
| /* Return the ulps for real function NAME. */ |
| |
| static FLOAT |
| find_function_ulps (const char *name) |
| { |
| return find_ulps (name, func_ulps, |
| sizeof (func_ulps) / sizeof (func_ulps[0])); |
| } |
| |
| /* Return the ulps for complex function NAME. */ |
| |
| static __complex__ FLOAT |
| find_complex_function_ulps (const char *name) |
| { |
| FLOAT ulp_real = find_ulps (name, func_real_ulps, |
| (sizeof (func_real_ulps) |
| / sizeof (func_real_ulps[0]))); |
| FLOAT ulp_imag = find_ulps (name, func_imag_ulps, |
| (sizeof (func_imag_ulps) |
| / sizeof (func_imag_ulps[0]))); |
| return BUILD_COMPLEX (ulp_real, ulp_imag); |
| } |
| |
| static void |
| init_max_error (void) |
| { |
| max_error = 0; |
| real_max_error = 0; |
| imag_max_error = 0; |
| feclearexcept (FE_ALL_EXCEPT); |
| errno = 0; |
| } |
| |
| static void |
| set_max_error (FLOAT current, FLOAT *curr_max_error) |
| { |
| if (current > *curr_max_error) |
| *curr_max_error = current; |
| } |
| |
| |
| /* Print a FLOAT. */ |
| static void |
| print_float (FLOAT f) |
| { |
| /* As printf doesn't differ between a sNaN and a qNaN, do this manually. */ |
| if (issignaling (f)) |
| printf ("sNaN\n"); |
| else if (isnan (f)) |
| printf ("qNaN\n"); |
| else |
| printf ("% .20" PRINTF_EXPR " % .20" PRINTF_XEXPR "\n", f, f); |
| } |
| |
| /* Should the message print to screen? This depends on the verbose flag, |
| and the test status. */ |
| static int |
| print_screen (int ok) |
| { |
| if (output_points |
| && (verbose > 1 |
| || (verbose == 1 && ok == 0))) |
| return 1; |
| return 0; |
| } |
| |
| |
| /* Should the message print to screen? This depends on the verbose flag, |
| and the test status. */ |
| static int |
| print_screen_max_error (int ok) |
| { |
| if (output_max_error |
| && (verbose > 1 |
| || ((verbose == 1) && (ok == 0)))) |
| return 1; |
| return 0; |
| } |
| |
| /* Update statistic counters. */ |
| static void |
| update_stats (int ok) |
| { |
| ++noTests; |
| if (!ok) |
| ++noErrors; |
| } |
| |
| static void |
| print_ulps (const char *test_name, FLOAT ulp) |
| { |
| if (output_ulps) |
| { |
| fprintf (ulps_file, "Test \"%s\":\n", test_name); |
| fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n", |
| CHOOSE("ldouble", "double", "float", |
| "ildouble", "idouble", "ifloat"), |
| FUNC(ceil) (ulp)); |
| } |
| } |
| |
| static void |
| print_function_ulps (const char *function_name, FLOAT ulp) |
| { |
| if (output_ulps) |
| { |
| fprintf (ulps_file, "Function: \"%s\":\n", function_name); |
| fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n", |
| CHOOSE("ldouble", "double", "float", |
| "ildouble", "idouble", "ifloat"), |
| FUNC(ceil) (ulp)); |
| } |
| } |
| |
| |
| static void |
| print_complex_function_ulps (const char *function_name, FLOAT real_ulp, |
| FLOAT imag_ulp) |
| { |
| if (output_ulps) |
| { |
| if (real_ulp != 0.0) |
| { |
| fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name); |
| fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n", |
| CHOOSE("ldouble", "double", "float", |
| "ildouble", "idouble", "ifloat"), |
| FUNC(ceil) (real_ulp)); |
| } |
| if (imag_ulp != 0.0) |
| { |
| fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name); |
| fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n", |
| CHOOSE("ldouble", "double", "float", |
| "ildouble", "idouble", "ifloat"), |
| FUNC(ceil) (imag_ulp)); |
| } |
| |
| |
| } |
| } |
| |
| |
| |
| /* Test if Floating-Point stack hasn't changed */ |
| static void |
| fpstack_test (const char *test_name) |
| { |
| #if defined (__i386__) || defined (__x86_64__) |
| static int old_stack; |
| int sw; |
| |
| asm ("fnstsw" : "=a" (sw)); |
| sw >>= 11; |
| sw &= 7; |
| |
| if (sw != old_stack) |
| { |
| printf ("FP-Stack wrong after test %s (%d, should be %d)\n", |
| test_name, sw, old_stack); |
| ++noErrors; |
| old_stack = sw; |
| } |
| #endif |
| } |
| |
| |
| static void |
| print_max_error (const char *func_name) |
| { |
| FLOAT allowed = find_function_ulps (func_name); |
| int ok = 0; |
| |
| if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp)) |
| { |
| ok = 1; |
| } |
| |
| if (!ok) |
| print_function_ulps (func_name, max_error); |
| |
| |
| if (print_screen_max_error (ok)) |
| { |
| printf ("Maximal error of `%s'\n", func_name); |
| printf (" is : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error)); |
| printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (allowed)); |
| } |
| |
| update_stats (ok); |
| } |
| |
| |
| static void |
| print_complex_max_error (const char *func_name) |
| { |
| __complex__ FLOAT allowed = find_complex_function_ulps (func_name); |
| int ok = 0; |
| |
| if ((real_max_error == 0 && imag_max_error == 0) |
| || (real_max_error <= __real__ allowed |
| && imag_max_error <= __imag__ allowed |
| && !ignore_max_ulp)) |
| { |
| ok = 1; |
| } |
| |
| if (!ok) |
| print_complex_function_ulps (func_name, real_max_error, imag_max_error); |
| |
| |
| if (print_screen_max_error (ok)) |
| { |
| printf ("Maximal error of real part of: %s\n", func_name); |
| printf (" is : %.0" PRINTF_NEXPR " ulp\n", |
| FUNC(ceil) (real_max_error)); |
| printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", |
| FUNC(ceil) (__real__ allowed)); |
| printf ("Maximal error of imaginary part of: %s\n", func_name); |
| printf (" is : %.0" PRINTF_NEXPR " ulp\n", |
| FUNC(ceil) (imag_max_error)); |
| printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", |
| FUNC(ceil) (__imag__ allowed)); |
| } |
| |
| update_stats (ok); |
| } |
| |
| |
| /* Test whether a given exception was raised. */ |
| static void |
| test_single_exception (const char *test_name, |
| int exception, |
| int exc_flag, |
| int fe_flag, |
| const char *flag_name) |
| { |
| #ifndef TEST_INLINE |
| int ok = 1; |
| if (exception & exc_flag) |
| { |
| if (fetestexcept (fe_flag)) |
| { |
| if (print_screen (1)) |
| printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name); |
| } |
| else |
| { |
| ok = 0; |
| if (print_screen (0)) |
| printf ("Failure: %s: Exception \"%s\" not set\n", |
| test_name, flag_name); |
| } |
| } |
| else |
| { |
| if (fetestexcept (fe_flag)) |
| { |
| ok = 0; |
| if (print_screen (0)) |
| printf ("Failure: %s: Exception \"%s\" set\n", |
| test_name, flag_name); |
| } |
| else |
| { |
| if (print_screen (1)) |
| printf ("%s: Exception \"%s\" not set\n", test_name, |
| flag_name); |
| } |
| } |
| if (!ok) |
| ++noErrors; |
| |
| #endif |
| } |
| |
| |
| /* Test whether exceptions given by EXCEPTION are raised. Ignore thereby |
| allowed but not required exceptions. |
| */ |
| static void |
| test_exceptions (const char *test_name, int exception) |
| { |
| if (EXCEPTION_TESTS (FLOAT)) |
| { |
| ++noExcTests; |
| #ifdef FE_DIVBYZERO |
| if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0) |
| test_single_exception (test_name, exception, |
| DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO, |
| "Divide by zero"); |
| #endif |
| #ifdef FE_INVALID |
| if ((exception & INVALID_EXCEPTION_OK) == 0) |
| test_single_exception (test_name, exception, |
| INVALID_EXCEPTION, FE_INVALID, |
| "Invalid operation"); |
| #endif |
| #ifdef FE_OVERFLOW |
| if ((exception & OVERFLOW_EXCEPTION_OK) == 0) |
| test_single_exception (test_name, exception, OVERFLOW_EXCEPTION, |
| FE_OVERFLOW, "Overflow"); |
| #endif |
| #ifdef FE_UNDERFLOW |
| if ((exception & UNDERFLOW_EXCEPTION_OK) == 0) |
| test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION, |
| FE_UNDERFLOW, "Underflow"); |
| #endif |
| #ifdef FE_INEXACT |
| if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0) |
| test_single_exception (test_name, exception, INEXACT_EXCEPTION, |
| FE_INEXACT, "Inexact"); |
| #endif |
| } |
| feclearexcept (FE_ALL_EXCEPT); |
| } |
| |
| /* Test whether errno for TEST_NAME, set to ERRNO_VALUE, has value |
| EXPECTED_VALUE (description EXPECTED_NAME). */ |
| static void |
| test_single_errno (const char *test_name, int errno_value, |
| int expected_value, const char *expected_name) |
| { |
| #ifndef TEST_INLINE |
| if (errno_value == expected_value) |
| { |
| if (print_screen (1)) |
| printf ("Pass: %s: errno set to %d (%s)\n", test_name, errno_value, |
| expected_name); |
| } |
| else |
| { |
| ++noErrors; |
| if (print_screen (0)) |
| printf ("Failure: %s: errno set to %d, expected %d (%s)\n", |
| test_name, errno_value, expected_value, expected_name); |
| } |
| #endif |
| } |
| |
| /* Test whether errno (value ERRNO_VALUE) has been for TEST_NAME set |
| as required by EXCEPTIONS. */ |
| static void |
| test_errno (const char *test_name, int errno_value, int exceptions) |
| { |
| ++noErrnoTests; |
| if (exceptions & ERRNO_UNCHANGED) |
| test_single_errno (test_name, errno_value, 0, "unchanged"); |
| if (exceptions & ERRNO_EDOM) |
| test_single_errno (test_name, errno_value, EDOM, "EDOM"); |
| if (exceptions & ERRNO_ERANGE) |
| test_single_errno (test_name, errno_value, ERANGE, "ERANGE"); |
| } |
| |
| /* Returns the number of ulps that GIVEN is away from EXPECTED. */ |
| #define ULPDIFF(given, expected) \ |
| (FUNC(fabs) ((given) - (expected)) / ulp (expected)) |
| |
| /* Returns the size of an ulp for VALUE. */ |
| static FLOAT |
| ulp (FLOAT value) |
| { |
| FLOAT ulp; |
| |
| switch (fpclassify (value)) |
| { |
| case FP_ZERO: |
| /* We compute the distance to the next FP which is the same as the |
| value of the smallest subnormal number. Previously we used |
| 2^(-MANT_DIG) which is too large a value to be useful. Note that we |
| can't use ilogb(0), since that isn't a valid thing to do. As a point |
| of comparison Java's ulp returns the next normal value e.g. |
| 2^(1 - MAX_EXP) for ulp(0), but that is not what we want for |
| glibc. */ |
| /* Fall through... */ |
| case FP_SUBNORMAL: |
| /* The next closest subnormal value is a constant distance away. */ |
| ulp = FUNC(ldexp) (1.0, MIN_EXP - MANT_DIG); |
| break; |
| |
| case FP_NORMAL: |
| ulp = FUNC(ldexp) (1.0, FUNC(ilogb) (value) - MANT_DIG); |
| break; |
| |
| default: |
| /* It should never happen. */ |
| abort (); |
| break; |
| } |
| return ulp; |
| } |
| |
| static void |
| check_float_internal (const char *test_name, FLOAT computed, FLOAT expected, |
| int exceptions, |
| FLOAT *curr_max_error) |
| { |
| int ok = 0; |
| int print_diff = 0; |
| FLOAT diff = 0; |
| FLOAT ulps = 0; |
| int errno_value = errno; |
| |
| test_exceptions (test_name, exceptions); |
| test_errno (test_name, errno_value, exceptions); |
| if (exceptions & IGNORE_RESULT) |
| goto out; |
| FLOAT max_ulp = find_test_ulps (test_name); |
| if (issignaling (computed) && issignaling (expected)) |
| { |
| if ((exceptions & TEST_NAN_SIGN) != 0 |
| && signbit (computed) != signbit (expected)) |
| { |
| ok = 0; |
| printf ("signaling NaN has wrong sign.\n"); |
| } |
| else |
| ok = 1; |
| } |
| else if (issignaling (computed) || issignaling (expected)) |
| ok = 0; |
| else if (isnan (computed) && isnan (expected)) |
| { |
| if ((exceptions & TEST_NAN_SIGN) != 0 |
| && signbit (computed) != signbit (expected)) |
| { |
| ok = 0; |
| printf ("quiet NaN has wrong sign.\n"); |
| } |
| else |
| ok = 1; |
| } |
| else if (isinf (computed) && isinf (expected)) |
| { |
| /* Test for sign of infinities. */ |
| if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0 |
| && signbit (computed) != signbit (expected)) |
| { |
| ok = 0; |
| printf ("infinity has wrong sign.\n"); |
| } |
| else |
| ok = 1; |
| } |
| /* Don't calculate ULPs for infinities or any kind of NaNs. */ |
| else if (isinf (computed) || isnan (computed) |
| || isinf (expected) || isnan (expected)) |
| ok = 0; |
| else |
| { |
| diff = FUNC(fabs) (computed - expected); |
| ulps = ULPDIFF (computed, expected); |
| set_max_error (ulps, curr_max_error); |
| print_diff = 1; |
| if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0 |
| && computed == 0.0 && expected == 0.0 |
| && signbit(computed) != signbit (expected)) |
| ok = 0; |
| else if (ulps <= 0.5 || (ulps <= max_ulp && !ignore_max_ulp)) |
| ok = 1; |
| else |
| { |
| ok = 0; |
| print_ulps (test_name, ulps); |
| } |
| |
| } |
| if (print_screen (ok)) |
| { |
| if (!ok) |
| printf ("Failure: "); |
| printf ("Test: %s\n", test_name); |
| printf ("Result:\n"); |
| printf (" is: "); |
| print_float (computed); |
| printf (" should be: "); |
| print_float (expected); |
| if (print_diff) |
| { |
| printf (" difference: % .20" PRINTF_EXPR " % .20" PRINTF_XEXPR |
| "\n", diff, diff); |
| printf (" ulp : % .4" PRINTF_NEXPR "\n", ulps); |
| printf (" max.ulp : % .4" PRINTF_NEXPR "\n", max_ulp); |
| } |
| } |
| update_stats (ok); |
| |
| out: |
| fpstack_test (test_name); |
| errno = 0; |
| } |
| |
| |
| static void |
| check_float (const char *test_name, FLOAT computed, FLOAT expected, |
| int exceptions) |
| { |
| check_float_internal (test_name, computed, expected, |
| exceptions, &max_error); |
| } |
| |
| |
| static void |
| check_complex (const char *test_name, __complex__ FLOAT computed, |
| __complex__ FLOAT expected, |
| int exception) |
| { |
| FLOAT part_comp, part_exp; |
| char *str; |
| |
| if (asprintf (&str, "Real part of: %s", test_name) == -1) |
| abort (); |
| |
| part_comp = __real__ computed; |
| part_exp = __real__ expected; |
| |
| check_float_internal (str, part_comp, part_exp, |
| exception, &real_max_error); |
| free (str); |
| |
| if (asprintf (&str, "Imaginary part of: %s", test_name) == -1) |
| abort (); |
| |
| part_comp = __imag__ computed; |
| part_exp = __imag__ expected; |
| |
| /* Don't check again for exceptions or errno, just pass through the |
| other relevant flags. */ |
| check_float_internal (str, part_comp, part_exp, |
| exception & (IGNORE_ZERO_INF_SIGN |
| | TEST_NAN_SIGN |
| | IGNORE_RESULT), |
| &imag_max_error); |
| free (str); |
| } |
| |
| |
| /* Check that computed and expected values are equal (int values). */ |
| static void |
| check_int (const char *test_name, int computed, int expected, |
| int exceptions) |
| { |
| int ok = 0; |
| int errno_value = errno; |
| |
| test_exceptions (test_name, exceptions); |
| test_errno (test_name, errno_value, exceptions); |
| if (exceptions & IGNORE_RESULT) |
| goto out; |
| noTests++; |
| if (computed == expected) |
| ok = 1; |
| |
| if (print_screen (ok)) |
| { |
| if (!ok) |
| printf ("Failure: "); |
| printf ("Test: %s\n", test_name); |
| printf ("Result:\n"); |
| printf (" is: %d\n", computed); |
| printf (" should be: %d\n", expected); |
| } |
| |
| update_stats (ok); |
| out: |
| fpstack_test (test_name); |
| errno = 0; |
| } |
| |
| |
| /* Check that computed and expected values are equal (long int values). */ |
| static void |
| check_long (const char *test_name, long int computed, long int expected, |
| int exceptions) |
| { |
| int ok = 0; |
| int errno_value = errno; |
| |
| test_exceptions (test_name, exceptions); |
| test_errno (test_name, errno_value, exceptions); |
| if (exceptions & IGNORE_RESULT) |
| goto out; |
| noTests++; |
| if (computed == expected) |
| ok = 1; |
| |
| if (print_screen (ok)) |
| { |
| if (!ok) |
| printf ("Failure: "); |
| printf ("Test: %s\n", test_name); |
| printf ("Result:\n"); |
| printf (" is: %ld\n", computed); |
| printf (" should be: %ld\n", expected); |
| } |
| |
| update_stats (ok); |
| out: |
| fpstack_test (test_name); |
| errno = 0; |
| } |
| |
| |
| /* Check that computed value is true/false. */ |
| static void |
| check_bool (const char *test_name, int computed, int expected, |
| int exceptions) |
| { |
| int ok = 0; |
| int errno_value = errno; |
| |
| test_exceptions (test_name, exceptions); |
| test_errno (test_name, errno_value, exceptions); |
| if (exceptions & IGNORE_RESULT) |
| goto out; |
| noTests++; |
| if ((computed == 0) == (expected == 0)) |
| ok = 1; |
| |
| if (print_screen (ok)) |
| { |
| if (!ok) |
| printf ("Failure: "); |
| printf ("Test: %s\n", test_name); |
| printf ("Result:\n"); |
| printf (" is: %d\n", computed); |
| printf (" should be: %d\n", expected); |
| } |
| |
| update_stats (ok); |
| out: |
| fpstack_test (test_name); |
| errno = 0; |
| } |
| |
| |
| /* check that computed and expected values are equal (long int values) */ |
| static void |
| check_longlong (const char *test_name, long long int computed, |
| long long int expected, |
| int exceptions) |
| { |
| int ok = 0; |
| int errno_value = errno; |
| |
| test_exceptions (test_name, exceptions); |
| test_errno (test_name, errno_value, exceptions); |
| if (exceptions & IGNORE_RESULT) |
| goto out; |
| noTests++; |
| if (computed == expected) |
| ok = 1; |
| |
| if (print_screen (ok)) |
| { |
| if (!ok) |
| printf ("Failure:"); |
| printf ("Test: %s\n", test_name); |
| printf ("Result:\n"); |
| printf (" is: %lld\n", computed); |
| printf (" should be: %lld\n", expected); |
| } |
| |
| update_stats (ok); |
| out: |
| fpstack_test (test_name); |
| errno = 0; |
| } |
| |
| /* Return whether a test with flags EXCEPTIONS should be run. */ |
| static int |
| enable_test (int exceptions) |
| { |
| if (exceptions & XFAIL_TEST) |
| return 0; |
| #ifdef TEST_INLINE |
| if (exceptions & NO_TEST_INLINE) |
| return 0; |
| #endif |
| return 1; |
| } |
| |
| /* Structures for each kind of test. */ |
| struct test_f_f_data |
| { |
| const char *arg_str; |
| FLOAT arg; |
| FLOAT expected; |
| int exceptions; |
| }; |
| struct test_ff_f_data |
| { |
| const char *arg_str; |
| FLOAT arg1, arg2; |
| FLOAT expected; |
| int exceptions; |
| }; |
| struct test_ff_f_data_nexttoward |
| { |
| const char *arg_str; |
| FLOAT arg1; |
| long double arg2; |
| FLOAT expected; |
| int exceptions; |
| }; |
| struct test_fi_f_data |
| { |
| const char *arg_str; |
| FLOAT arg1; |
| int arg2; |
| FLOAT expected; |
| int exceptions; |
| }; |
| struct test_fl_f_data |
| { |
| const char *arg_str; |
| FLOAT arg1; |
| long int arg2; |
| FLOAT expected; |
| int exceptions; |
| }; |
| struct test_if_f_data |
| { |
| const char *arg_str; |
| int arg1; |
| FLOAT arg2; |
| FLOAT expected; |
| int exceptions; |
| }; |
| struct test_fff_f_data |
| { |
| const char *arg_str; |
| FLOAT arg1, arg2, arg3; |
| FLOAT expected; |
| int exceptions; |
| }; |
| struct test_c_f_data |
| { |
| const char *arg_str; |
| FLOAT argr, argc; |
| FLOAT expected; |
| int exceptions; |
| }; |
| /* Used for both RUN_TEST_LOOP_f_f1 and RUN_TEST_LOOP_fI_f1. */ |
| struct test_f_f1_data |
| { |
| const char *arg_str; |
| FLOAT arg; |
| FLOAT expected; |
| int exceptions; |
| int extra_test; |
| int extra_expected; |
| }; |
| struct test_fF_f1_data |
| { |
| const char *arg_str; |
| FLOAT arg; |
| FLOAT expected; |
| int exceptions; |
| int extra_test; |
| FLOAT extra_expected; |
| }; |
| struct test_ffI_f1_data |
| { |
| const char *arg_str; |
| FLOAT arg1, arg2; |
| FLOAT expected; |
| int exceptions; |
| int extra_test; |
| int extra_expected; |
| }; |
| struct test_c_c_data |
| { |
| const char *arg_str; |
| FLOAT argr, argc; |
| FLOAT expr, expc; |
| int exceptions; |
| }; |
| struct test_cc_c_data |
| { |
| const char *arg_str; |
| FLOAT arg1r, arg1c, arg2r, arg2c; |
| FLOAT expr, expc; |
| int exceptions; |
| }; |
| /* Used for all of RUN_TEST_LOOP_f_i, RUN_TEST_LOOP_f_i_tg, |
| RUN_TEST_LOOP_f_b and RUN_TEST_LOOP_f_b_tg. */ |
| struct test_f_i_data |
| { |
| const char *arg_str; |
| FLOAT arg; |
| int expected; |
| int exceptions; |
| }; |
| struct test_ff_i_data |
| { |
| const char *arg_str; |
| FLOAT arg1, arg2; |
| int expected; |
| int exceptions; |
| }; |
| struct test_f_l_data |
| { |
| const char *arg_str; |
| FLOAT arg; |
| long int expected; |
| int exceptions; |
| }; |
| struct test_f_L_data |
| { |
| const char *arg_str; |
| FLOAT arg; |
| long long int expected; |
| int exceptions; |
| }; |
| struct test_fFF_11_data |
| { |
| const char *arg_str; |
| FLOAT arg; |
| int exceptions; |
| int extra1_test; |
| FLOAT extra1_expected; |
| int extra2_test; |
| FLOAT extra2_expected; |
| }; |
| |
| /* Set the rounding mode, or restore the saved value. */ |
| #define IF_ROUND_INIT_ /* Empty. */ |
| #define IF_ROUND_INIT_FE_DOWNWARD \ |
| int save_round_mode = fegetround (); \ |
| if (ROUNDING_TESTS (FLOAT, FE_DOWNWARD) \ |
| && fesetround (FE_DOWNWARD) == 0) |
| #define IF_ROUND_INIT_FE_TONEAREST \ |
| int save_round_mode = fegetround (); \ |
| if (ROUNDING_TESTS (FLOAT, FE_TONEAREST) \ |
| && fesetround (FE_TONEAREST) == 0) |
| #define IF_ROUND_INIT_FE_TOWARDZERO \ |
| int save_round_mode = fegetround (); \ |
| if (ROUNDING_TESTS (FLOAT, FE_TOWARDZERO) \ |
| && fesetround (FE_TOWARDZERO) == 0) |
| #define IF_ROUND_INIT_FE_UPWARD \ |
| int save_round_mode = fegetround (); \ |
| if (ROUNDING_TESTS (FLOAT, FE_UPWARD) \ |
| && fesetround (FE_UPWARD) == 0) |
| #define ROUND_RESTORE_ /* Empty. */ |
| #define ROUND_RESTORE_FE_DOWNWARD \ |
| fesetround (save_round_mode) |
| #define ROUND_RESTORE_FE_TONEAREST \ |
| fesetround (save_round_mode) |
| #define ROUND_RESTORE_FE_TOWARDZERO \ |
| fesetround (save_round_mode) |
| #define ROUND_RESTORE_FE_UPWARD \ |
| fesetround (save_round_mode) |
| |
| /* Common setup for an individual test. */ |
| #define COMMON_TEST_SETUP(ARG_STR) \ |
| char *test_name; \ |
| if (asprintf (&test_name, "%s (%s)", this_func, (ARG_STR)) == -1) \ |
| abort () |
| |
| /* Setup for a test with an extra output. */ |
| #define EXTRA_OUTPUT_TEST_SETUP(ARG_STR, N) \ |
| char *extra##N##_name; \ |
| if (asprintf (&extra##N##_name, "%s (%s) extra output " #N, \ |
| this_func, (ARG_STR)) == -1) \ |
| abort () |
| |
| /* Common cleanup after an individual test. */ |
| #define COMMON_TEST_CLEANUP \ |
| free (test_name) |
| |
| /* Cleanup for a test with an extra output. */ |
| #define EXTRA_OUTPUT_TEST_CLEANUP(N) \ |
| free (extra##N##_name) |
| |
| /* Run an individual test, including any required setup and checking |
| of results, or loop over all tests in an array. */ |
| #define RUN_TEST_f_f(ARG_STR, FUNC_NAME, ARG, EXPECTED, \ |
| EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_float (test_name, FUNC (FUNC_NAME) (ARG), EXPECTED, \ |
| EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_f_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_f_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_2_f(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \ |
| EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_float (test_name, FUNC (FUNC_NAME) (ARG1, ARG2), \ |
| EXPECTED, EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_2_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_2_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1, \ |
| (ARRAY)[i].arg2, (ARRAY)[i].expected, \ |
| (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_ff_f RUN_TEST_2_f |
| #define RUN_TEST_LOOP_ff_f RUN_TEST_LOOP_2_f |
| #define RUN_TEST_fi_f RUN_TEST_2_f |
| #define RUN_TEST_LOOP_fi_f RUN_TEST_LOOP_2_f |
| #define RUN_TEST_fl_f RUN_TEST_2_f |
| #define RUN_TEST_LOOP_fl_f RUN_TEST_LOOP_2_f |
| #define RUN_TEST_if_f RUN_TEST_2_f |
| #define RUN_TEST_LOOP_if_f RUN_TEST_LOOP_2_f |
| #define RUN_TEST_fff_f(ARG_STR, FUNC_NAME, ARG1, ARG2, ARG3, \ |
| EXPECTED, EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_float (test_name, FUNC (FUNC_NAME) (ARG1, ARG2, ARG3), \ |
| EXPECTED, EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_fff_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_fff_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1, \ |
| (ARRAY)[i].arg2, (ARRAY)[i].arg3, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_c_f(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \ |
| EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_float (test_name, \ |
| FUNC (FUNC_NAME) (BUILD_COMPLEX (ARG1, ARG2)), \ |
| EXPECTED, EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_c_f(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_c_f ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].argr, \ |
| (ARRAY)[i].argc, (ARRAY)[i].expected, \ |
| (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_f_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED, \ |
| EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \ |
| EXTRA_EXPECTED) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \ |
| check_float (test_name, FUNC (FUNC_NAME) (ARG), EXPECTED, \ |
| EXCEPTIONS); \ |
| EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \ |
| if (EXTRA_TEST) \ |
| check_int (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, 0); \ |
| EXTRA_OUTPUT_TEST_CLEANUP (1); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_f_f1(FUNC_NAME, ARRAY, ROUNDING_MODE, EXTRA_VAR) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_f_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions, \ |
| EXTRA_VAR, (ARRAY)[i].extra_test, \ |
| (ARRAY)[i].extra_expected); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_fF_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED, \ |
| EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \ |
| EXTRA_EXPECTED) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \ |
| check_float (test_name, FUNC (FUNC_NAME) (ARG, &(EXTRA_VAR)), \ |
| EXPECTED, EXCEPTIONS); \ |
| EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \ |
| if (EXTRA_TEST) \ |
| check_float (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, 0); \ |
| EXTRA_OUTPUT_TEST_CLEANUP (1); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_fF_f1(FUNC_NAME, ARRAY, ROUNDING_MODE, EXTRA_VAR) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_fF_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions, \ |
| EXTRA_VAR, (ARRAY)[i].extra_test, \ |
| (ARRAY)[i].extra_expected); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_fI_f1(ARG_STR, FUNC_NAME, ARG, EXPECTED, \ |
| EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \ |
| EXTRA_EXPECTED) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \ |
| check_float (test_name, FUNC (FUNC_NAME) (ARG, &(EXTRA_VAR)), \ |
| EXPECTED, EXCEPTIONS); \ |
| EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \ |
| if (EXTRA_TEST) \ |
| check_int (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, 0); \ |
| EXTRA_OUTPUT_TEST_CLEANUP (1); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_fI_f1(FUNC_NAME, ARRAY, ROUNDING_MODE, EXTRA_VAR) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_fI_f1 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions, \ |
| EXTRA_VAR, (ARRAY)[i].extra_test, \ |
| (ARRAY)[i].extra_expected); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_ffI_f1_mod8(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \ |
| EXCEPTIONS, EXTRA_VAR, EXTRA_TEST, \ |
| EXTRA_EXPECTED) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \ |
| check_float (test_name, \ |
| FUNC (FUNC_NAME) (ARG1, ARG2, &(EXTRA_VAR)), \ |
| EXPECTED, EXCEPTIONS); \ |
| EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \ |
| if (EXTRA_TEST) \ |
| check_int (extra1_name, (EXTRA_VAR) % 8, EXTRA_EXPECTED, 0); \ |
| EXTRA_OUTPUT_TEST_CLEANUP (1); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_ffI_f1_mod8(FUNC_NAME, ARRAY, ROUNDING_MODE, \ |
| EXTRA_VAR) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_ffI_f1_mod8 ((ARRAY)[i].arg_str, FUNC_NAME, \ |
| (ARRAY)[i].arg1, (ARRAY)[i].arg2, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions, \ |
| EXTRA_VAR, (ARRAY)[i].extra_test, \ |
| (ARRAY)[i].extra_expected); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_c_c(ARG_STR, FUNC_NAME, ARGR, ARGC, EXPR, EXPC, \ |
| EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_complex (test_name, \ |
| FUNC (FUNC_NAME) (BUILD_COMPLEX (ARGR, ARGC)), \ |
| BUILD_COMPLEX (EXPR, EXPC), EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_c_c(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_c_c ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].argr, \ |
| (ARRAY)[i].argc, (ARRAY)[i].expr, (ARRAY)[i].expc, \ |
| (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_cc_c(ARG_STR, FUNC_NAME, ARG1R, ARG1C, ARG2R, ARG2C, \ |
| EXPR, EXPC, EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_complex (test_name, \ |
| FUNC (FUNC_NAME) (BUILD_COMPLEX (ARG1R, ARG1C), \ |
| BUILD_COMPLEX (ARG2R, ARG2C)), \ |
| BUILD_COMPLEX (EXPR, EXPC), EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_cc_c(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_cc_c ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg1r, \ |
| (ARRAY)[i].arg1c, (ARRAY)[i].arg2r, \ |
| (ARRAY)[i].arg2c, (ARRAY)[i].expr, \ |
| (ARRAY)[i].expc, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_f_i(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_int (test_name, FUNC (FUNC_NAME) (ARG), EXPECTED, \ |
| EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_f_i(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_f_i ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_f_i_tg(ARG_STR, FUNC_NAME, ARG, EXPECTED, \ |
| EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_int (test_name, FUNC_NAME (ARG), EXPECTED, EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_f_i_tg(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_f_i_tg ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_ff_i_tg(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED, \ |
| EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_int (test_name, FUNC_NAME (ARG1, ARG2), EXPECTED, \ |
| EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_ff_i_tg(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_ff_i_tg ((ARRAY)[i].arg_str, FUNC_NAME, \ |
| (ARRAY)[i].arg1, (ARRAY)[i].arg2, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_f_b(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_bool (test_name, FUNC (FUNC_NAME) (ARG), EXPECTED, \ |
| EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_f_b(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_f_b ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_f_b_tg(ARG_STR, FUNC_NAME, ARG, EXPECTED, \ |
| EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_bool (test_name, FUNC_NAME (ARG), EXPECTED, EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_f_b_tg(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_f_b_tg ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_f_l(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_long (test_name, FUNC (FUNC_NAME) (ARG), EXPECTED, \ |
| EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_f_l(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_f_l ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_f_L(ARG_STR, FUNC_NAME, ARG, EXPECTED, EXCEPTIONS) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| check_longlong (test_name, FUNC (FUNC_NAME) (ARG), EXPECTED, \ |
| EXCEPTIONS); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_f_L(FUNC_NAME, ARRAY, ROUNDING_MODE) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_f_L ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].expected, (ARRAY)[i].exceptions); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| #define RUN_TEST_fFF_11(ARG_STR, FUNC_NAME, ARG, EXCEPTIONS, \ |
| EXTRA1_VAR, EXTRA1_TEST, \ |
| EXTRA1_EXPECTED, EXTRA2_VAR, \ |
| EXTRA2_TEST, EXTRA2_EXPECTED) \ |
| do \ |
| if (enable_test (EXCEPTIONS)) \ |
| { \ |
| COMMON_TEST_SETUP (ARG_STR); \ |
| FUNC (FUNC_NAME) (ARG, &(EXTRA1_VAR), &(EXTRA2_VAR)); \ |
| EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1); \ |
| if (EXTRA1_TEST) \ |
| check_float (extra1_name, EXTRA1_VAR, EXTRA1_EXPECTED, \ |
| EXCEPTIONS); \ |
| EXTRA_OUTPUT_TEST_CLEANUP (1); \ |
| EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 2); \ |
| if (EXTRA2_TEST) \ |
| check_float (extra2_name, EXTRA2_VAR, EXTRA2_EXPECTED, 0); \ |
| EXTRA_OUTPUT_TEST_CLEANUP (2); \ |
| COMMON_TEST_CLEANUP; \ |
| } \ |
| while (0) |
| #define RUN_TEST_LOOP_fFF_11(FUNC_NAME, ARRAY, ROUNDING_MODE, \ |
| EXTRA1_VAR, EXTRA2_VAR) \ |
| IF_ROUND_INIT_ ## ROUNDING_MODE \ |
| for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ |
| RUN_TEST_fFF_11 ((ARRAY)[i].arg_str, FUNC_NAME, (ARRAY)[i].arg, \ |
| (ARRAY)[i].exceptions, \ |
| EXTRA1_VAR, (ARRAY)[i].extra1_test, \ |
| (ARRAY)[i].extra1_expected, \ |
| EXTRA2_VAR, \ |
| (ARRAY)[i].extra2_test, \ |
| (ARRAY)[i].extra2_expected); \ |
| ROUND_RESTORE_ ## ROUNDING_MODE |
| |
| /* Start and end the tests for a given function. */ |
| #define START(FUNC) \ |
| const char *this_func = #FUNC; \ |
| init_max_error () |
| #define END \ |
| print_max_error (this_func) |
| #define END_COMPLEX \ |
| print_complex_max_error (this_func) |
| |
| /* This is to prevent messages from the SVID libm emulation. */ |
| int |
| matherr (struct exception *x __attribute__ ((unused))) |
| { |
| return 1; |
| } |
| |
| |
| /**************************************************************************** |
| Tests for single functions of libm. |
| Please keep them alphabetically sorted! |
| ****************************************************************************/ |
| |
| static const struct test_f_f_data acos_test_data[] = |
| { |
| TEST_f_f (acos, plus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acos, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acos, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), |
| |
| /* |x| > 1: */ |
| TEST_f_f (acos, 1.125L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acos, -1.125L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acos, max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acos, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| |
| AUTO_TESTS_f_f (acos, tonearest), |
| }; |
| |
| static void |
| acos_test (void) |
| { |
| START (acos); |
| RUN_TEST_LOOP_f_f (acos, acos_test_data, ); |
| END; |
| } |
| |
| |
| static const struct test_f_f_data acos_tonearest_test_data[] = |
| { |
| AUTO_TESTS_f_f (acos, tonearest), |
| }; |
| |
| static void |
| acos_test_tonearest (void) |
| { |
| START (acos_tonearest); |
| RUN_TEST_LOOP_f_f (acos, acos_tonearest_test_data, FE_TONEAREST); |
| END; |
| } |
| |
| |
| static const struct test_f_f_data acos_towardzero_test_data[] = |
| { |
| AUTO_TESTS_f_f (acos, towardzero), |
| }; |
| |
| static void |
| acos_test_towardzero (void) |
| { |
| START (acos_towardzero); |
| RUN_TEST_LOOP_f_f (acos, acos_towardzero_test_data, FE_TOWARDZERO); |
| END; |
| } |
| |
| |
| static const struct test_f_f_data acos_downward_test_data[] = |
| { |
| AUTO_TESTS_f_f (acos, downward), |
| }; |
| |
| static void |
| acos_test_downward (void) |
| { |
| START (acos_downward); |
| RUN_TEST_LOOP_f_f (acos, acos_downward_test_data, FE_DOWNWARD); |
| END; |
| } |
| |
| |
| static const struct test_f_f_data acos_upward_test_data[] = |
| { |
| AUTO_TESTS_f_f (acos, upward), |
| }; |
| |
| static void |
| acos_test_upward (void) |
| { |
| START (acos_upward); |
| RUN_TEST_LOOP_f_f (acos, acos_upward_test_data, FE_UPWARD); |
| END; |
| } |
| |
| static const struct test_f_f_data acosh_test_data[] = |
| { |
| TEST_f_f (acosh, plus_infty, plus_infty), |
| TEST_f_f (acosh, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), |
| |
| /* x < 1: */ |
| TEST_f_f (acosh, 0.75L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, min_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, min_subnorm_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, plus_zero, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, minus_zero, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, -min_subnorm_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, -min_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, -1.125L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (acosh, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| |
| AUTO_TESTS_f_f (acosh, tonearest), |
| }; |
| |
| static void |
| acosh_test (void) |
| { |
| START (acosh); |
| RUN_TEST_LOOP_f_f (acosh, acosh_test_data, ); |
| END; |
| } |
| |
| static const struct test_f_f_data asin_test_data[] = |
| { |
| TEST_f_f (asin, plus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (asin, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (asin, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), |
| |
| /* asin x == qNaN plus invalid exception for |x| > 1. */ |
| TEST_f_f (asin, 1.125L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (asin, -1.125L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (asin, max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (asin, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| |
| AUTO_TESTS_f_f (asin, tonearest), |
| }; |
| |
| static void |
| asin_test (void) |
| { |
| START (asin); |
| RUN_TEST_LOOP_f_f (asin, asin_test_data, ); |
| END; |
| } |
| |
| |
| static const struct test_f_f_data asin_tonearest_test_data[] = |
| { |
| AUTO_TESTS_f_f (asin, tonearest), |
| }; |
| |
| static void |
| asin_test_tonearest (void) |
| { |
| START (asin_tonearest); |
| RUN_TEST_LOOP_f_f (asin, asin_tonearest_test_data, FE_TONEAREST); |
| END; |
| } |
| |
| |
| static const struct test_f_f_data asin_towardzero_test_data[] = |
| { |
| AUTO_TESTS_f_f (asin, towardzero), |
| }; |
| |
| static void |
| asin_test_towardzero (void) |
| { |
| START (asin_towardzero); |
| RUN_TEST_LOOP_f_f (asin, asin_towardzero_test_data, FE_TOWARDZERO); |
| END; |
| } |
| |
| |
| static const struct test_f_f_data asin_downward_test_data[] = |
| { |
| AUTO_TESTS_f_f (asin, downward), |
| }; |
| |
| static void |
| asin_test_downward (void) |
| { |
| START (asin_downward); |
| RUN_TEST_LOOP_f_f (asin, asin_downward_test_data, FE_DOWNWARD); |
| END; |
| } |
| |
| |
| static const struct test_f_f_data asin_upward_test_data[] = |
| { |
| AUTO_TESTS_f_f (asin, upward), |
| }; |
| |
| static void |
| asin_test_upward (void) |
| { |
| START (asin_upward); |
| RUN_TEST_LOOP_f_f (asin, asin_upward_test_data, FE_UPWARD); |
| END; |
| } |
| |
| static const struct test_f_f_data asinh_test_data[] = |
| { |
| TEST_f_f (asinh, plus_infty, plus_infty, NO_TEST_INLINE), |
| TEST_f_f (asinh, minus_infty, minus_infty, NO_TEST_INLINE), |
| TEST_f_f (asinh, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), |
| AUTO_TESTS_f_f (asinh, tonearest), |
| }; |
| |
| static void |
| asinh_test (void) |
| { |
| START (asinh); |
| RUN_TEST_LOOP_f_f (asinh, asinh_test_data, ); |
| END; |
| } |
| |
| static const struct test_f_f_data atan_test_data[] = |
| { |
| TEST_f_f (atan, plus_infty, M_PI_2l), |
| TEST_f_f (atan, minus_infty, -M_PI_2l), |
| TEST_f_f (atan, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), |
| |
| AUTO_TESTS_f_f (atan, tonearest), |
| }; |
| |
| static void |
| atan_test (void) |
| { |
| START (atan); |
| RUN_TEST_LOOP_f_f (atan, atan_test_data, ); |
| END; |
| } |
| |
| |
| |
| static const struct test_f_f_data atanh_test_data[] = |
| { |
| TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE), |
| TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE), |
| TEST_f_f (atanh, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), |
| |
| /* atanh (x) == qNaN plus invalid exception if |x| > 1. */ |
| TEST_f_f (atanh, 1.125L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (atanh, -1.125L, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (atanh, max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (atanh, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (atanh, plus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| TEST_f_f (atanh, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM), |
| |
| AUTO_TESTS_f_f (atanh, tonearest), |
| }; |
| |
| static void |
| atanh_test (void) |
| { |
| START (atanh); |
| RUN_TEST_LOOP_f_f (atanh, atanh_test_data, ); |
| END; |
| } |
| |
| static const struct test_ff_f_data atan2_test_data[] = |
| { |
| /* atan2 (y,inf) == +0 for finite y > 0. */ |
| TEST_ff_f (atan2, 1, plus_infty, 0), |
| |
| /* atan2 (y,inf) == -0 for finite y < 0. */ |
| TEST_ff_f (atan2, -1, plus_infty, minus_zero), |
| |
| /* atan2(+inf, x) == pi/2 for finite x. */ |
| TEST_ff_f (atan2, plus_infty, -1, M_PI_2l), |
| |
| /* atan2(-inf, x) == -pi/2 for finite x. */ |
| TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l), |
| |
| /* atan2 (y,-inf) == +pi for finite y > 0. */ |
| TEST_ff_f (atan2, 1, minus_infty, M_PIl), |
| |
| /* atan2 (y,-inf) == -pi for finite y < 0. */ |
| TEST_ff_f (atan2, -1, minus_infty, -M_PIl), |
| |
| TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l), |
| TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l), |
| TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l), |
| TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l), |
| TEST_ff_f (atan2, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION), |
| |
| AUTO_TESTS_ff_f (atan2, tonearest), |
| }; |
| |
| static void |
| atan2_test (void) |
| { |
| START (atan2); |
| RUN_TEST_LOOP_ff_f (atan2, atan2_test_data, ); |
| END; |
| } |
| |
| static const struct test_c_f_data cabs_test_data[] = |
| { |
| /* cabs (x + iy) is specified as hypot (x,y) */ |
| |
| /* cabs (+inf + i x) == +inf. */ |
| TEST_c_f (cabs, plus_infty, 1.0, plus_infty), |
| /* cabs (-inf + i x) == +inf. */ |
| TEST_c_f (cabs, minus_infty, 1.0, plus_infty), |
| |
| TEST_c_f (cabs, minus_infty, qnan_value, plus_infty), |
| TEST_c_f (cabs, minus_infty, qnan_value, plus_infty), |
| |
| TEST_c_f (cabs, qnan_value, qnan_value, qnan_value), |
| |
| AUTO_TESTS_c_f (cabs, tonearest), |
| }; |
| |
| static void |
| cabs_test (void) |
| { |
| START (cabs); |
| RUN_TEST_LOOP_c_f (cabs, cabs_test_data, ); |
| END; |
| } |
| |
| |
| static const struct test_c_c_data cacos_test_data[] = |
| { |
| TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero), |
| TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero), |
| TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0), |
| TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0), |
| |
| TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty), |
| TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty), |
| |
| TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty), |
| TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty), |
| |
| TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty), |
| TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty), |
| TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty), |
| TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty), |
| TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty), |
| TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty), |
| |
| TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty), |
| TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty), |
| TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty), |
| TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty), |
| |
| TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty), |
| TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty), |
| TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty), |
| TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty), |
| |
| TEST_c_c (cacos, plus_infty, qnan_value, qnan_value, plus_infty, IGNORE_ZERO_INF_SIGN), |
| TEST_c_c (cacos, minus_infty, qnan_value, qnan_value, plus_infty, IGNORE_ZERO_INF_SIGN), |
| |
| TEST_c_c (cacos, 0, qnan_value, M_PI_2l, qnan_value), |
| TEST_c_c (cacos, minus_zero, qnan_value, M_PI_2l, qnan_value), |
| |
| TEST_c_c (cacos, qnan_value, plus_infty, qnan_value, minus_infty), |
| TEST_c_c (cacos, qnan_value, minus_infty, qnan_value, plus_infty), |
| |
| TEST_c_c (cacos, 10.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK), |
| TEST_c_c (cacos, -10.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK), |
| |
| TEST_c_c (cacos, qnan_value, 0.75, qnan_value, qnan_value, INVALID_EXCEPTION_OK), |
| TEST_c_c (cacos, qnan_value, -0.75, qnan_value, qnan_value, INVALID_EXCEPTION_OK), |
| |
| TEST_c_c (cacos, qnan_value, qnan_value, qnan_value, qnan_value), |
| |
| TEST_c_c (cacos, plus_zero, -1.5L, M_PI_2l, 1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, minus_zero, -1.5L, M_PI_2l, 1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, plus_zero, -1.0L, M_PI_2l, 0.8813735870195430252326093249797923090282L), |
| TEST_c_c (cacos, minus_zero, -1.0L, M_PI_2l, 0.8813735870195430252326093249797923090282L), |
| TEST_c_c (cacos, plus_zero, -0.5L, M_PI_2l, 0.4812118250596034474977589134243684231352L), |
| TEST_c_c (cacos, minus_zero, -0.5L, M_PI_2l, 0.4812118250596034474977589134243684231352L), |
| TEST_c_c (cacos, plus_zero, 0.5L, M_PI_2l, -0.4812118250596034474977589134243684231352L), |
| TEST_c_c (cacos, minus_zero, 0.5L, M_PI_2l, -0.4812118250596034474977589134243684231352L), |
| TEST_c_c (cacos, plus_zero, 1.0L, M_PI_2l, -0.8813735870195430252326093249797923090282L), |
| TEST_c_c (cacos, minus_zero, 1.0L, M_PI_2l, -0.8813735870195430252326093249797923090282L), |
| TEST_c_c (cacos, plus_zero, 1.5L, M_PI_2l, -1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, minus_zero, 1.5L, M_PI_2l, -1.194763217287109304111930828519090523536L), |
| |
| TEST_c_c (cacos, -1.5L, plus_zero, M_PIl, -0.9624236501192068949955178268487368462704L), |
| TEST_c_c (cacos, -1.5L, minus_zero, M_PIl, 0.9624236501192068949955178268487368462704L), |
| TEST_c_c (cacos, -1.0L, plus_zero, M_PIl, minus_zero), |
| TEST_c_c (cacos, -1.0L, minus_zero, M_PIl, plus_zero), |
| TEST_c_c (cacos, -0.5L, plus_zero, 2.094395102393195492308428922186335256131L, minus_zero), |
| TEST_c_c (cacos, -0.5L, minus_zero, 2.094395102393195492308428922186335256131L, plus_zero), |
| TEST_c_c (cacos, 0.5L, plus_zero, 1.047197551196597746154214461093167628066L, minus_zero), |
| TEST_c_c (cacos, 0.5L, minus_zero, 1.047197551196597746154214461093167628066L, plus_zero), |
| TEST_c_c (cacos, 1.0L, plus_zero, plus_zero, minus_zero), |
| TEST_c_c (cacos, 1.0L, minus_zero, plus_zero, plus_zero), |
| TEST_c_c (cacos, 1.5L, plus_zero, plus_zero, -0.9624236501192068949955178268487368462704L), |
| TEST_c_c (cacos, 1.5L, minus_zero, plus_zero, 0.9624236501192068949955178268487368462704L), |
| |
| TEST_c_c (cacos, 0x1p50L, 1.0L, 8.881784197001252323389053344727730248720e-16L, -3.535050620855721078027883819436720218708e1L), |
| TEST_c_c (cacos, 0x1p50L, -1.0L, 8.881784197001252323389053344727730248720e-16L, 3.535050620855721078027883819436720218708e1L), |
| TEST_c_c (cacos, -0x1p50L, 1.0L, 3.141592653589792350284223683154270545292L, -3.535050620855721078027883819436720218708e1L), |
| TEST_c_c (cacos, -0x1p50L, -1.0L, 3.141592653589792350284223683154270545292L, 3.535050620855721078027883819436720218708e1L), |
| TEST_c_c (cacos, 1.0L, 0x1p50L, 1.570796326794895731052901991514519103193L, -3.535050620855721078027883819436759661753e1L), |
| TEST_c_c (cacos, -1.0L, 0x1p50L, 1.570796326794897507409741391764983781004L, -3.535050620855721078027883819436759661753e1L), |
| TEST_c_c (cacos, 1.0L, -0x1p50L, 1.570796326794895731052901991514519103193L, 3.535050620855721078027883819436759661753e1L), |
| TEST_c_c (cacos, -1.0L, -0x1p50L, 1.570796326794897507409741391764983781004L, 3.535050620855721078027883819436759661753e1L), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1p500L, 1.0L, 3.054936363499604682051979393213617699789e-151L, -3.472667374605326000180332928505464606058e2L), |
| TEST_c_c (cacos, 0x1p500L, -1.0L, 3.054936363499604682051979393213617699789e-151L, 3.472667374605326000180332928505464606058e2L), |
| TEST_c_c (cacos, -0x1p500L, 1.0L, 3.141592653589793238462643383279502884197L, -3.472667374605326000180332928505464606058e2L), |
| TEST_c_c (cacos, -0x1p500L, -1.0L, 3.141592653589793238462643383279502884197L, 3.472667374605326000180332928505464606058e2L), |
| TEST_c_c (cacos, 1.0L, 0x1p500L, 1.570796326794896619231321691639751442099L, -3.472667374605326000180332928505464606058e2L), |
| TEST_c_c (cacos, -1.0L, 0x1p500L, 1.570796326794896619231321691639751442099L, -3.472667374605326000180332928505464606058e2L), |
| TEST_c_c (cacos, 1.0L, -0x1p500L, 1.570796326794896619231321691639751442099L, 3.472667374605326000180332928505464606058e2L), |
| TEST_c_c (cacos, -1.0L, -0x1p500L, 1.570796326794896619231321691639751442099L, 3.472667374605326000180332928505464606058e2L), |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 |
| TEST_c_c (cacos, 0x1p5000L, 1.0L, 7.079811261048172892385615158694057552948e-1506L, -3.466429049980286492395577839412341016946e3L), |
| TEST_c_c (cacos, 0x1p5000L, -1.0L, 7.079811261048172892385615158694057552948e-1506L, 3.466429049980286492395577839412341016946e3L), |
| TEST_c_c (cacos, -0x1p5000L, 1.0L, 3.141592653589793238462643383279502884197L, -3.466429049980286492395577839412341016946e3L), |
| TEST_c_c (cacos, -0x1p5000L, -1.0L, 3.141592653589793238462643383279502884197L, 3.466429049980286492395577839412341016946e3L), |
| TEST_c_c (cacos, 1.0L, 0x1p5000L, 1.570796326794896619231321691639751442099L, -3.466429049980286492395577839412341016946e3L), |
| TEST_c_c (cacos, -1.0L, 0x1p5000L, 1.570796326794896619231321691639751442099L, -3.466429049980286492395577839412341016946e3L), |
| TEST_c_c (cacos, 1.0L, -0x1p5000L, 1.570796326794896619231321691639751442099L, 3.466429049980286492395577839412341016946e3L), |
| TEST_c_c (cacos, -1.0L, -0x1p5000L, 1.570796326794896619231321691639751442099L, 3.466429049980286492395577839412341016946e3L), |
| #endif |
| |
| TEST_c_c (cacos, 0x1.fp127L, 0x1.fp127L, 7.853981633974483096156608458198757210493e-1L, -8.973081118419833726837456344608533993585e1L), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1.fp1023L, 0x1.fp1023L, 7.853981633974483096156608458198757210493e-1L, -7.107906849659093345062145442726115449315e2L), |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 |
| TEST_c_c (cacos, 0x1.fp16383L, 0x1.fp16383L, 7.853981633974483096156608458198757210493e-1L, -1.135753137836666928715489992987020363057e4L), |
| #endif |
| |
| TEST_c_c (cacos, 0x1.fp-129L, 1.5L, 1.570796326794896619231321691639751442097L, -1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, 0x1.fp-129L, -1.5L, 1.570796326794896619231321691639751442097L, 1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, -0x1.fp-129L, 1.5L, 1.570796326794896619231321691639751442100L, -1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, -0x1.fp-129L, -1.5L, 1.570796326794896619231321691639751442100L, 1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, 1.5L, 0x1.fp-129L, 2.546345110742945032959687790021055102355e-39L, -9.624236501192068949955178268487368462704e-1L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, -1.5L, 0x1.fp-129L, 3.141592653589793238462643383279502884195L, -9.624236501192068949955178268487368462704e-1L), |
| TEST_c_c (cacos, 1.5L, -0x1.fp-129L, 2.546345110742945032959687790021055102355e-39L, 9.624236501192068949955178268487368462704e-1L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, -1.5L, -0x1.fp-129L, 3.141592653589793238462643383279502884195L, 9.624236501192068949955178268487368462704e-1L), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1.fp-1025L, 1.5L, 1.570796326794896619231321691639751442099L, -1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, 0x1.fp-1025L, -1.5L, 1.570796326794896619231321691639751442099L, 1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, -0x1.fp-1025L, 1.5L, 1.570796326794896619231321691639751442099L, -1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, -0x1.fp-1025L, -1.5L, 1.570796326794896619231321691639751442099L, 1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, 1.5L, 0x1.fp-1025L, 4.819934639999230680322935210539402497827e-309L, -9.624236501192068949955178268487368462704e-1L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, -1.5L, 0x1.fp-1025L, 3.141592653589793238462643383279502884197L, -9.624236501192068949955178268487368462704e-1L), |
| TEST_c_c (cacos, 1.5L, -0x1.fp-1025L, 4.819934639999230680322935210539402497827e-309L, 9.624236501192068949955178268487368462704e-1L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, -1.5L, -0x1.fp-1025L, 3.141592653589793238462643383279502884197L, 9.624236501192068949955178268487368462704e-1L), |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 |
| TEST_c_c (cacos, 0x1.fp-16385L, 1.5L, 1.570796326794896619231321691639751442099L, -1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, 0x1.fp-16385L, -1.5L, 1.570796326794896619231321691639751442099L, 1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, -0x1.fp-16385L, 1.5L, 1.570796326794896619231321691639751442099L, -1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, -0x1.fp-16385L, -1.5L, 1.570796326794896619231321691639751442099L, 1.194763217287109304111930828519090523536L), |
| TEST_c_c (cacos, 1.5L, 0x1.fp-16385L, 7.282957076134209141226696333885150260319e-4933L, -9.624236501192068949955178268487368462704e-1L, UNDERFLOW_EXCEPTION), |
| TEST_c_c (cacos, -1.5L, 0x1.fp-16385L, 3.141592653589793238462643383279502884197L, -9.624236501192068949955178268487368462704e-1L), |
| TEST_c_c (cacos, 1.5L, -0x1.fp-16385L, 7.282957076134209141226696333885150260319e-4933L, 9.624236501192068949955178268487368462704e-1L, UNDERFLOW_EXCEPTION), |
| TEST_c_c (cacos, -1.5L, -0x1.fp-16385L, 3.141592653589793238462643383279502884197L, 9.624236501192068949955178268487368462704e-1L), |
| #endif |
| |
| TEST_c_c (cacos, 0.5L, 1.0L, 1.221357263937683325603909865564381489366L, -9.261330313501824245501244453057873152694e-1L), |
| TEST_c_c (cacos, 0.5L, -1.0L, 1.221357263937683325603909865564381489366L, 9.261330313501824245501244453057873152694e-1L), |
| TEST_c_c (cacos, -0.5L, 1.0L, 1.920235389652109912858733517715121394831L, -9.261330313501824245501244453057873152694e-1L), |
| TEST_c_c (cacos, -0.5L, -1.0L, 1.920235389652109912858733517715121394831L, 9.261330313501824245501244453057873152694e-1L), |
| TEST_c_c (cacos, 1.0L, 0.5L, 6.748888455860063801646649673121744318756e-1L, -7.328576759736452608886724437653071523305e-1L), |
| TEST_c_c (cacos, -1.0L, 0.5L, 2.466703808003786858297978415967328452322L, -7.328576759736452608886724437653071523305e-1L), |
| TEST_c_c (cacos, 1.0L, -0.5L, 6.748888455860063801646649673121744318756e-1L, 7.328576759736452608886724437653071523305e-1L), |
| TEST_c_c (cacos, -1.0L, -0.5L, 2.466703808003786858297978415967328452322L, 7.328576759736452608886724437653071523305e-1L), |
| TEST_c_c (cacos, 0.25L, 1.0L, 1.394493894017929688812643125003661339452L, -8.924633639033482359562124741744951972772e-1L), |
| TEST_c_c (cacos, 0.25L, -1.0L, 1.394493894017929688812643125003661339452L, 8.924633639033482359562124741744951972772e-1L), |
| TEST_c_c (cacos, -0.25L, 1.0L, 1.747098759571863549650000258275841544745L, -8.924633639033482359562124741744951972772e-1L), |
| TEST_c_c (cacos, -0.25L, -1.0L, 1.747098759571863549650000258275841544745L, 8.924633639033482359562124741744951972772e-1L), |
| TEST_c_c (cacos, 1.0L, 0.25L, 4.890443302710802929202843732146540079124e-1L, -5.097911466811016354623559941115413499164e-1L), |
| TEST_c_c (cacos, -1.0L, 0.25L, 2.652548323318712945542359010064848876285L, -5.097911466811016354623559941115413499164e-1L), |
| TEST_c_c (cacos, 1.0L, -0.25L, 4.890443302710802929202843732146540079124e-1L, 5.097911466811016354623559941115413499164e-1L), |
| TEST_c_c (cacos, -1.0L, -0.25L, 2.652548323318712945542359010064848876285L, 5.097911466811016354623559941115413499164e-1L), |
| TEST_c_c (cacos, 0x1.fp-10L, 1.0L, 1.569458417435338878318763342108699202986L, -8.813742198809567991336704287826445879025e-1L), |
| TEST_c_c (cacos, 0x1.fp-10L, -1.0L, 1.569458417435338878318763342108699202986L, 8.813742198809567991336704287826445879025e-1L), |
| TEST_c_c (cacos, -0x1.fp-10L, 1.0L, 1.572134236154454360143880041170803681211L, -8.813742198809567991336704287826445879025e-1L), |
| TEST_c_c (cacos, -0x1.fp-10L, -1.0L, 1.572134236154454360143880041170803681211L, 8.813742198809567991336704287826445879025e-1L), |
| TEST_c_c (cacos, 1.0L, 0x1.fp-10L, 4.349129763101882771258049954181971959031e-2L, -4.350501469856803800217957402220976497152e-2L), |
| TEST_c_c (cacos, -1.0L, 0x1.fp-10L, 3.098101355958774410750062883737683164607L, -4.350501469856803800217957402220976497152e-2L), |
| TEST_c_c (cacos, 1.0L, -0x1.fp-10L, 4.349129763101882771258049954181971959031e-2L, 4.350501469856803800217957402220976497152e-2L), |
| TEST_c_c (cacos, -1.0L, -0x1.fp-10L, 3.098101355958774410750062883737683164607L, 4.350501469856803800217957402220976497152e-2L), |
| TEST_c_c (cacos, 0x1.fp-30L, 1.0L, 1.570796325518966635014803151387033957091L, -8.813735870195430258081932989769495326854e-1L), |
| TEST_c_c (cacos, 0x1.fp-30L, -1.0L, 1.570796325518966635014803151387033957091L, 8.813735870195430258081932989769495326854e-1L), |
| TEST_c_c (cacos, -0x1.fp-30L, 1.0L, 1.570796328070826603447840231892468927106L, -8.813735870195430258081932989769495326854e-1L), |
| TEST_c_c (cacos, -0x1.fp-30L, -1.0L, 1.570796328070826603447840231892468927106L, 8.813735870195430258081932989769495326854e-1L), |
| TEST_c_c (cacos, 1.0L, 0x1.fp-30L, 4.247867097467650115899790787875186617316e-5L, -4.247867098745151888768727039216644758847e-5L), |
| TEST_c_c (cacos, -1.0L, 0x1.fp-30L, 3.141550174918818561961484385371624132331L, -4.247867098745151888768727039216644758847e-5L), |
| TEST_c_c (cacos, 1.0L, -0x1.fp-30L, 4.247867097467650115899790787875186617316e-5L, 4.247867098745151888768727039216644758847e-5L), |
| TEST_c_c (cacos, -1.0L, -0x1.fp-30L, 3.141550174918818561961484385371624132331L, 4.247867098745151888768727039216644758847e-5L), |
| TEST_c_c (cacos, 0x1.fp-100L, 1.0L, 1.570796326794896619231321691638670687364L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 0x1.fp-100L, -1.0L, 1.570796326794896619231321691638670687364L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-100L, 1.0L, 1.570796326794896619231321691640832196834L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-100L, -1.0L, 1.570796326794896619231321691640832196834L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 1.0L, 0x1.fp-100L, 1.236292038260260888664514866456887257525e-15L, -1.236292038260260888664514866457202186027e-15L), |
| TEST_c_c (cacos, -1.0L, 0x1.fp-100L, 3.141592653589792002170605123018614219682L, -1.236292038260260888664514866457202186027e-15L), |
| TEST_c_c (cacos, 1.0L, -0x1.fp-100L, 1.236292038260260888664514866456887257525e-15L, 1.236292038260260888664514866457202186027e-15L), |
| TEST_c_c (cacos, -1.0L, -0x1.fp-100L, 3.141592653589792002170605123018614219682L, 1.236292038260260888664514866457202186027e-15L), |
| TEST_c_c (cacos, 0x1.fp-129L, 1.0L, 1.570796326794896619231321691639751442097L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 0x1.fp-129L, -1.0L, 1.570796326794896619231321691639751442097L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-129L, 1.0L, 1.570796326794896619231321691639751442101L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-129L, -1.0L, 1.570796326794896619231321691639751442101L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 1.0L, 0x1.fp-129L, 5.335635276982233498398987585285818977930e-20L, -5.335635276982233498398987585285818977933e-20L), |
| TEST_c_c (cacos, -1.0L, 0x1.fp-129L, 3.141592653589793238409287030509680549213L, -5.335635276982233498398987585285818977933e-20L), |
| TEST_c_c (cacos, 1.0L, -0x1.fp-129L, 5.335635276982233498398987585285818977930e-20L, 5.335635276982233498398987585285818977933e-20L), |
| TEST_c_c (cacos, -1.0L, -0x1.fp-129L, 3.141592653589793238409287030509680549213L, 5.335635276982233498398987585285818977933e-20L), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1.fp-1000L, 1.0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 0x1.fp-1000L, -1.0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-1000L, 1.0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-1000L, -1.0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 1.0L, 0x1.fp-1000L, 4.252291453851660175550490409247739011867e-151L, -4.252291453851660175550490409247739011867e-151L), |
| TEST_c_c (cacos, -1.0L, 0x1.fp-1000L, 3.141592653589793238462643383279502884197L, -4.252291453851660175550490409247739011867e-151L), |
| TEST_c_c (cacos, 1.0L, -0x1.fp-1000L, 4.252291453851660175550490409247739011867e-151L, 4.252291453851660175550490409247739011867e-151L), |
| TEST_c_c (cacos, -1.0L, -0x1.fp-1000L, 3.141592653589793238462643383279502884197L, 4.252291453851660175550490409247739011867e-151L), |
| TEST_c_c (cacos, 0x1.fp-1025L, 1.0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 0x1.fp-1025L, -1.0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, 1.0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, -1.0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 1.0L, 0x1.fp-1025L, 7.340879205566679497036857179189356754017e-155L, -7.340879205566679497036857179189356754017e-155L), |
| TEST_c_c (cacos, -1.0L, 0x1.fp-1025L, 3.141592653589793238462643383279502884197L, -7.340879205566679497036857179189356754017e-155L), |
| TEST_c_c (cacos, 1.0L, -0x1.fp-1025L, 7.340879205566679497036857179189356754017e-155L, 7.340879205566679497036857179189356754017e-155L), |
| TEST_c_c (cacos, -1.0L, -0x1.fp-1025L, 3.141592653589793238462643383279502884197L, 7.340879205566679497036857179189356754017e-155L), |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 |
| TEST_c_c (cacos, 0x1.fp-10000L, 1.0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 0x1.fp-10000L, -1.0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-10000L, 1.0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-10000L, -1.0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 1.0L, 0x1.fp-10000L, 9.854680208706673586644342922051388714633e-1506L, -9.854680208706673586644342922051388714633e-1506L), |
| TEST_c_c (cacos, -1.0L, 0x1.fp-10000L, 3.141592653589793238462643383279502884197L, -9.854680208706673586644342922051388714633e-1506L), |
| TEST_c_c (cacos, 1.0L, -0x1.fp-10000L, 9.854680208706673586644342922051388714633e-1506L, 9.854680208706673586644342922051388714633e-1506L), |
| TEST_c_c (cacos, -1.0L, -0x1.fp-10000L, 3.141592653589793238462643383279502884197L, 9.854680208706673586644342922051388714633e-1506L), |
| TEST_c_c (cacos, 0x1.fp-16385L, 1.0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 0x1.fp-16385L, -1.0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-16385L, 1.0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, -0x1.fp-16385L, -1.0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797923090282e-1L), |
| TEST_c_c (cacos, 1.0L, 0x1.fp-16385L, 9.023632056840860275214893047597614177639e-2467L, -9.023632056840860275214893047597614177639e-2467L), |
| TEST_c_c (cacos, -1.0L, 0x1.fp-16385L, 3.141592653589793238462643383279502884197L, -9.023632056840860275214893047597614177639e-2467L), |
| TEST_c_c (cacos, 1.0L, -0x1.fp-16385L, 9.023632056840860275214893047597614177639e-2467L, 9.023632056840860275214893047597614177639e-2467L), |
| TEST_c_c (cacos, -1.0L, -0x1.fp-16385L, 3.141592653589793238462643383279502884197L, 9.023632056840860275214893047597614177639e-2467L), |
| #endif |
| |
| TEST_c_c (cacos, 0x1p-23L, 0x1.000002p0L, 1.570796242501204621739026081991856762292L, -8.813736713132400470205730751186547909968e-1L), |
| TEST_c_c (cacos, 0x1p-23L, -0x1.000002p0L, 1.570796242501204621739026081991856762292L, 8.813736713132400470205730751186547909968e-1L), |
| TEST_c_c (cacos, -0x1p-23L, 0x1.000002p0L, 1.570796411088588616723617301287646121905L, -8.813736713132400470205730751186547909968e-1L), |
| TEST_c_c (cacos, -0x1p-23L, -0x1.000002p0L, 1.570796411088588616723617301287646121905L, 8.813736713132400470205730751186547909968e-1L), |
| TEST_c_c (cacos, 0x1.000002p0L, 0x1p-23L, 2.222118384408546368406374049167636760903e-4L, -5.364668491573609633134147164031476452679e-4L), |
| TEST_c_c (cacos, -0x1.000002p0L, 0x1p-23L, 3.141370441751352383825802745874586120521L, -5.364668491573609633134147164031476452679e-4L), |
| TEST_c_c (cacos, 0x1.000002p0L, -0x1p-23L, 2.222118384408546368406374049167636760903e-4L, 5.364668491573609633134147164031476452679e-4L), |
| TEST_c_c (cacos, -0x1.000002p0L, -0x1p-23L, 3.141370441751352383825802745874586120521L, 5.364668491573609633134147164031476452679e-4L), |
| TEST_c_c (cacos, 0x1.fp-129L, 0x1.000002p0L, 1.570796326794896619231321691639751442097L, -8.813736713132375348727889167749389235161e-1L), |
| TEST_c_c (cacos, 0x1.fp-129L, -0x1.000002p0L, 1.570796326794896619231321691639751442097L, 8.813736713132375348727889167749389235161e-1L), |
| TEST_c_c (cacos, -0x1.fp-129L, 0x1.000002p0L, 1.570796326794896619231321691639751442101L, -8.813736713132375348727889167749389235161e-1L), |
| TEST_c_c (cacos, -0x1.fp-129L, -0x1.000002p0L, 1.570796326794896619231321691639751442101L, 8.813736713132375348727889167749389235161e-1L), |
| TEST_c_c (cacos, 0x1.000002p0L, 0x1.fp-129L, 5.830451806317544230969669308596361881467e-36L, -4.882812451493617206486388134172712975070e-4L), |
| TEST_c_c (cacos, -0x1.000002p0L, 0x1.fp-129L, 3.141592653589793238462643383279502878367L, -4.882812451493617206486388134172712975070e-4L), |
| TEST_c_c (cacos, 0x1.000002p0L, -0x1.fp-129L, 5.830451806317544230969669308596361881467e-36L, 4.882812451493617206486388134172712975070e-4L), |
| TEST_c_c (cacos, -0x1.000002p0L, -0x1.fp-129L, 3.141592653589793238462643383279502878367L, 4.882812451493617206486388134172712975070e-4L), |
| TEST_c_c (cacos, 0.0L, 0x1.000002p0L, 1.570796326794896619231321691639751442099L, -8.813736713132375348727889167749389235161e-1L), |
| TEST_c_c (cacos, 0.0L, -0x1.000002p0L, 1.570796326794896619231321691639751442099L, 8.813736713132375348727889167749389235161e-1L), |
| TEST_c_c (cacos, -0.0L, 0x1.000002p0L, 1.570796326794896619231321691639751442099L, -8.813736713132375348727889167749389235161e-1L), |
| TEST_c_c (cacos, -0.0L, -0x1.000002p0L, 1.570796326794896619231321691639751442099L, 8.813736713132375348727889167749389235161e-1L), |
| TEST_c_c (cacos, 0x1.000002p0L, 0.0L, 0.0L, -4.882812451493617206486388134172712975070e-4L), |
| TEST_c_c (cacos, -0x1.000002p0L, 0.0L, 3.141592653589793238462643383279502884197L, -4.882812451493617206486388134172712975070e-4L), |
| TEST_c_c (cacos, 0x1.000002p0L, -0.0L, 0.0L, 4.882812451493617206486388134172712975070e-4L), |
| TEST_c_c (cacos, -0x1.000002p0L, -0.0L, 3.141592653589793238462643383279502884197L, 4.882812451493617206486388134172712975070e-4L), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1p-52L, 0x1.0000000000001p0L, 1.570796326794896462222075823262262934288L, -8.813735870195431822418551933572982483664e-1L), |
| TEST_c_c (cacos, 0x1p-52L, -0x1.0000000000001p0L, 1.570796326794896462222075823262262934288L, 8.813735870195431822418551933572982483664e-1L), |
| TEST_c_c (cacos, -0x1p-52L, 0x1.0000000000001p0L, 1.570796326794896776240567560017239949909L, -8.813735870195431822418551933572982483664e-1L), |
| TEST_c_c (cacos, -0x1p-52L, -0x1.0000000000001p0L, 1.570796326794896776240567560017239949909L, 8.813735870195431822418551933572982483664e-1L), |
| TEST_c_c (cacos, 0x1.0000000000001p0L, 0x1p-52L, 9.590301705980041385828904092662391018164e-9L, -2.315303644582684770975188768022139415020e-8L), |
| TEST_c_c (cacos, -0x1.0000000000001p0L, 0x1p-52L, 3.141592643999491532482601997450598791535L, -2.315303644582684770975188768022139415020e-8L), |
| TEST_c_c (cacos, 0x1.0000000000001p0L, -0x1p-52L, 9.590301705980041385828904092662391018164e-9L, 2.315303644582684770975188768022139415020e-8L), |
| TEST_c_c (cacos, -0x1.0000000000001p0L, -0x1p-52L, 3.141592643999491532482601997450598791535L, 2.315303644582684770975188768022139415020e-8L), |
| TEST_c_c (cacos, 0x1.fp-1025L, 0x1.0000000000001p0L, 1.570796326794896619231321691639751442099L, -8.813735870195431822418551933572895326024e-1L), |
| TEST_c_c (cacos, 0x1.fp-1025L, -0x1.0000000000001p0L, 1.570796326794896619231321691639751442099L, 8.813735870195431822418551933572895326024e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, 0x1.0000000000001p0L, 1.570796326794896619231321691639751442099L, -8.813735870195431822418551933572895326024e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, -0x1.0000000000001p0L, 1.570796326794896619231321691639751442099L, 8.813735870195431822418551933572895326024e-1L), |
| TEST_c_c (cacos, 0x1.0000000000001p0L, 0x1.fp-1025L, 2.557178503953494342609835913586108008322e-301L, -2.107342425544701550354780375182800088393e-8L, UNDERFLOW_EXCEPTION_LDOUBLE_IBM), |
| TEST_c_c (cacos, -0x1.0000000000001p0L, 0x1.fp-1025L, 3.141592653589793238462643383279502884197L, -2.107342425544701550354780375182800088393e-8L), |
| TEST_c_c (cacos, 0x1.0000000000001p0L, -0x1.fp-1025L, 2.557178503953494342609835913586108008322e-301L, 2.107342425544701550354780375182800088393e-8L, UNDERFLOW_EXCEPTION_LDOUBLE_IBM), |
| TEST_c_c (cacos, -0x1.0000000000001p0L, -0x1.fp-1025L, 3.141592653589793238462643383279502884197L, 2.107342425544701550354780375182800088393e-8L), |
| TEST_c_c (cacos, 0.0L, 0x1.0000000000001p0L, 1.570796326794896619231321691639751442099L, -8.813735870195431822418551933572895326024e-1L), |
| TEST_c_c (cacos, 0.0L, -0x1.0000000000001p0L, 1.570796326794896619231321691639751442099L, 8.813735870195431822418551933572895326024e-1L), |
| TEST_c_c (cacos, -0.0L, 0x1.0000000000001p0L, 1.570796326794896619231321691639751442099L, -8.813735870195431822418551933572895326024e-1L), |
| TEST_c_c (cacos, -0.0L, -0x1.0000000000001p0L, 1.570796326794896619231321691639751442099L, 8.813735870195431822418551933572895326024e-1L), |
| TEST_c_c (cacos, 0x1.0000000000001p0L, 0.0L, 0.0L, -2.107342425544701550354780375182800088393e-8L), |
| TEST_c_c (cacos, -0x1.0000000000001p0L, 0.0L, 3.141592653589793238462643383279502884197L, -2.107342425544701550354780375182800088393e-8L), |
| TEST_c_c (cacos, 0x1.0000000000001p0L, -0.0L, 0.0L, 2.107342425544701550354780375182800088393e-8L), |
| TEST_c_c (cacos, -0x1.0000000000001p0L, -0.0L, 3.141592653589793238462643383279502884197L, 2.107342425544701550354780375182800088393e-8L), |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64 |
| TEST_c_c (cacos, 0x1p-63L, 0x1.0000000000000002p0L, 1.570796326794896619154657020805582738031L, -8.813735870195430253092739958139610131001e-1L), |
| TEST_c_c (cacos, 0x1p-63L, -0x1.0000000000000002p0L, 1.570796326794896619154657020805582738031L, 8.813735870195430253092739958139610131001e-1L), |
| TEST_c_c (cacos, -0x1p-63L, 0x1.0000000000000002p0L, 1.570796326794896619307986362473920146166L, -8.813735870195430253092739958139610131001e-1L), |
| TEST_c_c (cacos, -0x1p-63L, -0x1.0000000000000002p0L, 1.570796326794896619307986362473920146166L, 8.813735870195430253092739958139610131001e-1L), |
| TEST_c_c (cacos, 0x1.0000000000000002p0L, 0x1p-63L, 2.119177303101063432592523199680782317447e-10L, -5.116146586219826555037807251857670783420e-10L), |
| TEST_c_c (cacos, -0x1.0000000000000002p0L, 0x1p-63L, 3.141592653377875508152537040020250564229L, -5.116146586219826555037807251857670783420e-10L), |
| TEST_c_c (cacos, 0x1.0000000000000002p0L, -0x1p-63L, 2.119177303101063432592523199680782317447e-10L, 5.116146586219826555037807251857670783420e-10L), |
| TEST_c_c (cacos, -0x1.0000000000000002p0L, -0x1p-63L, 3.141592653377875508152537040020250564229L, 5.116146586219826555037807251857670783420e-10L), |
| # if LDBL_MIN_EXP <= -16381 |
| TEST_c_c (cacos, 0x1.fp-16385L, 0x1.0000000000000002p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430253092739958139610130980e-1L), |
| TEST_c_c (cacos, 0x1.fp-16385L, -0x1.0000000000000002p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430253092739958139610130980e-1L), |
| TEST_c_c (cacos, -0x1.fp-16385L, 0x1.0000000000000002p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430253092739958139610130980e-1L), |
| TEST_c_c (cacos, -0x1.fp-16385L, -0x1.0000000000000002p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430253092739958139610130980e-1L), |
| TEST_c_c (cacos, 0x1.0000000000000002p0L, 0x1.fp-16385L, 1.748608650034385653922359120438227480943e-4923L, -4.656612873077392578082927418388212703712e-10L), |
| TEST_c_c (cacos, -0x1.0000000000000002p0L, 0x1.fp-16385L, 3.141592653589793238462643383279502884197L, -4.656612873077392578082927418388212703712e-10L), |
| TEST_c_c (cacos, 0x1.0000000000000002p0L, -0x1.fp-16385L, 1.748608650034385653922359120438227480943e-4923L, 4.656612873077392578082927418388212703712e-10L), |
| TEST_c_c (cacos, -0x1.0000000000000002p0L, -0x1.fp-16385L, 3.141592653589793238462643383279502884197L, 4.656612873077392578082927418388212703712e-10L), |
| # endif |
| TEST_c_c (cacos, 0.0L, 0x1.0000000000000002p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430253092739958139610130980e-1L), |
| TEST_c_c (cacos, 0.0L, -0x1.0000000000000002p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430253092739958139610130980e-1L), |
| TEST_c_c (cacos, -0.0L, 0x1.0000000000000002p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430253092739958139610130980e-1L), |
| TEST_c_c (cacos, -0.0L, -0x1.0000000000000002p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430253092739958139610130980e-1L), |
| TEST_c_c (cacos, 0x1.0000000000000002p0L, 0.0L, 0.0L, -4.656612873077392578082927418388212703712e-10L), |
| TEST_c_c (cacos, -0x1.0000000000000002p0L, 0.0L, 3.141592653589793238462643383279502884197L, -4.656612873077392578082927418388212703712e-10L), |
| TEST_c_c (cacos, 0x1.0000000000000002p0L, -0.0L, 0.0L, 4.656612873077392578082927418388212703712e-10L), |
| TEST_c_c (cacos, -0x1.0000000000000002p0L, -0.0L, 3.141592653589793238462643383279502884197L, 4.656612873077392578082927418388212703712e-10L), |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 106 |
| TEST_c_c (cacos, 0x1p-106L, 0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639742726335L, -8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, 0x1p-106L, -0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639742726335L, 8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, -0x1p-106L, 0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639760157863L, -8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, -0x1p-106L, -0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639760157863L, 8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, 0x1.000000000000000000000000008p0L, 0x1p-106L, 5.394221422390606848017034778914096659726e-17L, -2.285028863093221674154232933662774454211e-16L), |
| TEST_c_c (cacos, -0x1.000000000000000000000000008p0L, 0x1p-106L, 3.141592653589793184520429159373434404027L, -2.285028863093221674154232933662774454211e-16L), |
| TEST_c_c (cacos, 0x1.000000000000000000000000008p0L, -0x1p-106L, 5.394221422390606848017034778914096659726e-17L, 2.285028863093221674154232933662774454211e-16L), |
| TEST_c_c (cacos, -0x1.000000000000000000000000008p0L, -0x1p-106L, 3.141592653589793184520429159373434404027L, 2.285028863093221674154232933662774454211e-16L), |
| TEST_c_c (cacos, 0x1.fp-1025L, 0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, 0x1.fp-1025L, -0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, 0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, -0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, 0x1.000000000000000000000000008p0L, 0x1.fp-1025L, 2.426922623448365473354662093431821897807e-293L, -2.220446049250313080847263336181636063482e-16L), |
| TEST_c_c (cacos, -0x1.000000000000000000000000008p0L, 0x1.fp-1025L, 3.141592653589793238462643383279502884197L, -2.220446049250313080847263336181636063482e-16L), |
| TEST_c_c (cacos, 0x1.000000000000000000000000008p0L, -0x1.fp-1025L, 2.426922623448365473354662093431821897807e-293L, 2.220446049250313080847263336181636063482e-16L), |
| TEST_c_c (cacos, -0x1.000000000000000000000000008p0L, -0x1.fp-1025L, 3.141592653589793238462643383279502884197L, 2.220446049250313080847263336181636063482e-16L), |
| TEST_c_c (cacos, 0.0L, 0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, 0.0L, -0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, -0.0L, 0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, -0.0L, -0x1.000000000000000000000000008p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249798097405561e-1L), |
| TEST_c_c (cacos, 0x1.000000000000000000000000008p0L, 0.0L, 0.0L, -2.220446049250313080847263336181636063482e-16L), |
| TEST_c_c (cacos, -0x1.000000000000000000000000008p0L, 0.0L, 3.141592653589793238462643383279502884197L, -2.220446049250313080847263336181636063482e-16L), |
| TEST_c_c (cacos, 0x1.000000000000000000000000008p0L, -0.0L, 0.0L, 2.220446049250313080847263336181636063482e-16L), |
| TEST_c_c (cacos, -0x1.000000000000000000000000008p0L, -0.0L, 3.141592653589793238462643383279502884197L, 2.220446049250313080847263336181636063482e-16L), |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 113 |
| TEST_c_c (cacos, 0x1p-113L, 0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751374007L, -8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, 0x1p-113L, -0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751374007L, 8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, -0x1p-113L, 0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751510190L, -8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, -0x1p-113L, -0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751510190L, 8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, 0x1.0000000000000000000000000001p0L, 0x1p-113L, 4.767863183742677481693563511435642755521e-18L, -2.019699255375255198156433710951064632386e-17L), |
| TEST_c_c (cacos, -0x1.0000000000000000000000000001p0L, 0x1p-113L, 3.141592653589793233694780199536825402504L, -2.019699255375255198156433710951064632386e-17L), |
| TEST_c_c (cacos, 0x1.0000000000000000000000000001p0L, -0x1p-113L, 4.767863183742677481693563511435642755521e-18L, 2.019699255375255198156433710951064632386e-17L), |
| TEST_c_c (cacos, -0x1.0000000000000000000000000001p0L, -0x1p-113L, 3.141592653589793233694780199536825402504L, 2.019699255375255198156433710951064632386e-17L), |
| TEST_c_c (cacos, 0x1.fp-16385L, 0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, 0x1.fp-16385L, -0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, -0x1.fp-16385L, 0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, -0x1.fp-16385L, -0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, 0x1.0000000000000000000000000001p0L, 0x1.fp-16385L, 4.148847925325683229178506116378864361396e-4916L, -1.962615573354718824241727964954454332780e-17L), |
| TEST_c_c (cacos, -0x1.0000000000000000000000000001p0L, 0x1.fp-16385L, 3.141592653589793238462643383279502884197L, -1.962615573354718824241727964954454332780e-17L), |
| TEST_c_c (cacos, 0x1.0000000000000000000000000001p0L, -0x1.fp-16385L, 4.148847925325683229178506116378864361396e-4916L, 1.962615573354718824241727964954454332780e-17L), |
| TEST_c_c (cacos, -0x1.0000000000000000000000000001p0L, -0x1.fp-16385L, 3.141592653589793238462643383279502884197L, 1.962615573354718824241727964954454332780e-17L), |
| TEST_c_c (cacos, 0.0L, 0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, 0.0L, -0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, -0.0L, 0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751442099L, -8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, -0.0L, -0x1.0000000000000000000000000001p0L, 1.570796326794896619231321691639751442099L, 8.813735870195430252326093249797924452120e-1L), |
| TEST_c_c (cacos, 0x1.0000000000000000000000000001p0L, 0.0L, 0.0L, -1.962615573354718824241727964954454332780e-17L), |
| TEST_c_c (cacos, -0x1.0000000000000000000000000001p0L, 0.0L, 3.141592653589793238462643383279502884197L, -1.962615573354718824241727964954454332780e-17L), |
| TEST_c_c (cacos, 0x1.0000000000000000000000000001p0L, -0.0L, 0.0L, 1.962615573354718824241727964954454332780e-17L), |
| TEST_c_c (cacos, -0x1.0000000000000000000000000001p0L, -0.0L, 3.141592653589793238462643383279502884197L, 1.962615573354718824241727964954454332780e-17L), |
| #endif |
| |
| TEST_c_c (cacos, 0x1p-23L, 0x0.ffffffp0L, 1.570796242501197085295336701632142060969L, -8.813735448726963984495965873956465777250e-1L), |
| TEST_c_c (cacos, 0x1p-23L, -0x0.ffffffp0L, 1.570796242501197085295336701632142060969L, 8.813735448726963984495965873956465777250e-1L), |
| TEST_c_c (cacos, -0x1p-23L, 0x0.ffffffp0L, 1.570796411088596153167306681647360823228L, -8.813735448726963984495965873956465777250e-1L), |
| TEST_c_c (cacos, -0x1p-23L, -0x0.ffffffp0L, 1.570796411088596153167306681647360823228L, 8.813735448726963984495965873956465777250e-1L), |
| TEST_c_c (cacos, 0x0.ffffffp0L, 0x1p-23L, 4.391863861910487109445187743978204002614e-4L, -2.714321200917194650737217746780928423385e-4L), |
| TEST_c_c (cacos, -0x0.ffffffp0L, 0x1p-23L, 3.141153467203602189751698864505105063797L, -2.714321200917194650737217746780928423385e-4L), |
| TEST_c_c (cacos, 0x0.ffffffp0L, -0x1p-23L, 4.391863861910487109445187743978204002614e-4L, 2.714321200917194650737217746780928423385e-4L), |
| TEST_c_c (cacos, -0x0.ffffffp0L, -0x1p-23L, 3.141153467203602189751698864505105063797L, 2.714321200917194650737217746780928423385e-4L), |
| TEST_c_c (cacos, 0x1.fp-129L, 0x0.ffffffp0L, 1.570796326794896619231321691639751442097L, -8.813735448726938863015878255140556727969e-1L), |
| TEST_c_c (cacos, 0x1.fp-129L, -0x0.ffffffp0L, 1.570796326794896619231321691639751442097L, 8.813735448726938863015878255140556727969e-1L), |
| TEST_c_c (cacos, -0x1.fp-129L, 0x0.ffffffp0L, 1.570796326794896619231321691639751442101L, -8.813735448726938863015878255140556727969e-1L), |
| TEST_c_c (cacos, -0x1.fp-129L, -0x0.ffffffp0L, 1.570796326794896619231321691639751442101L, 8.813735448726938863015878255140556727969e-1L), |
| TEST_c_c (cacos, 0x0.ffffffp0L, 0x1.fp-129L, 3.452669847162035876032494826387364972849e-4L, -8.245504387859737323891843603996428534945e-36L), |
| TEST_c_c (cacos, -0x0.ffffffp0L, 0x1.fp-129L, 3.141247386605077034875040133796864147700L, -8.245504387859737323891843603996428534945e-36L), |
| TEST_c_c (cacos, 0x0.ffffffp0L, -0x1.fp-129L, 3.452669847162035876032494826387364972849e-4L, 8.245504387859737323891843603996428534945e-36L), |
| TEST_c_c (cacos, -0x0.ffffffp0L, -0x1.fp-129L, 3.141247386605077034875040133796864147700L, 8.245504387859737323891843603996428534945e-36L), |
| TEST_c_c (cacos, 0.0L, 0x0.ffffffp0L, 1.570796326794896619231321691639751442099L, -8.813735448726938863015878255140556727969e-1L), |
| TEST_c_c (cacos, 0.0L, -0x0.ffffffp0L, 1.570796326794896619231321691639751442099L, 8.813735448726938863015878255140556727969e-1L), |
| TEST_c_c (cacos, -0.0L, 0x0.ffffffp0L, 1.570796326794896619231321691639751442099L, -8.813735448726938863015878255140556727969e-1L), |
| TEST_c_c (cacos, -0.0L, -0x0.ffffffp0L, 1.570796326794896619231321691639751442099L, 8.813735448726938863015878255140556727969e-1L), |
| TEST_c_c (cacos, 0x0.ffffffp0L, 0.0L, 3.452669847162035876032494826387364972849e-4L, -0.0L), |
| TEST_c_c (cacos, -0x0.ffffffp0L, 0.0L, 3.141247386605077034875040133796864147700L, -0.0L), |
| TEST_c_c (cacos, 0x0.ffffffp0L, -0.0L, 3.452669847162035876032494826387364972849e-4L, 0.0L), |
| TEST_c_c (cacos, -0x0.ffffffp0L, -0.0L, 3.141247386605077034875040133796864147700L, 0.0L), |
| TEST_c_c (cacos, 0x1p-23L, 0.5L, 1.570796220170866625230343643673321150378L, -4.812118250596059896127318386463676808798e-1L), |
| TEST_c_c (cacos, 0x1p-23L, -0.5L, 1.570796220170866625230343643673321150378L, 4.812118250596059896127318386463676808798e-1L), |
| TEST_c_c (cacos, -0x1p-23L, 0.5L, 1.570796433418926613232299739606181733819L, -4.812118250596059896127318386463676808798e-1L), |
| TEST_c_c (cacos, -0x1p-23L, -0.5L, 1.570796433418926613232299739606181733819L, 4.812118250596059896127318386463676808798e-1L), |
| TEST_c_c (cacos, 0.5L, 0x1p-23L, 1.047197551196603215914744618665204532273L, -1.376510308240943236356088341381173571841e-7L), |
| TEST_c_c (cacos, -0.5L, 0x1p-23L, 2.094395102393190022547898764614298351924L, -1.376510308240943236356088341381173571841e-7L), |
| TEST_c_c (cacos, 0.5L, -0x1p-23L, 1.047197551196603215914744618665204532273L, 1.376510308240943236356088341381173571841e-7L), |
| TEST_c_c (cacos, -0.5L, -0x1p-23L, 2.094395102393190022547898764614298351924L, 1.376510308240943236356088341381173571841e-7L), |
| TEST_c_c (cacos, 0x1.fp-129L, 0.5L, 1.570796326794896619231321691639751442096L, -4.812118250596034474977589134243684231352e-1L), |
| TEST_c_c (cacos, 0x1.fp-129L, -0.5L, 1.570796326794896619231321691639751442096L, 4.812118250596034474977589134243684231352e-1L), |
| TEST_c_c (cacos, -0x1.fp-129L, 0.5L, 1.570796326794896619231321691639751442101L, -4.812118250596034474977589134243684231352e-1L), |
| TEST_c_c (cacos, -0x1.fp-129L, -0.5L, 1.570796326794896619231321691639751442101L, 4.812118250596034474977589134243684231352e-1L), |
| TEST_c_c (cacos, 0.5L, 0x1.fp-129L, 1.047197551196597746154214461093167628066L, -3.287317402534702257036015056278368274737e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, -0.5L, 0x1.fp-129L, 2.094395102393195492308428922186335256131L, -3.287317402534702257036015056278368274737e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, 0.5L, -0x1.fp-129L, 1.047197551196597746154214461093167628066L, 3.287317402534702257036015056278368274737e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, -0.5L, -0x1.fp-129L, 2.094395102393195492308428922186335256131L, 3.287317402534702257036015056278368274737e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, 0x1p-23L, 0x1p-23L, 1.570796207585607068450636380271254316214L, -1.192092895507818146886315028596704749235e-7L), |
| TEST_c_c (cacos, 0x1p-23L, -0x1p-23L, 1.570796207585607068450636380271254316214L, 1.192092895507818146886315028596704749235e-7L), |
| TEST_c_c (cacos, -0x1p-23L, 0x1p-23L, 1.570796446004186170012007003008248567984L, -1.192092895507818146886315028596704749235e-7L), |
| TEST_c_c (cacos, -0x1p-23L, -0x1p-23L, 1.570796446004186170012007003008248567984L, 1.192092895507818146886315028596704749235e-7L), |
| TEST_c_c (cacos, 0x1.fp-129L, 0x1p-23L, 1.570796326794896619231321691639751442096L, -1.192092895507809676556842485683592032154e-7L), |
| TEST_c_c (cacos, 0x1.fp-129L, -0x1p-23L, 1.570796326794896619231321691639751442096L, 1.192092895507809676556842485683592032154e-7L), |
| TEST_c_c (cacos, -0x1.fp-129L, 0x1p-23L, 1.570796326794896619231321691639751442101L, -1.192092895507809676556842485683592032154e-7L), |
| TEST_c_c (cacos, -0x1.fp-129L, -0x1p-23L, 1.570796326794896619231321691639751442101L, 1.192092895507809676556842485683592032154e-7L), |
| TEST_c_c (cacos, 0x1p-23L, 0x1.fp-129L, 1.570796207585607068449789347324000006847L, -2.846900380897747786805634596726756660388e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, -0x1p-23L, 0x1.fp-129L, 1.570796446004186170012854035955502877351L, -2.846900380897747786805634596726756660388e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, 0x1p-23L, -0x1.fp-129L, 1.570796207585607068449789347324000006847L, 2.846900380897747786805634596726756660388e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, -0x1p-23L, -0x1.fp-129L, 1.570796446004186170012854035955502877351L, 2.846900380897747786805634596726756660388e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, 0.0L, 0x1p-23L, 1.570796326794896619231321691639751442099L, -1.192092895507809676556842485683592032154e-7L), |
| TEST_c_c (cacos, 0.0L, -0x1p-23L, 1.570796326794896619231321691639751442099L, 1.192092895507809676556842485683592032154e-7L), |
| TEST_c_c (cacos, -0.0L, 0x1p-23L, 1.570796326794896619231321691639751442099L, -1.192092895507809676556842485683592032154e-7L), |
| TEST_c_c (cacos, -0.0L, -0x1p-23L, 1.570796326794896619231321691639751442099L, 1.192092895507809676556842485683592032154e-7L), |
| TEST_c_c (cacos, 0x1p-23L, 0.0L, 1.570796207585607068449789347324000006847L, -0.0L), |
| TEST_c_c (cacos, -0x1p-23L, 0.0L, 1.570796446004186170012854035955502877351L, -0.0L), |
| TEST_c_c (cacos, 0x1p-23L, -0.0L, 1.570796207585607068449789347324000006847L, 0.0L), |
| TEST_c_c (cacos, -0x1p-23L, -0.0L, 1.570796446004186170012854035955502877351L, 0.0L), |
| TEST_c_c (cacos, 0x1.fp-129L, 0x1.fp-129L, 1.570796326794896619231321691639751442096L, -2.846900380897727558361783801085126250967e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, 0x1.fp-129L, -0x1.fp-129L, 1.570796326794896619231321691639751442096L, 2.846900380897727558361783801085126250967e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, -0x1.fp-129L, 0x1.fp-129L, 1.570796326794896619231321691639751442101L, -2.846900380897727558361783801085126250967e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| TEST_c_c (cacos, -0x1.fp-129L, -0x1.fp-129L, 1.570796326794896619231321691639751442101L, 2.846900380897727558361783801085126250967e-39L, UNDERFLOW_EXCEPTION_FLOAT), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1p-52L, 0x0.fffffffffffff8p0L, 1.570796326794896462222075823262236786996L, -8.813735870195429467279863907910458761820e-1L), |
| TEST_c_c (cacos, 0x1p-52L, -0x0.fffffffffffff8p0L, 1.570796326794896462222075823262236786996L, 8.813735870195429467279863907910458761820e-1L), |
| TEST_c_c (cacos, -0x1p-52L, 0x0.fffffffffffff8p0L, 1.570796326794896776240567560017266097201L, -8.813735870195429467279863907910458761820e-1L), |
| TEST_c_c (cacos, -0x1p-52L, -0x0.fffffffffffff8p0L, 1.570796326794896776240567560017266097201L, 8.813735870195429467279863907910458761820e-1L), |
| TEST_c_c (cacos, 0x0.fffffffffffff8p0L, 0x1p-52L, 1.895456983915074112227925127005564372844e-8L, -1.171456840272878582596796205397918831268e-8L), |
| TEST_c_c (cacos, -0x0.fffffffffffff8p0L, 0x1p-52L, 3.141592634635223399311902261000251614142L, -1.171456840272878582596796205397918831268e-8L), |
| TEST_c_c (cacos, 0x0.fffffffffffff8p0L, -0x1p-52L, 1.895456983915074112227925127005564372844e-8L, 1.171456840272878582596796205397918831268e-8L), |
| TEST_c_c (cacos, -0x0.fffffffffffff8p0L, -0x1p-52L, 3.141592634635223399311902261000251614142L, 1.171456840272878582596796205397918831268e-8L), |
| TEST_c_c (cacos, 0x1.fp-1025L, 0x0.fffffffffffff8p0L, 1.570796326794896619231321691639751442099L, -8.813735870195429467279863907910371604180e-1L), |
| TEST_c_c (cacos, 0x1.fp-1025L, -0x0.fffffffffffff8p0L, 1.570796326794896619231321691639751442099L, 8.813735870195429467279863907910371604180e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, 0x0.fffffffffffff8p0L, 1.570796326794896619231321691639751442099L, -8.813735870195429467279863907910371604180e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, -0x0.fffffffffffff8p0L, 1.570796326794896619231321691639751442099L, 8.813735870195429467279863907910371604180e-1L), |
| TEST_c_c (cacos, 0x0.fffffffffffff8p0L, 0x1.fp-1025L, 1.490116119384765638786343542550461592240e-8L, -3.616396521699973256461764099945789620604e-301L, UNDERFLOW_EXCEPTION_LDOUBLE_IBM), |
| TEST_c_c (cacos, -0x0.fffffffffffff8p0L, 0x1.fp-1025L, 3.141592638688632044614986995416067458693L, -3.616396521699973256461764099945789620604e-301L, UNDERFLOW_EXCEPTION_LDOUBLE_IBM), |
| TEST_c_c (cacos, 0x0.fffffffffffff8p0L, -0x1.fp-1025L, 1.490116119384765638786343542550461592240e-8L, 3.616396521699973256461764099945789620604e-301L, UNDERFLOW_EXCEPTION_LDOUBLE_IBM), |
| TEST_c_c (cacos, -0x0.fffffffffffff8p0L, -0x1.fp-1025L, 3.141592638688632044614986995416067458693L, 3.616396521699973256461764099945789620604e-301L, UNDERFLOW_EXCEPTION_LDOUBLE_IBM), |
| TEST_c_c (cacos, 0.0L, 0x0.fffffffffffff8p0L, 1.570796326794896619231321691639751442099L, -8.813735870195429467279863907910371604180e-1L), |
| TEST_c_c (cacos, 0.0L, -0x0.fffffffffffff8p0L, 1.570796326794896619231321691639751442099L, 8.813735870195429467279863907910371604180e-1L), |
| TEST_c_c (cacos, -0.0L, 0x0.fffffffffffff8p0L, 1.570796326794896619231321691639751442099L, -8.813735870195429467279863907910371604180e-1L), |
| TEST_c_c (cacos, -0.0L, -0x0.fffffffffffff8p0L, 1.570796326794896619231321691639751442099L, 8.813735870195429467279863907910371604180e-1L), |
| TEST_c_c (cacos, 0x0.fffffffffffff8p0L, 0.0L, 1.490116119384765638786343542550461592240e-8L, -0.0L), |
| TEST_c_c (cacos, -0x0.fffffffffffff8p0L, 0.0L, 3.141592638688632044614986995416067458693L, -0.0L), |
| TEST_c_c (cacos, 0x0.fffffffffffff8p0L, -0.0L, 1.490116119384765638786343542550461592240e-8L, 0.0L), |
| TEST_c_c (cacos, -0x0.fffffffffffff8p0L, -0.0L, 3.141592638688632044614986995416067458693L, 0.0L), |
| #endif |
| TEST_c_c (cacos, 0x1p-52L, 0.5L, 1.570796326794896420628589431857911675917L, -4.812118250596034474977589134243772428682e-1L), |
| TEST_c_c (cacos, 0x1p-52L, -0.5L, 1.570796326794896420628589431857911675917L, 4.812118250596034474977589134243772428682e-1L), |
| TEST_c_c (cacos, -0x1p-52L, 0.5L, 1.570796326794896817834053951421591208280L, -4.812118250596034474977589134243772428682e-1L), |
| TEST_c_c (cacos, -0x1p-52L, -0.5L, 1.570796326794896817834053951421591208280L, 4.812118250596034474977589134243772428682e-1L), |
| TEST_c_c (cacos, 0.5L, 0x1p-52L, 1.047197551196597746154214461093186605110L, -2.563950248511418570403591756798643804971e-16L), |
| TEST_c_c (cacos, -0.5L, 0x1p-52L, 2.094395102393195492308428922186316279087L, -2.563950248511418570403591756798643804971e-16L), |
| TEST_c_c (cacos, 0.5L, -0x1p-52L, 1.047197551196597746154214461093186605110L, 2.563950248511418570403591756798643804971e-16L), |
| TEST_c_c (cacos, -0.5L, -0x1p-52L, 2.094395102393195492308428922186316279087L, 2.563950248511418570403591756798643804971e-16L), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1.fp-1025L, 0.5L, 1.570796326794896619231321691639751442099L, -4.812118250596034474977589134243684231352e-1L), |
| TEST_c_c (cacos, 0x1.fp-1025L, -0.5L, 1.570796326794896619231321691639751442099L, 4.812118250596034474977589134243684231352e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, 0.5L, 1.570796326794896619231321691639751442099L, -4.812118250596034474977589134243684231352e-1L), |
| TEST_c_c (cacos, -0x1.fp-1025L, -0.5L, 1.570796326794896619231321691639751442099L, 4.812118250596034474977589134243684231352e-1L), |
| TEST_c_c (cacos, 0.5L, 0x1.fp-1025L, 1.047197551196597746154214461093167628066L, -6.222508863508420569166420770843207333493e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, -0.5L, 0x1.fp-1025L, 2.094395102393195492308428922186335256131L, -6.222508863508420569166420770843207333493e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, 0.5L, -0x1.fp-1025L, 1.047197551196597746154214461093167628066L, 6.222508863508420569166420770843207333493e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, -0.5L, -0x1.fp-1025L, 2.094395102393195492308428922186335256131L, 6.222508863508420569166420770843207333493e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| #endif |
| TEST_c_c (cacos, 0x1p-52L, 0x1p-52L, 1.570796326794896397186716766608443357372L, -2.220446049250313080847263336181677117148e-16L), |
| TEST_c_c (cacos, 0x1p-52L, -0x1p-52L, 1.570796326794896397186716766608443357372L, 2.220446049250313080847263336181677117148e-16L), |
| TEST_c_c (cacos, -0x1p-52L, 0x1p-52L, 1.570796326794896841275926616671059526825L, -2.220446049250313080847263336181677117148e-16L), |
| TEST_c_c (cacos, -0x1p-52L, -0x1p-52L, 1.570796326794896841275926616671059526825L, 2.220446049250313080847263336181677117148e-16L), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1.fp-1025L, 0x1p-52L, 1.570796326794896619231321691639751442099L, -2.220446049250313080847263336181622378926e-16L), |
| TEST_c_c (cacos, 0x1.fp-1025L, -0x1p-52L, 1.570796326794896619231321691639751442099L, 2.220446049250313080847263336181622378926e-16L), |
| TEST_c_c (cacos, -0x1.fp-1025L, 0x1p-52L, 1.570796326794896619231321691639751442099L, -2.220446049250313080847263336181622378926e-16L), |
| TEST_c_c (cacos, -0x1.fp-1025L, -0x1p-52L, 1.570796326794896619231321691639751442099L, 2.220446049250313080847263336181622378926e-16L), |
| TEST_c_c (cacos, 0x1p-52L, 0x1.fp-1025L, 1.570796326794896397186716766608443357372L, -5.388850751072128349671657362289548938458e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, -0x1p-52L, 0x1.fp-1025L, 1.570796326794896841275926616671059526825L, -5.388850751072128349671657362289548938458e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, 0x1p-52L, -0x1.fp-1025L, 1.570796326794896397186716766608443357372L, 5.388850751072128349671657362289548938458e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, -0x1p-52L, -0x1.fp-1025L, 1.570796326794896841275926616671059526825L, 5.388850751072128349671657362289548938458e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| #endif |
| TEST_c_c (cacos, 0.0L, 0x1p-52L, 1.570796326794896619231321691639751442099L, -2.220446049250313080847263336181622378926e-16L), |
| TEST_c_c (cacos, 0.0L, -0x1p-52L, 1.570796326794896619231321691639751442099L, 2.220446049250313080847263336181622378926e-16L), |
| TEST_c_c (cacos, -0.0L, 0x1p-52L, 1.570796326794896619231321691639751442099L, -2.220446049250313080847263336181622378926e-16L), |
| TEST_c_c (cacos, -0.0L, -0x1p-52L, 1.570796326794896619231321691639751442099L, 2.220446049250313080847263336181622378926e-16L), |
| TEST_c_c (cacos, 0x1p-52L, 0.0L, 1.570796326794896397186716766608443357372L, -0.0L), |
| TEST_c_c (cacos, -0x1p-52L, 0.0L, 1.570796326794896841275926616671059526825L, -0.0L), |
| TEST_c_c (cacos, 0x1p-52L, -0.0L, 1.570796326794896397186716766608443357372L, 0.0L), |
| TEST_c_c (cacos, -0x1p-52L, -0.0L, 1.570796326794896841275926616671059526825L, 0.0L), |
| #ifndef TEST_FLOAT |
| TEST_c_c (cacos, 0x1.fp-1025L, 0x1.fp-1025L, 1.570796326794896619231321691639751442099L, -5.388850751072128349671657362289416093031e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, 0x1.fp-1025L, -0x1.fp-1025L, 1.570796326794896619231321691639751442099L, 5.388850751072128349671657362289416093031e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, -0x1.fp-1025L, 0x1.fp-1025L, 1.570796326794896619231321691639751442099L, -5.388850751072128349671657362289416093031e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| TEST_c_c (cacos, -0x1.fp-1025L, -0x1.fp-1025L, 1.570796326794896619231321691639751442099L, 5.388850751072128349671657362289416093031e-309L, UNDERFLOW_EXCEPTION_DOUBLE), |
| #endif |
| #if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 64 |
| TEST_c_c (cacos, 0x1p-63L, 0x0.ffffffffffffffffp0L, 1.570796326794896619154657020805582738025L, -8.813735870195430251942769895627079569937e-1L), |
| TEST_c_c (cacos, 0x1p-63L, -0x0.ffffffffffffffffp0L, 1.570796326794896619154657020805582738025L, 8.813735870195430251942769895627079569937e-1L), |
| TEST_c_c (cacos, -0x1p-63L, 0x0.ffffffffffffffffp0L, 1.570796326794896619307986362473920146173L, -8.813735870195430251942769895627079569937e-1L), |
| TEST_c_c (cacos, -0x1p-63L, -0x0.ffffffffffffffffp0L, 1.570796326794896619307986362473920146173L, 8.813735870195430251942769895627079569937e-1L), |
| TEST_c_c (cacos, 0x0.ffffffffffffffffp0L, 0x1p-63L, 4.188407771167967636741951941902992986043e-10L, -2.588578361325995866221775673638805081337e-10L), |
| TEST_c_c (cacos, -0x0.ffffffffffffffffp0L, 0x1p-63L, 3.141592653170952461345846619605307690007L, -2.588578361325995866221775673638805081337e-10L), |
| TEST_c_c (cacos, 0x0.ffffffffffffffffp0L, -0x1p-63L, 4.188407771167967636741951941902992986043e-10L, 2.588578361325995866221775673638805081337e-10L), |
| TEST_c_c (cacos, -0x0.ffffffffffffffffp0L, -0x1p-63L, 3.141592653170952461345846619605307690007L, 2.588578361325995866221775673638805081337e-10L), |
| # if LDBL_MIN_EXP <= -16381 |
| TEST_c_c (cacos, 0x1.fp-16385L, 0x0.ffffffffffffffffp0L, 1.570796326794896619231321691639751442099L, -8.813735870195430251942769895627079569917e-1L), |
| TEST_c_c (cacos, 0x1.fp-16385L, -0x0.ffffffffffffffffp0L, 1.570796326794896619231321691639751442099L, 8.813735870195430251942769895627079569917e-1L), |
| TEST_c_c (cacos, -0x1.fp-16385L, 0x0.ffffffffffffffffp0L, 1.570796326794896619231321691639751442099L, -8.813735870195430251942769895627079569917e-1L), |
| TEST_c_c (cacos, -0x1.fp-16385L, -0x0.ffffffffffffffffp0L, 1.570796326794896619231321691639751442099L, 8.813735870195430251942769895627079569917e-1L), |
| TEST_c_c (cacos, 0x0.ffffffffffffffffp0L, 0x1.fp-16385L, 3.292722539913596233371825532007990724506e-10L, -2.472906068161537187835415298076415423459e-4923L), |
| TEST_c_c (cacos, -0x0.ffffffffffffffffp0L, 0x1.fp-16385L, 3.141592653260520984471283759942320330996L, -2.472906068161537187835415298076415423459e-4923L), |
| TEST_c_c (cacos, 0x0. |