| 1 |
689 |
jeremybenn |
/* Copyright (C) 2006 Free Software Foundation.
|
| 2 |
|
|
|
| 3 |
|
|
Verify that built-in math function constant folding of constant
|
| 4 |
|
|
arguments is correctly performed by the compiler.
|
| 5 |
|
|
|
| 6 |
|
|
Origin: Kaveh R. Ghazi, October 23, 2006. */
|
| 7 |
|
|
|
| 8 |
|
|
/* { dg-do link } */
|
| 9 |
|
|
|
| 10 |
|
|
/* Define "e" with as many bits as found in builtins.c:dconste. */
|
| 11 |
|
|
#define M_E 2.7182818284590452353602874713526624977572470936999595749669676277241
|
| 12 |
|
|
|
| 13 |
|
|
/* All references to link_error should go away at compile-time. */
|
| 14 |
|
|
extern void link_error(int);
|
| 15 |
|
|
|
| 16 |
|
|
/* Return TRUE if the sign of X != sign of Y. This is important when
|
| 17 |
|
|
comparing signed zeros. */
|
| 18 |
|
|
#define CKSGN_F(X,Y) \
|
| 19 |
|
|
(__builtin_copysignf(1.0F,(X)) != __builtin_copysignf(1.0F,(Y)))
|
| 20 |
|
|
#define CKSGN(X,Y) \
|
| 21 |
|
|
(__builtin_copysign(1.0,(X)) != __builtin_copysign(1.0,(Y)))
|
| 22 |
|
|
#define CKSGN_L(X,Y) \
|
| 23 |
|
|
(__builtin_copysignl(1.0L,(X)) != __builtin_copysignl(1.0L,(Y)))
|
| 24 |
|
|
|
| 25 |
|
|
/* Test that FUNC(ARG) == (RES). */
|
| 26 |
|
|
#define TESTIT(FUNC,ARG,RES) do { \
|
| 27 |
|
|
if (__builtin_##FUNC##f(ARG##F) != RES##F \
|
| 28 |
|
|
|| CKSGN_F(__builtin_##FUNC##f(ARG##F),RES##F)) \
|
| 29 |
|
|
link_error(__LINE__); \
|
| 30 |
|
|
if (__builtin_##FUNC(ARG) != RES \
|
| 31 |
|
|
|| CKSGN(__builtin_##FUNC(ARG),RES)) \
|
| 32 |
|
|
link_error(__LINE__); \
|
| 33 |
|
|
if (__builtin_##FUNC##l(ARG##L) != RES##L \
|
| 34 |
|
|
|| CKSGN_L(__builtin_##FUNC##l(ARG##L),RES##L)) \
|
| 35 |
|
|
link_error(__LINE__); \
|
| 36 |
|
|
} while (0)
|
| 37 |
|
|
|
| 38 |
|
|
/* Range test, check that (LOW) < FUNC(ARG) < (HI). */
|
| 39 |
|
|
#define TESTIT_R(FUNC,ARG,LOW,HI) do { \
|
| 40 |
|
|
if (__builtin_##FUNC##f(ARG) <= (LOW) || __builtin_##FUNC##f(ARG) >= (HI)) \
|
| 41 |
|
|
link_error(__LINE__); \
|
| 42 |
|
|
if (__builtin_##FUNC(ARG) <= (LOW) || __builtin_##FUNC(ARG) >= (HI)) \
|
| 43 |
|
|
link_error(__LINE__); \
|
| 44 |
|
|
if (__builtin_##FUNC##l(ARG) <= (LOW) || __builtin_##FUNC##l(ARG) >= (HI)) \
|
| 45 |
|
|
link_error(__LINE__); \
|
| 46 |
|
|
} while (0)
|
| 47 |
|
|
|
| 48 |
|
|
/* Test that FUNC(ARG1, ARG2) == (RES). */
|
| 49 |
|
|
#define TESTIT2(FUNC,ARG1,ARG2,RES) do { \
|
| 50 |
|
|
if (__builtin_##FUNC##f(ARG1##F, ARG2##F) != RES##F \
|
| 51 |
|
|
|| CKSGN_F(__builtin_##FUNC##f(ARG1##F,ARG2##F),RES##F)) \
|
| 52 |
|
|
link_error(__LINE__); \
|
| 53 |
|
|
if (__builtin_##FUNC(ARG1, ARG2) != RES \
|
| 54 |
|
|
|| CKSGN(__builtin_##FUNC(ARG1,ARG2),RES)) \
|
| 55 |
|
|
link_error(__LINE__); \
|
| 56 |
|
|
if (__builtin_##FUNC##l(ARG1##L, ARG2##L) != RES##L \
|
| 57 |
|
|
|| CKSGN_L(__builtin_##FUNC##l(ARG1##L,ARG2##L),RES##L)) \
|
| 58 |
|
|
link_error(__LINE__); \
|
| 59 |
|
|
} while (0)
|
| 60 |
|
|
|
| 61 |
|
|
/* Range test, check that (LOW) < FUNC(ARG1,ARG2) < (HI). */
|
| 62 |
|
|
#define TESTIT2_R(FUNC,ARG1,ARG2,LOW,HI) do { \
|
| 63 |
|
|
if (__builtin_##FUNC##f(ARG1, ARG2) <= (LOW) \
|
| 64 |
|
|
|| __builtin_##FUNC##f(ARG1, ARG2) >= (HI)) \
|
| 65 |
|
|
link_error(__LINE__); \
|
| 66 |
|
|
if (__builtin_##FUNC(ARG1, ARG2) <= (LOW) \
|
| 67 |
|
|
|| __builtin_##FUNC(ARG1, ARG2) >= (HI)) \
|
| 68 |
|
|
link_error(__LINE__); \
|
| 69 |
|
|
if (__builtin_##FUNC##l(ARG1, ARG2) <= (LOW) \
|
| 70 |
|
|
|| __builtin_##FUNC##l(ARG1, ARG2) >= (HI)) \
|
| 71 |
|
|
link_error(__LINE__); \
|
| 72 |
|
|
} while (0)
|
| 73 |
|
|
|
| 74 |
|
|
/* Test that FUNC(ARG1, ARG2, ARG3) == (RES). */
|
| 75 |
|
|
#define TESTIT3(FUNC,ARG1,ARG2,ARG3,RES) do { \
|
| 76 |
|
|
if (__builtin_##FUNC##f(ARG1##F, ARG2##F, ARG3##F) != RES##F \
|
| 77 |
|
|
|| CKSGN_F(__builtin_##FUNC##f(ARG1##F,ARG2##F,ARG3##F),RES##F)) \
|
| 78 |
|
|
link_error(__LINE__); \
|
| 79 |
|
|
if (__builtin_##FUNC(ARG1, ARG2, ARG3) != RES \
|
| 80 |
|
|
|| CKSGN(__builtin_##FUNC(ARG1,ARG2,ARG3),RES)) \
|
| 81 |
|
|
link_error(__LINE__); \
|
| 82 |
|
|
if (__builtin_##FUNC##l(ARG1##L, ARG2##L, ARG3##L) != RES##L \
|
| 83 |
|
|
|| CKSGN_L(__builtin_##FUNC##l(ARG1##L,ARG2##L,ARG3##L),RES##L)) \
|
| 84 |
|
|
link_error(__LINE__); \
|
| 85 |
|
|
} while (0)
|
| 86 |
|
|
|
| 87 |
|
|
/* Test that for FUNC(ARG, &ARG_S, &ARG_C);
|
| 88 |
|
|
assert (ARG_S == RES_S && ARG_C == RES_C);. */
|
| 89 |
|
|
#define TESTIT_2P(FUNC,ARG,ARG_S,ARG_C,RES_S,RES_C) do { \
|
| 90 |
|
|
__builtin_##FUNC##f(ARG##F, &ARG_S##f, &ARG_C##f); \
|
| 91 |
|
|
if (ARG_S##f != (RES_S##F) || ARG_C##f != (RES_C##F)) \
|
| 92 |
|
|
link_error(__LINE__); \
|
| 93 |
|
|
__builtin_##FUNC(ARG, &ARG_S, &ARG_C); \
|
| 94 |
|
|
if (ARG_S != (RES_S) || ARG_C != (RES_C)) \
|
| 95 |
|
|
link_error(__LINE__); \
|
| 96 |
|
|
__builtin_##FUNC##l(ARG##L, &ARG_S##l, &ARG_C##l); \
|
| 97 |
|
|
if (ARG_S##l != (RES_S##L) || ARG_C##l != (RES_C##L)) \
|
| 98 |
|
|
link_error(__LINE__); \
|
| 99 |
|
|
} while (0)
|
| 100 |
|
|
|
| 101 |
|
|
/* Test that for FUNC(ARG, &ARG_S, &ARG_C);
|
| 102 |
|
|
assert (LOW_S < ARG_S < HI_S && LOW_C < ARG_C < HI_C);. */
|
| 103 |
|
|
#define TESTIT_2P_R(FUNC,ARG,ARG_S,ARG_C,LOW_S,HI_S,LOW_C,HI_C) do { \
|
| 104 |
|
|
__builtin_##FUNC##f(ARG##F, &ARG_S##f, &ARG_C##f); \
|
| 105 |
|
|
if (ARG_S##f <= (LOW_S##F) || ARG_S##f >= (HI_S##F) \
|
| 106 |
|
|
|| ARG_C##f <= (LOW_C##F) || ARG_C##f >= (HI_C##F)) \
|
| 107 |
|
|
link_error(__LINE__); \
|
| 108 |
|
|
__builtin_##FUNC(ARG, &ARG_S, &ARG_C); \
|
| 109 |
|
|
if (ARG_S <= (LOW_S) || ARG_S >= (HI_S) \
|
| 110 |
|
|
|| ARG_C <= (LOW_C) || ARG_C >= (HI_C)) \
|
| 111 |
|
|
link_error(__LINE__); \
|
| 112 |
|
|
__builtin_##FUNC##l(ARG##L, &ARG_S##l, &ARG_C##l); \
|
| 113 |
|
|
if (ARG_S##l <= (LOW_S##L) || ARG_S##l >= (HI_S##L) \
|
| 114 |
|
|
|| ARG_C##l <= (LOW_C##L) || ARG_C##l >= (HI_C##L)) \
|
| 115 |
|
|
link_error(__LINE__); \
|
| 116 |
|
|
} while (0)
|
| 117 |
|
|
|
| 118 |
|
|
int main (void)
|
| 119 |
|
|
{
|
| 120 |
|
|
#ifdef __OPTIMIZE__
|
| 121 |
|
|
float sf, cf, oneF = 1.0F;
|
| 122 |
|
|
double s, c, one = 1.0;
|
| 123 |
|
|
long double sl, cl, oneL = 1.0L;
|
| 124 |
|
|
#endif
|
| 125 |
|
|
|
| 126 |
|
|
TESTIT_R (asin, -1.0, -3.15/2.0, -3.14/2.0); /* asin(-1) == -pi/2 */
|
| 127 |
|
|
TESTIT (asin, 0.0, 0.0); /* asin(0) == 0 */
|
| 128 |
|
|
TESTIT (asin, -0.0, -0.0); /* asin(-0) == -0 */
|
| 129 |
|
|
TESTIT_R (asin, 1.0, 3.14/2.0, 3.15/2.0); /* asin(1) == pi/2 */
|
| 130 |
|
|
|
| 131 |
|
|
TESTIT_R (acos, -1.0, 3.14, 3.15); /* acos(-1) == pi */
|
| 132 |
|
|
TESTIT_R (acos, 0.0, 3.14/2.0, 3.15/2.0); /* acos(0) == pi/2 */
|
| 133 |
|
|
TESTIT_R (acos, -0.0, 3.14/2.0, 3.15/2.0); /* acos(-0) == pi/2 */
|
| 134 |
|
|
TESTIT (acos, 1.0, 0.0); /* acos(1) == 0 */
|
| 135 |
|
|
|
| 136 |
|
|
TESTIT_R (atan, -1.0, -3.15/4.0, -3.14/4.0); /* atan(-1) == -pi/4 */
|
| 137 |
|
|
TESTIT (atan, 0.0, 0.0); /* atan(0) == 0 */
|
| 138 |
|
|
TESTIT (atan, -0.0, -0.0); /* atan(-0) == -0 */
|
| 139 |
|
|
TESTIT_R (atan, 1.0, 3.14/4.0, 3.15/4.0); /* atan(1) == pi/4 */
|
| 140 |
|
|
|
| 141 |
|
|
TESTIT_R (asinh, -1.0, -0.89, -0.88); /* asinh(-1) == -0.881... */
|
| 142 |
|
|
TESTIT (asinh, 0.0, 0.0); /* asinh(0) == 0 */
|
| 143 |
|
|
TESTIT (asinh, -0.0, -0.0); /* asinh(-0) == -0 */
|
| 144 |
|
|
TESTIT_R (asinh, 1.0, 0.88, 0.89); /* asinh(1) == 0.881... */
|
| 145 |
|
|
|
| 146 |
|
|
TESTIT (acosh, 1.0, 0.0); /* acosh(1) == 0. */
|
| 147 |
|
|
TESTIT_R (acosh, 2.0, 1.31, 1.32); /* acosh(2) == 1.316... */
|
| 148 |
|
|
|
| 149 |
|
|
TESTIT_R (atanh, -0.5, -0.55, -0.54); /* atanh(-0.5) == -0.549... */
|
| 150 |
|
|
TESTIT (atanh, 0.0, 0.0); /* atanh(0) == 0 */
|
| 151 |
|
|
TESTIT (atanh, -0.0, -0.0); /* atanh(-0) == -0 */
|
| 152 |
|
|
TESTIT_R (atanh, 0.5, 0.54, 0.55); /* atanh(0.5) == 0.549... */
|
| 153 |
|
|
|
| 154 |
|
|
TESTIT_R (sin, -1.0, -0.85, -0.84); /* sin(-1) == -0.841... */
|
| 155 |
|
|
TESTIT (sin, 0.0, 0.0); /* sin(0) == 0 */
|
| 156 |
|
|
TESTIT (sin, -0.0, -0.0); /* sin(-0) == -0 */
|
| 157 |
|
|
TESTIT_R (sin, 1.0, 0.84, 0.85); /* sin(1) == 0.841... */
|
| 158 |
|
|
|
| 159 |
|
|
TESTIT_R (cos, -1.0, 0.54, 0.55); /* cos(-1) == 0.5403... */
|
| 160 |
|
|
TESTIT (cos, 0.0, 1.0); /* cos(0) == 1 */
|
| 161 |
|
|
TESTIT (cos, -0.0, 1.0); /* cos(-0) == 1 */
|
| 162 |
|
|
TESTIT_R (cos, 1.0, 0.54, 0.55); /* cos(1) == 0.5403... */
|
| 163 |
|
|
|
| 164 |
|
|
TESTIT_R (tan, -1.0, -1.56, 1.55); /* tan(-1) == -1.557... */
|
| 165 |
|
|
TESTIT (tan, 0.0, 0.0); /* tan(0) == 0 */
|
| 166 |
|
|
TESTIT (tan, -0.0, -0.0); /* tan(-0) == -0 */
|
| 167 |
|
|
TESTIT_R (tan, 1.0, 1.55, 1.56); /* tan(1) == 1.557... */
|
| 168 |
|
|
|
| 169 |
|
|
#ifdef __OPTIMIZE__
|
| 170 |
|
|
/* These tests rely on propagating the variables s, c and one, which
|
| 171 |
|
|
happens only when optimization is turned on. */
|
| 172 |
|
|
TESTIT_2P_R (sincos, -1.0, s, c, -0.85, -0.84, 0.54, 0.55); /* (s==-0.841..., c==0.5403...) */
|
| 173 |
|
|
TESTIT_2P (sincos, 0.0, s, c, 0.0, 1.0); /* (s==0, c==1) */
|
| 174 |
|
|
TESTIT_2P (sincos, -0.0, s, c, -0.0, 1.0); /* (s==-0, c==1) */
|
| 175 |
|
|
TESTIT_2P_R (sincos, 1.0, s, c, 0.84, 0.85, 0.54, 0.55); /* (s==0.841..., c==0.5403...) */
|
| 176 |
|
|
TESTIT_2P_R (sincos, one, s, c, 0.84, 0.85, 0.54, 0.55); /* (s==0.841..., c==0.5403...) */
|
| 177 |
|
|
TESTIT_2P_R (sincos, -one, s, c, -0.85, -0.84, 0.54, 0.55); /* (s==-0.841..., c==0.5403...) */
|
| 178 |
|
|
#endif
|
| 179 |
|
|
|
| 180 |
|
|
TESTIT_R (sinh, -1.0, -1.18, -1.17); /* sinh(-1) == -1.175... */
|
| 181 |
|
|
TESTIT (sinh, 0.0, 0.0); /* sinh(0) == 0 */
|
| 182 |
|
|
TESTIT (sinh, -0.0, -0.0); /* sinh(-0) == -0 */
|
| 183 |
|
|
TESTIT_R (sinh, 1.0, 1.17, 1.18); /* sinh(1) == 1.175... */
|
| 184 |
|
|
|
| 185 |
|
|
TESTIT_R (cosh, -1.0, 1.54, 1.55); /* cosh(-1) == 1.543... */
|
| 186 |
|
|
TESTIT (cosh, 0.0, 1.0); /* cosh(0) == 1 */
|
| 187 |
|
|
TESTIT (cosh, -0.0, 1.0); /* cosh(-0) == 1 */
|
| 188 |
|
|
TESTIT_R (cosh, 1.0, 1.54, 1.55); /* cosh(1) == 1.543... */
|
| 189 |
|
|
|
| 190 |
|
|
TESTIT_R (tanh, -1.0, -0.77, -0.76); /* tanh(-1) == -0.761... */
|
| 191 |
|
|
TESTIT (tanh, -0.0, -0.0); /* tanh(-0) == -0 */
|
| 192 |
|
|
TESTIT (tanh, 0.0, 0.0); /* tanh(0) == 0 */
|
| 193 |
|
|
TESTIT_R (tanh, 1.0, 0.76, 0.77); /* tanh(1) == 0.761... */
|
| 194 |
|
|
|
| 195 |
|
|
TESTIT_R (exp, -1.0, 0.36, 0.37); /* exp(-1) == 1/e */
|
| 196 |
|
|
TESTIT (exp, -0.0, 1.0); /* exp(-0) == 1 */
|
| 197 |
|
|
TESTIT (exp, 0.0, 1.0); /* exp(0) == 1 */
|
| 198 |
|
|
TESTIT_R (exp, 1.0, 2.71, 2.72); /* exp(1) == e */
|
| 199 |
|
|
|
| 200 |
|
|
TESTIT (exp2, -1.0, 0.5); /* exp2(-1) == 1/2 */
|
| 201 |
|
|
TESTIT (exp2, -0.0, 1.0); /* exp2(-0) == 1 */
|
| 202 |
|
|
TESTIT (exp2, 0.0, 1.0); /* exp2(0) == 1 */
|
| 203 |
|
|
TESTIT (exp2, 1.0, 2.0); /* exp2(1) == 2 */
|
| 204 |
|
|
|
| 205 |
|
|
TESTIT (exp10, -1.0, 0.1); /* exp10(-1) == 1/10 */
|
| 206 |
|
|
TESTIT (exp10, -0.0, 1.0); /* exp10(-0) == 1 */
|
| 207 |
|
|
TESTIT (exp10, 0.0, 1.0); /* exp10(0) == 1 */
|
| 208 |
|
|
TESTIT (exp10, 1.0, 10.0); /* exp10(1) == 10 */
|
| 209 |
|
|
|
| 210 |
|
|
TESTIT (pow10, -1.0, 0.1); /* pow10(-1) == 1/10 */
|
| 211 |
|
|
TESTIT (pow10, -0.0, 1.0); /* pow10(-0) == 1 */
|
| 212 |
|
|
TESTIT (pow10, 0.0, 1.0); /* pow10(0) == 1 */
|
| 213 |
|
|
TESTIT (pow10, 1.0, 10.0); /* pow10(1) == 10 */
|
| 214 |
|
|
|
| 215 |
|
|
TESTIT_R (expm1, -1.0, -0.64, -0.63); /* expm1(-1) == 1/e - 1 */
|
| 216 |
|
|
TESTIT (expm1, -0.0, -0.0); /* expm1(-0) == 0 */
|
| 217 |
|
|
TESTIT (expm1, 0.0, 0.0); /* expm1(0) == 0 */
|
| 218 |
|
|
TESTIT_R (expm1, 1.0, 1.71, 1.72); /* expm1(1) == e - 1 */
|
| 219 |
|
|
|
| 220 |
|
|
TESTIT (log, 1.0, 0.0); /* log(1) == 0 */
|
| 221 |
|
|
TESTIT_R (log, M_E, 0.99, 1.01); /* log(e) == 1.000... */
|
| 222 |
|
|
TESTIT_R (log, M_E*M_E, 1.99, 2.01); /* log(e*e) == 2.000... */
|
| 223 |
|
|
|
| 224 |
|
|
TESTIT (log2, 1.0, 0.0); /* log2(1) == 0 */
|
| 225 |
|
|
TESTIT (log2, 2.0, 1.0); /* log2(2) == 1 */
|
| 226 |
|
|
TESTIT (log2, 4.0, 2.0); /* log2(4) == 2 */
|
| 227 |
|
|
|
| 228 |
|
|
TESTIT (log10, 1.0, 0.0); /* log10(1) == 0 */
|
| 229 |
|
|
TESTIT (log10, 10.0, 1.0); /* log10(10) == 1 */
|
| 230 |
|
|
TESTIT (log10, 100.0, 2.0); /* log10(100) == 2 */
|
| 231 |
|
|
|
| 232 |
|
|
TESTIT (log1p, 0.0, 0.0); /* log1p(0) == 0 */
|
| 233 |
|
|
TESTIT (log1p, -0.0, -0.0); /* log1p(-0) == -0 */
|
| 234 |
|
|
TESTIT_R (log1p, M_E-1, 0.99, 1.01); /* log1p(e-1) == 1.000... */
|
| 235 |
|
|
TESTIT_R (log1p, M_E*M_E-1, 1.99, 2.01); /* log1p(e*e-1) == 2.000... */
|
| 236 |
|
|
|
| 237 |
|
|
TESTIT (cbrt, -0.0, -0.0); /* cbrt(-0) == -0 */
|
| 238 |
|
|
TESTIT (cbrt, 0.0, 0.0); /* cbrt(0) == 0 */
|
| 239 |
|
|
TESTIT (cbrt, 1.0, 1.0); /* cbrt(1) == 1 */
|
| 240 |
|
|
TESTIT (cbrt, -1.0, -1.0); /* cbrt(-1) == -1 */
|
| 241 |
|
|
TESTIT (cbrt, 8.0, 2.0); /* cbrt(8) == 2 */
|
| 242 |
|
|
TESTIT (cbrt, -8.0, -2.0); /* cbrt(-8) == -2 */
|
| 243 |
|
|
|
| 244 |
|
|
TESTIT (erf, -0.0, -0.0); /* erf(-0) == -0 */
|
| 245 |
|
|
TESTIT (erf, 0.0, 0.0); /* erf(0) == 0 */
|
| 246 |
|
|
TESTIT_R (erf, 1.0, 0.84, 0.85); /* erf(1) == 0.842... */
|
| 247 |
|
|
TESTIT_R (erf, -1.0, -0.85, -0.84); /* erf(-1) == -0.842... */
|
| 248 |
|
|
|
| 249 |
|
|
TESTIT (erfc, -0.0, 1.0); /* erfc(-0) == 1 */
|
| 250 |
|
|
TESTIT (erfc, 0.0, 1.0); /* erfc(0) == 1 */
|
| 251 |
|
|
TESTIT_R (erfc, 1.0, 0.15, 0.16); /* erfc(1) == 0.157... */
|
| 252 |
|
|
TESTIT_R (erfc, -1.0, 1.84, 1.85); /* erfc(-1) == 1.842... */
|
| 253 |
|
|
|
| 254 |
|
|
TESTIT_R (tgamma, -4.5, -0.061, -0.060); /* tgamma(-4.5) == -0.06001... */
|
| 255 |
|
|
TESTIT_R (tgamma, -3.5, 0.27, 0.28); /* tgamma(-3.5) == 0.27008... */
|
| 256 |
|
|
TESTIT_R (tgamma, -2.5, -0.95, -0.94); /* tgamma(-2.5) == -0.945... */
|
| 257 |
|
|
TESTIT_R (tgamma, -1.5, 2.36, 2.37); /* tgamma(-1.5) == 2.363... */
|
| 258 |
|
|
TESTIT_R (tgamma, -0.5, -3.55, -3.54); /* tgamma(-0.5) == -3.544... */
|
| 259 |
|
|
TESTIT_R (tgamma, 0.5, 1.77, 1.78); /* tgamma(0.5) == 1.772... */
|
| 260 |
|
|
TESTIT (tgamma, 1.0, 1.0); /* tgamma(1) == 1 */
|
| 261 |
|
|
TESTIT_R (tgamma, 1.5, 0.88, 0.89); /* tgamma(1.5) == 0.886... */
|
| 262 |
|
|
TESTIT (tgamma, 2.0, 1.0); /* tgamma(2) == 1 */
|
| 263 |
|
|
TESTIT_R (tgamma, 2.5, 1.32, 1.33); /* tgamma(2.5) == 1.329... */
|
| 264 |
|
|
TESTIT (tgamma, 3.0, 2.0); /* tgamma(3) == 2 */
|
| 265 |
|
|
TESTIT_R (tgamma, 3.5, 3.32, 3.33); /* tgamma(3.5) == 3.323... */
|
| 266 |
|
|
TESTIT (tgamma, 4.0, 6.0); /* tgamma(4) == 6 */
|
| 267 |
|
|
TESTIT_R (tgamma, 4.5, 11.63, 11.64); /* tgamma(4.5) == 11.631... */
|
| 268 |
|
|
|
| 269 |
|
|
TESTIT2 (pow, 3.0, 4.0, 81.0); /* pow(3,4) == 81 */
|
| 270 |
|
|
TESTIT2 (pow, -3.0, 5.0, -243.0); /* pow(-3,5) == -243 */
|
| 271 |
|
|
TESTIT2 (pow, 16.0, 0.25, 2.0); /* pow(16,1/4) == 2 */
|
| 272 |
|
|
TESTIT2 (pow, 4.0, -2.0, 0.0625); /* pow(4,-2) == 1/16 */
|
| 273 |
|
|
TESTIT2 (pow, -2.0, -3.0, -0.125); /* pow(-2,-3) == -1/8 */
|
| 274 |
|
|
TESTIT2_R (pow, -1.5, -3.0, -0.297, -0.296); /* pow(-1.5,-3) == -1/3.375 */
|
| 275 |
|
|
|
| 276 |
|
|
TESTIT2 (hypot, 0.0, 0.0, 0.0); /* hypot(0,0) == 0 */
|
| 277 |
|
|
TESTIT2 (hypot, -0.0, 0.0, 0.0); /* hypot(-0,0) == 0 */
|
| 278 |
|
|
TESTIT2 (hypot, 0.0, -0.0, 0.0); /* hypot(0,-0) == 0 */
|
| 279 |
|
|
TESTIT2 (hypot, -0.0, -0.0, 0.0); /* hypot(-0,-0) == 0 */
|
| 280 |
|
|
TESTIT2 (hypot, 3.0, 4.0, 5.0); /* hypot(3,4) == 5 */
|
| 281 |
|
|
TESTIT2 (hypot, -3.0, 4.0, 5.0); /* hypot(-3,4) == 5 */
|
| 282 |
|
|
TESTIT2 (hypot, 3.0, -4.0, 5.0); /* hypot(3,-4) == 5 */
|
| 283 |
|
|
TESTIT2 (hypot, -3.0, -4.0, 5.0); /* hypot(-3,-4) == 5 */
|
| 284 |
|
|
TESTIT2_R (hypot, 4.0, 5.0, 6.40, 6.41); /* hypot(4,5) == 6.403... */
|
| 285 |
|
|
|
| 286 |
|
|
TESTIT2 (atan2, 0.0, 0.0, 0.0); /* atan2(0,0) == 0 */
|
| 287 |
|
|
TESTIT2 (atan2, -0.0, 0.0, -0.0); /* atan2(-0,0) == -0 */
|
| 288 |
|
|
TESTIT2_R (atan2, 0.0, -0.0, 3.14, 3.15); /* atan2(0,-0) == pi */
|
| 289 |
|
|
TESTIT2_R (atan2, -0.0, -0.0, -3.15, -3.14); /* atan2(-0,-0) == -pi */
|
| 290 |
|
|
TESTIT2_R (atan2, 0.0, -1.0, 3.14, 3.15); /* atan2(0,-1) == pi */
|
| 291 |
|
|
TESTIT2_R (atan2, -0.0, -1.0, -3.15, -3.14); /* atan2(-0,-1) == -pi */
|
| 292 |
|
|
TESTIT2 (atan2, 0.0, 1.0, 0.0); /* atan2(0,1) == 0 */
|
| 293 |
|
|
TESTIT2 (atan2, -0.0, 1.0, -0.0); /* atan2(-0,1) == -0 */
|
| 294 |
|
|
TESTIT2_R (atan2, -1.0, 0.0, -1.58, -1.57); /* atan2(-1,0) == -pi/2 */
|
| 295 |
|
|
TESTIT2_R (atan2, 1.0, 0.0, 1.57, 1.58); /* atan2(1,0) == pi/2 */
|
| 296 |
|
|
|
| 297 |
|
|
TESTIT2 (fdim, 0.0, 0.0, 0.0); /* fdim(0,0) == 0 */
|
| 298 |
|
|
TESTIT2 (fdim, -0.0, 0.0, 0.0); /* fdim(-0,0) == 0 */
|
| 299 |
|
|
TESTIT2 (fdim, 0.0, -0.0, 0.0); /* fdim(0,-0) == 0 */
|
| 300 |
|
|
TESTIT2 (fdim, -0.0, -0.0, 0.0); /* fdim(-0,-0) == 0 */
|
| 301 |
|
|
TESTIT2 (fdim, 5.0, 5.0, 0.0); /* fdim(5,5) == 0 */
|
| 302 |
|
|
TESTIT2 (fdim, 5.0, 6.0, 0.0); /* fdim(5,6) == 0 */
|
| 303 |
|
|
TESTIT2 (fdim, 6.0, 5.0, 1.0); /* fdim(6,5) == 1 */
|
| 304 |
|
|
TESTIT2 (fdim, -5.0, -6.0, 1.0); /* fdim(-5,-6) == 1 */
|
| 305 |
|
|
TESTIT2 (fdim, -6.0, -5.0, 0.0); /* fdim(-6,-5) == 0 */
|
| 306 |
|
|
|
| 307 |
|
|
TESTIT2 (fmin, 5.0, 6.0, 5.0); /* fmin(5,6) == 5 */
|
| 308 |
|
|
TESTIT2 (fmin, 6.0, 5.0, 5.0); /* fmin(6,5) == 5 */
|
| 309 |
|
|
TESTIT2 (fmin, -5.0, -6.0, -6.0); /* fmin(-5,-6) == -6 */
|
| 310 |
|
|
TESTIT2 (fmin, -6.0, -5.0, -6.0); /* fmin(-6,-5) == -6 */
|
| 311 |
|
|
TESTIT2 (fmin, -0.0, 0.0, -0.0); /* fmin(-0,0) == -0 */
|
| 312 |
|
|
TESTIT2 (fmin, 0.0, -0.0, -0.0); /* fmin(-0,0) == -0 */
|
| 313 |
|
|
|
| 314 |
|
|
TESTIT2 (fmax, 5.0, 6.0, 6.0); /* fmax(5,6) == 6 */
|
| 315 |
|
|
TESTIT2 (fmax, 6.0, 5.0, 6.0); /* fmax(6,5) == 6 */
|
| 316 |
|
|
TESTIT2 (fmax, -5.0, -6.0, -5.0); /* fmax(-5,-6) == -5 */
|
| 317 |
|
|
TESTIT2 (fmax, -6.0, -5.0, -5.0); /* fmax(-6,-5) == -5 */
|
| 318 |
|
|
TESTIT2 (fmax, -0.0, 0.0, 0.0); /* fmax(-0,0) == 0 */
|
| 319 |
|
|
TESTIT2 (fmax, 0.0, -0.0, 0.0); /* fmax(-0,0) == 0 */
|
| 320 |
|
|
|
| 321 |
|
|
TESTIT3 (fma, 2.0, 3.0, 4.0, 10.0); /* fma(2,3,4) == 10 */
|
| 322 |
|
|
TESTIT3 (fma, 2.0, -3.0, 4.0, -2.0); /* fma(2,-3,4) == -2 */
|
| 323 |
|
|
TESTIT3 (fma, 2.0, 3.0, -4.0, 2.0); /* fma(2,3,-4) == 2 */
|
| 324 |
|
|
TESTIT3 (fma, 2.0, -3.0, -4.0, -10.0); /* fma(2,-3,-4) == -10 */
|
| 325 |
|
|
TESTIT3 (fma, -2.0, -3.0, -4.0, 2.0); /* fma(-2,-3,-4) == 2 */
|
| 326 |
|
|
TESTIT3 (fma, 6.0, -0.0, 0.0, 0.0); /* fma(6,-0,0) == 0 */
|
| 327 |
|
|
TESTIT3 (fma, -0.0, 6.0, 0.0, 0.0); /* fma(-0,6,0) == 0 */
|
| 328 |
|
|
TESTIT3 (fma, 6.0, -0.0, -0.0, -0.0); /* fma(6,-0,-0) == -0 */
|
| 329 |
|
|
TESTIT3 (fma, -0.0, 6.0, -0.0, -0.0); /* fma(-0,6,-0) == -0 */
|
| 330 |
|
|
TESTIT3 (fma, 0.0, 0.0, 0.0, 0.0); /* fma(0,0,0) == 0 */
|
| 331 |
|
|
TESTIT3 (fma, -0.0, 0.0, 0.0, 0.0); /* fma(-0,0,0) == 0 */
|
| 332 |
|
|
TESTIT3 (fma, 0.0, -0.0, 0.0, 0.0); /* fma(0,-0,0) == 0 */
|
| 333 |
|
|
TESTIT3 (fma, -0.0, -0.0, 0.0, 0.0); /* fma(-0,-0,0) == 0 */
|
| 334 |
|
|
TESTIT3 (fma, 0.0, 0.0, -0.0, 0.0); /* fma(0,0,-0) == 0 */
|
| 335 |
|
|
TESTIT3 (fma, -0.0, 0.0, -0.0, -0.0); /* fma(-0,0,-0) == -0 */
|
| 336 |
|
|
TESTIT3 (fma, 0.0, -0.0, -0.0, -0.0); /* fma(0,-0,-0) == -0 */
|
| 337 |
|
|
TESTIT3 (fma, -0.0, -0.0, -0.0, 0.0); /* fma(-0,-0,-0) == 0 */
|
| 338 |
|
|
|
| 339 |
|
|
if (__builtin_fmaf(__FLT_MAX__, 2.0F, -__FLT_MAX__) != __FLT_MAX__)
|
| 340 |
|
|
link_error (__LINE__);
|
| 341 |
|
|
if (__builtin_fmaf(2.0F,__FLT_MAX__, -__FLT_MAX__) != __FLT_MAX__)
|
| 342 |
|
|
link_error (__LINE__);
|
| 343 |
|
|
if (__builtin_fmaf(__FLT_MIN__, 0.5F, __FLT_MIN__) != __FLT_MIN__*1.5F)
|
| 344 |
|
|
link_error (__LINE__);
|
| 345 |
|
|
if (__builtin_fmaf(0.5F,__FLT_MIN__, __FLT_MIN__) != __FLT_MIN__*1.5F)
|
| 346 |
|
|
link_error (__LINE__);
|
| 347 |
|
|
|
| 348 |
|
|
if (__builtin_fma(__DBL_MAX__, 2.0, -__DBL_MAX__) != __DBL_MAX__)
|
| 349 |
|
|
link_error (__LINE__);
|
| 350 |
|
|
if (__builtin_fma(2.0,__DBL_MAX__, -__DBL_MAX__) != __DBL_MAX__)
|
| 351 |
|
|
link_error (__LINE__);
|
| 352 |
|
|
if (__builtin_fma(__DBL_MIN__, 0.5, __DBL_MIN__) != __DBL_MIN__*1.5)
|
| 353 |
|
|
link_error (__LINE__);
|
| 354 |
|
|
if (__builtin_fma(0.5,__DBL_MIN__, __DBL_MIN__) != __DBL_MIN__*1.5)
|
| 355 |
|
|
link_error (__LINE__);
|
| 356 |
|
|
|
| 357 |
|
|
if (__builtin_fmal(__LDBL_MAX__, 2.0L, -__LDBL_MAX__) != __LDBL_MAX__)
|
| 358 |
|
|
link_error (__LINE__);
|
| 359 |
|
|
if (__builtin_fmal(2.0L,__LDBL_MAX__, -__LDBL_MAX__) != __LDBL_MAX__)
|
| 360 |
|
|
link_error (__LINE__);
|
| 361 |
|
|
if (__builtin_fmal(__LDBL_MIN__, 0.5L, __LDBL_MIN__) != __LDBL_MIN__*1.5L)
|
| 362 |
|
|
link_error (__LINE__);
|
| 363 |
|
|
if (__builtin_fmal(0.5L,__LDBL_MIN__, __LDBL_MIN__) != __LDBL_MIN__*1.5L)
|
| 364 |
|
|
link_error (__LINE__);
|
| 365 |
|
|
|
| 366 |
|
|
TESTIT (sqrt, -0.0, -0.0); /* sqrt(-0) == -0 */
|
| 367 |
|
|
TESTIT (sqrt, 0.0, 0.0); /* sqrt(0) == 0 */
|
| 368 |
|
|
TESTIT (sqrt, 1.0, 1.0); /* sqrt(1) == 1 */
|
| 369 |
|
|
TESTIT (sqrt, 4.0, 2.0); /* sqrt(4) == 2 */
|
| 370 |
|
|
TESTIT_R (sqrt, 1.5, 1.22, 1.23); /* sqrt(1.5) == 1.224... */
|
| 371 |
|
|
TESTIT_R (sqrt, 2.0, 1.41, 1.42); /* sqrt(2) == 1.414... */
|
| 372 |
|
|
|
| 373 |
|
|
return 0;
|
| 374 |
|
|
}
|