diff options
Diffstat (limited to 'math/libm-test.c')
| -rw-r--r-- | math/libm-test.c | 635 |
1 files changed, 562 insertions, 73 deletions
diff --git a/math/libm-test.c b/math/libm-test.c index 5171d0fc5e..356cc91a16 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -633,8 +633,9 @@ cbrt_test (void) check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt) (minus_infty)); check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt) (nan_value)); - check ("cbrt (8) == 2", FUNC(cbrt) (8), 2); - check ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0); + check_eps ("cbrt (8) == 2", FUNC(cbrt) (8), 2, CHOOSE (5e-17L, 0, 0)); + check_eps ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0, + CHOOSE (3e-16L, 0, 0)); } @@ -1573,19 +1574,19 @@ remquo_test (void) result = FUNC(remquo) (1.625, 1.0, &quo); check ("remquo(1.625, 1.0, &x) == -0.375", result, -0.375); - check ("remquo(1.625, 1.0, &x) puts 1 in x", quo, 1); + check_long ("remquo(1.625, 1.0, &x) puts 1 in x", quo, 1); result = FUNC(remquo) (-1.625, 1.0, &quo); check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375); - check ("remquo(-1.625, 1.0, &x) puts -1 in x", quo, -1); + check_long ("remquo(-1.625, 1.0, &x) puts -1 in x", quo, -1); result = FUNC(remquo) (1.625, -1.0, &quo); - check ("remquo(1.125, -1.0, &x) == 0.125", result, 0.125); - check ("remquo(1.125, -1.0, &x) puts -1 in x", quo, -1); + check ("remquo(1.625, -1.0, &x) == -0.375", result, -0.375); + check_long ("remquo(1.625, -1.0, &x) puts -1 in x", quo, -1); result = FUNC(remquo) (-1.625, -1.0, &quo); - check ("remquo(-1.125, -1.0, &x) == 0.125", result, 0.125); - check ("remquo(-1.125, -1.0, &x) puts 1 in x", quo, 1); + check ("remquo(-1.625, -1.0, &x) == 0.375", result, 0.375); + check_long ("remquo(-1.625, -1.0, &x) puts 1 in x", quo, 1); } @@ -1667,10 +1668,10 @@ cexp_test (void) result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0)); check_isnan ("real(cexp(NaN + 1i)) = NaN", __real__ result); check_isnan ("imag(cexp(NaN + 1i)) = NaN", __imag__ result); - result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0)); + result = FUNC(cexp) (BUILD_COMPLEX (nan_value, plus_infty)); check_isnan ("real(cexp(NaN + i inf)) = NaN", __real__ result); check_isnan ("imag(cexp(NaN + i inf)) = NaN", __imag__ result); - result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0)); + result = FUNC(cexp) (BUILD_COMPLEX (nan_value, nan_value)); check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result); check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result); @@ -1702,16 +1703,16 @@ csinh_test (void) check ("imag(csinh(-0 - 0i)) = -0", __imag__ result, minus_zero); result = FUNC(csinh) (BUILD_COMPLEX (0.0, plus_infty)); - check ("real(csinh(0 + i Inf)) = 0", FUNC(fabs) (__real__ result), 0); + check ("real(csinh(0 + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0); check_isnan ("imag(csinh(0 + i Inf)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, plus_infty)); - check ("real(csinh(-0 + i Inf)) = -0", FUNC(fabs) (__real__ result), 0); + check ("real(csinh(-0 + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0); check_isnan ("imag(csinh(-0 + i Inf)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_infty)); - check ("real(csinh(0 - i Inf)) = 0", FUNC(fabs) (__real__ result), 0); + check ("real(csinh(0 - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0); check_isnan ("imag(csinh(0 - i Inf)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_infty)); - check ("real(csinh(-0 - i Inf)) = -0", FUNC(fabs) (__real__ result), 0); + check ("real(csinh(-0 - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0); check_isnan ("imag(csinh(-0 - i Inf)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 0.0)); @@ -1740,7 +1741,7 @@ csinh_test (void) FUNC(fabs) (__real__ result)); check_isnan ("imag(csinh(Inf - i Inf)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_infty)); - check_isinfp ("real(csinh(-Inf - i Inf)) = -Inf", + check_isinfp ("real(csinh(-Inf - i Inf)) = +-Inf", FUNC(fabs) (__real__ result)); check_isnan ("imag(csinh(-Inf - i Inf)) = NaN", __imag__ result); @@ -1771,10 +1772,10 @@ csinh_test (void) check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (0.0, nan_value)); - check ("real(csinh(0 + i NaN)) = 0", FUNC(fabs) (__real__ result), 0); + check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0); check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, nan_value)); - check ("real(csinh(-0 + i NaN)) = -0", FUNC(fabs) (__real__ result), 0); + check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0); check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, nan_value)); @@ -1784,7 +1785,7 @@ csinh_test (void) result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, nan_value)); check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf", FUNC(fabs) (__real__ result)); - check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result); + check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result); result = FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value)); check_isnan ("real(csinh(9.0 + i NaN)) = NaN", __real__ result); @@ -1795,10 +1796,10 @@ csinh_test (void) result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 0.0)); check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result); - check ("imag(csinh(NaN + i0)) = NaN", __imag__ result, 0.0); + check ("imag(csinh(NaN + i0)) = 0", __imag__ result, 0.0); result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_zero)); check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result); - check ("imag(csinh(NaN - i0)) = NaN", __imag__ result, minus_zero); + check ("imag(csinh(NaN - i0)) = -0", __imag__ result, minus_zero); result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0)); check_isnan ("real(csinh(NaN + i10)) = NaN", __real__ result); @@ -1821,21 +1822,152 @@ csinh_test (void) static void +ccos_test (void) +{ + __complex__ MATHTYPE result; + + result = FUNC(ccos) (BUILD_COMPLEX (0.0, 0.0)); + check ("real(ccos(0 + 0i)) = 1.0", __real__ result, 1.0); + check ("imag(ccos(0 + 0i)) = 0", __imag__ result, 0); + result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, 0.0)); + check ("real(ccos(-0 + 0i)) = 1.0", __real__ result, 1.0); + check ("imag(ccos(-0 + 0i)) = -0", __imag__ result, minus_zero); + result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_zero)); + check ("real(ccos(0 - 0i)) = 1.0", __real__ result, 1.0); + check ("imag(ccos(0 - 0i)) = 0", __imag__ result, 0.0); + result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_zero)); + check ("real(ccos(-0 - 0i)) = 1.0", __real__ result, 1.0); + check ("imag(ccos(-0 - 0i)) = -0", __imag__ result, minus_zero); + + result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 0.0)); + check_isnan ("real(ccos(+Inf + i0)) = NaN", __real__ result); + check ("imag(ccos(Inf + i0)) = +-0", FUNC(fabs) (__imag__ result), 0); + result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_zero)); + check_isnan ("real(ccos(Inf - i0)) = NaN", __real__ result); + check ("imag(ccos(Inf - i0)) = +-0", FUNC(fabs) (__imag__ result), 0); + result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 0.0)); + check_isnan ("real(ccos(-Inf + i0)) = NaN", __real__ result); + check ("imag(ccos(-Inf + i0)) = +-0", FUNC(fabs) (__imag__ result), 0); + result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_zero)); + check_isnan ("real(ccos(-Inf - i0)) = NaN", __real__ result); + check ("imag(ccos(-Inf - i0)) = +-0", FUNC(fabs) (__imag__ result), 0); + + result = FUNC(ccos) (BUILD_COMPLEX (0.0, plus_infty)); + check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result); + check ("imag(ccos(0 + i Inf)) = 0", __imag__ result, 0); + result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_infty)); + check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result); + check ("imag(ccos(0 - i Inf)) = 0", __imag__ result, 0); + result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, plus_infty)); + check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result); + check ("imag(ccos(-0 + i Inf)) = -0", __imag__ result, minus_zero); + result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_infty)); + check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result); + check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result, minus_zero); + + result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, plus_infty)); + check_isinfp ("real(ccos(+Inf + i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccos(+Inf + i Inf)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, plus_infty)); + check_isinfp ("real(ccos(-Inf + i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccos(-Inf + i Inf)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_infty)); + check_isinfp ("real(ccos(Inf - i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccos(Inf - i Inf)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_infty)); + check_isinfp ("real(ccos(-Inf - i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccos(-Inf - i Inf)) = NaN", __imag__ result); + + result = FUNC(ccos) (BUILD_COMPLEX (4.625, plus_infty)); + check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result); + check_isinfn ("imag(ccos(4.625 + i Inf)) = -Inf", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (4.625, minus_infty)); + check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result); + check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (-4.625, plus_infty)); + check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result); + check_isinfp ("imag(ccos(-4.625 + i Inf)) = +Inf", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (-4.625, minus_infty)); + check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result); + check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result); + + result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 6.75)); + check_isnan ("real(ccos(+Inf + i6.75)) = NaN", __real__ result); + check_isnan ("imag(ccos(+Inf + i6.75)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, -6.75)); + check_isnan ("real(ccos(+Inf - i6.75)) = NaN", __real__ result); + check_isnan ("imag(ccos(+Inf - i6.75)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 6.75)); + check_isnan ("real(ccos(-Inf + i6.75)) = NaN", __real__ result); + check_isnan ("imag(ccos(-Inf + i6.75)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, -6.75)); + check_isnan ("real(ccos(-Inf - i6.75)) = NaN", __real__ result); + check_isnan ("imag(ccos(-Inf - i6.75)) = NaN", __imag__ result); + + result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 0.0)); + check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result); + check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0); + result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_zero)); + check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result); + check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0); + + result = FUNC(ccos) (BUILD_COMPLEX (nan_value, plus_infty)); + check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_infty)); + check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result); + check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result); + + result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 9.0)); + check_isnan ("real(ccos(NaN + i9.0)) = NaN", __real__ result); + check_isnan ("imag(ccos(NaN + i9.0)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (nan_value, -9.0)); + check_isnan ("real(ccos(NaN - i9.0)) = NaN", __real__ result); + check_isnan ("imag(ccos(NaN - i9.0)) = NaN", __imag__ result); + + result = FUNC(ccos) (BUILD_COMPLEX (0.0, nan_value)); + check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result); + check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0); + result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, nan_value)); + check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result); + check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0); + + result = FUNC(ccos) (BUILD_COMPLEX (10.0, nan_value)); + check_isnan ("real(ccos(10 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(ccos(10 + i NaN)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (-10.0, nan_value)); + check_isnan ("real(ccos(-10 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(ccos(-10 + i NaN)) = NaN", __imag__ result); + + result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, nan_value)); + check_isnan ("real(ccos(+Inf + i NaN)) = NaN", __real__ result); + check_isnan ("imag(ccos(+Inf + i NaN)) = NaN", __imag__ result); + result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, nan_value)); + check_isnan ("real(ccos(-Inf + i NaN)) = NaN", __real__ result); + check_isnan ("imag(ccos(-Inf + i NaN)) = NaN", __imag__ result); + + result = FUNC(ccos) (BUILD_COMPLEX (nan_value, nan_value)); + check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result); + check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result); +} + + +static void ccosh_test (void) { __complex__ MATHTYPE result; result = FUNC(ccosh) (BUILD_COMPLEX (0.0, 0.0)); - check ("real(ccosh(0 + 0i)) = 0", __real__ result, 1.0); + check ("real(ccosh(0 + 0i)) = 1.0", __real__ result, 1.0); check ("imag(ccosh(0 + 0i)) = 0", __imag__ result, 0); result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, 0.0)); - check ("real(ccosh(-0 + 0i)) = -0", __real__ result, 1.0); + check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result, 1.0); check ("imag(ccosh(-0 + 0i)) = 0", __imag__ result, 0); result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_zero)); - check ("real(ccosh(0 - 0i)) = 0", __real__ result, 1.0); + check ("real(ccosh(0 - 0i)) = 1.0", __real__ result, 1.0); check ("imag(ccosh(0 - 0i)) = -0", __imag__ result, minus_zero); result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_zero)); - check ("real(ccosh(-0 - 0i)) = -0", __real__ result, 1.0); + check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result, 1.0); check ("imag(ccosh(-0 - 0i)) = -0", __imag__ result, minus_zero); result = FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty)); @@ -1843,13 +1975,13 @@ ccosh_test (void) check ("imag(ccosh(0 + i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0); result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, plus_infty)); check_isnan ("real(ccosh(-0 + i Inf)) = NaN", __real__ result); - check ("imag(ccosh(-0 + i Inf)) = -0", FUNC(fabs) (__imag__ result), 0); + check ("imag(ccosh(-0 + i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0); result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_infty)); check_isnan ("real(ccosh(0 - i Inf)) = NaN", __real__ result); - check ("imag(ccosh(0 - i Inf)) = 0", FUNC(fabs) (__imag__ result), 0); + check ("imag(ccosh(0 - i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0); result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_infty)); check_isnan ("real(ccosh(-0 - i Inf)) = NaN", __real__ result); - check ("imag(ccosh(-0 - i Inf)) = -0", FUNC(fabs) (__imag__ result), 0); + check ("imag(ccosh(-0 - i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0); result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 0.0)); check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result); @@ -1915,7 +2047,7 @@ ccosh_test (void) check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result); result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, nan_value)); check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result); - check_isnan ("imag(ccosh(-0 + i NaN)) = NaN", __imag__ result); + check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result); result = FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value)); check_isnan ("real(ccosh(9.0 + i NaN)) = NaN", __real__ result); @@ -1926,10 +2058,10 @@ ccosh_test (void) result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 0.0)); check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result); - check ("imag(ccosh(NaN + i0)) = NaN", __imag__ result, 0.0); + check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0); result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_zero)); check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result); - check ("imag(ccosh(NaN - i0)) = NaN", __imag__ result, minus_zero); + check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0); result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0)); check_isnan ("real(ccosh(NaN + i10)) = NaN", __real__ result); @@ -1951,8 +2083,6 @@ ccosh_test (void) } -#if 0 -/* Enable these tests as soon as the functions are available. */ static void cacos_test (void) { @@ -2194,6 +2324,131 @@ cacosh_test (void) static void +casin_test (void) +{ + __complex__ MATHTYPE result; + + result = FUNC(casin) (BUILD_COMPLEX (0, 0)); + check ("real(casin(0 + i0)) = 0", __real__ result, 0); + check ("imag(casin(0 + i0)) = 0", __imag__ result, 0); + result = FUNC(casin) (BUILD_COMPLEX (minus_zero, 0)); + check ("real(casin(-0 + i0)) = -0", __real__ result, minus_zero); + check ("imag(casin(-0 + i0)) = 0", __imag__ result, 0); + result = FUNC(casin) (BUILD_COMPLEX (0, minus_zero)); + check ("real(casin(0 - i0)) = 0", __real__ result, 0); + check ("imag(casin(0 - i0)) = -0", __imag__ result, minus_zero); + result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_zero)); + check ("real(casin(-0 - i0)) = -0", __real__ result, minus_zero); + check ("imag(casin(-0 - i0)) = -0", __imag__ result, minus_zero); + + result = FUNC(casin) (BUILD_COMPLEX (plus_infty, plus_infty)); + check ("real(casin(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4); + check_isinfp ("imag(casin(+Inf + i Inf)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_infty)); + check ("real(casin(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4); + check_isinfn ("imag(casin(+Inf - i Inf)) = -Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (minus_infty, plus_infty)); + check ("real(casin(-Inf + i Inf)) = -pi/4", __real__ result, -M_PI_4); + check_isinfp ("imag(casin(-Inf + i Inf)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_infty)); + check ("real(casin(-Inf - i Inf)) = -pi/4", __real__ result, -M_PI_4); + check_isinfn ("imag(casin(-Inf - i Inf)) = -Inf", __imag__ result); + + result = FUNC(casin) (BUILD_COMPLEX (-10.0, plus_infty)); + check ("real(casin(-10.0 + i Inf)) = -0", __real__ result, minus_zero); + check_isinfp ("imag(casin(-10.0 + i Inf)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (-10.0, minus_infty)); + check ("real(casin(-10.0 - i Inf)) = -0", __real__ result, minus_zero); + check_isinfn ("imag(casin(-10.0 - i Inf)) = -Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (0, plus_infty)); + check ("real(casin(0 + i Inf)) = 0", __real__ result, 0.0); + check_isinfp ("imag(casin(0 + i Inf)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (0, minus_infty)); + check ("real(casin(0 - i Inf)) = 0", __real__ result, 0.0); + check_isinfn ("imag(casin(0 - i Inf)) = -Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (minus_zero, plus_infty)); + check ("real(casin(-0 + i Inf)) = -0", __real__ result, minus_zero); + check_isinfp ("imag(casin(-0 + i Inf)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_infty)); + check ("real(casin(-0 - i Inf)) = -0", __real__ result, minus_zero); + check_isinfn ("imag(casin(-0 - i Inf)) = -Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (0.1, plus_infty)); + check ("real(casin(0.1 + i Inf)) = 0", __real__ result, 0); + check_isinfp ("imag(casin(0.1 + i Inf)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (0.1, minus_infty)); + check ("real(casin(0.1 - i Inf)) = 0", __real__ result, 0); + check_isinfn ("imag(casin(0.1 - i Inf)) = -Inf", __imag__ result); + + result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 0)); + check ("real(casin(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2); + check_isinfp ("imag(casin(-Inf + i0)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_zero)); + check ("real(casin(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2); + check_isinfn ("imag(casin(-Inf - i0)) = -Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 100)); + check ("real(casin(-Inf + i100)) = -pi/2", __real__ result, -M_PI_2); + check_isinfp ("imag(casin(-Inf + i100)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (minus_infty, -100)); + check ("real(casin(-Inf - i100)) = -pi/2", __real__ result, -M_PI_2); + check_isinfn ("imag(casin(-Inf - i100)) = -Inf", __imag__ result); + + result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0)); + check ("real(casin(+Inf + i0)) = pi/2", __real__ result, M_PI_2); + check_isinfp ("imag(casin(+Inf + i0)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_zero)); + check ("real(casin(+Inf - i0)) = pi/2", __real__ result, M_PI_2); + check_isinfn ("imag(casin(+Inf - i0)) = -Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0.5)); + check ("real(casin(+Inf + i0.5)) = pi/2", __real__ result, M_PI_2); + check_isinfp ("imag(casin(+Inf + i0.5)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (plus_infty, -0.5)); + check ("real(casin(+Inf - i0.5)) = pi/2", __real__ result, M_PI_2); + check_isinfn ("imag(casin(+Inf - i0.5)) = -Inf", __imag__ result); + + result = FUNC(casin) (BUILD_COMPLEX (nan_value, plus_infty)); + check_isnan ("real(casin(NaN + i Inf)) = NaN", __real__ result); + check_isinfp ("imag(casin(NaN + i Inf)) = +Inf", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (nan_value, minus_infty)); + check_isnan ("real(casin(NaN - i Inf)) = NaN", __real__ result); + check_isinfn ("imag(casin(NaN - i Inf)) = -Inf", __imag__ result); + + result = FUNC(casin) (BUILD_COMPLEX (0.0, nan_value)); + check ("real(casin(0 + i NaN)) = 0", __real__ result, 0.0); + check_isnan ("imag(casin(0 + i NaN)) = NaN", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (minus_zero, nan_value)); + check ("real(casin(-0 + i NaN)) = -0", __real__ result, minus_zero); + check_isnan ("imag(casin(-0 + i NaN)) = NaN", __imag__ result); + + result = FUNC(casin) (BUILD_COMPLEX (plus_infty, nan_value)); + check_isnan ("real(casin(+Inf + i NaN)) = NaN", __real__ result); + check_isinfp ("imag(casin(+Inf + i NaN)) = +-Inf", + FUNC(fabs) (__imag__ result)); + result = FUNC(casin) (BUILD_COMPLEX (minus_infty, nan_value)); + check_isnan ("real(casin(-Inf + i NaN)) = NaN", __real__ result); + check_isinfp ("imag(casin(-Inf + NaN)) = +-Inf", + FUNC(fabs) (__imag__ result)); + + result = FUNC(casin) (BUILD_COMPLEX (nan_value, 10.5)); + check_isnan ("real(casin(NaN + i10.5)) = NaN", __real__ result); + check_isnan ("imag(casin(NaN + i10.5)) = NaN", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (nan_value, -10.5)); + check_isnan ("real(casin(NaN - i10.5)) = NaN", __real__ result); + check_isnan ("imag(casin(NaN - i10.5)) = NaN", __imag__ result); + + result = FUNC(casin) (BUILD_COMPLEX (0.75, nan_value)); + check_isnan ("real(casin(0.75 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(casin(0.75 + i NaN)) = NaN", __imag__ result); + result = FUNC(casin) (BUILD_COMPLEX (-0.75, nan_value)); + check_isnan ("real(casin(-0.75 + i NaN)) = NaN", __real__ result); + check_isnan ("imag(casin(-0.75 + i NaN)) = NaN", __imag__ result); + + result = FUNC(casin) (BUILD_COMPLEX (nan_value, nan_value)); + check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result); + check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result); +} + + +static void casinh_test (void) { __complex__ MATHTYPE result; @@ -2236,6 +2491,12 @@ casinh_test (void) result = FUNC(casinh) (BUILD_COMPLEX (0, minus_infty)); check_isinfp ("real(casinh(0 - i Inf)) = +Inf", __real__ result); check ("imag(casinh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2); + result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, plus_infty)); + check_isinfn ("real(casinh(-0 + i Inf)) = -Inf", __real__ result); + check ("imag(casinh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2); + result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_infty)); + check_isinfn ("real(casinh(-0 - i Inf)) = -Inf", __real__ result); + check ("imag(casinh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2); result = FUNC(casinh) (BUILD_COMPLEX (0.1, plus_infty)); check_isinfp ("real(casinh(0.1 + i Inf)) = +Inf", __real__ result); check ("imag(casinh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2); @@ -2278,17 +2539,17 @@ casinh_test (void) result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0)); check_isnan ("real(casinh(NaN + i0)) = NaN", __real__ result); - check ("imag(casinh(NaN + i0)) = 0", __imag__ resul, 0); - result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, nan_value)); + check ("imag(casinh(NaN + i0)) = 0", __imag__ result, 0); + result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_zero)); check_isnan ("real(casinh(NaN - i0)) = NaN", __real__ result); check ("imag(casinh(NaN - i0)) = -0", __imag__ result, minus_zero); result = FUNC(casinh) (BUILD_COMPLEX (nan_value, plus_infty)); - check_isinfp ("real(casinh(NaN + i Inf)) = +Inf", + check_isinfp ("real(casinh(NaN + i Inf)) = +-Inf", FUNC(fabs) (__real__ result)); check_isnan ("imag(casinh(NaN + i Inf)) = NaN", __imag__ result); result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_infty)); - check_isinfp ("real(casinh(NaN - i Inf)) = +Inf", + check_isinfp ("real(casinh(NaN - i Inf)) = +-Inf", FUNC(fabs) (__real__ result)); check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result); @@ -2302,7 +2563,7 @@ casinh_test (void) result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0.75)); check_isnan ("real(casinh(NaN + i0.75)) = NaN", __real__ result); check_isnan ("imag(casinh(NaN + i0.75)) = NaN", __imag__ result); - result = FUNC(casinh) (BUILD_COMPLEX (-10.5, nan_value)); + result = FUNC(casinh) (BUILD_COMPLEX (-0.75, nan_value)); check_isnan ("real(casinh(NaN - i0.75)) = NaN", __real__ result); check_isnan ("imag(casinh(NaN - i0.75)) = NaN", __imag__ result); @@ -2313,6 +2574,136 @@ casinh_test (void) static void +catan_test (void) +{ + __complex__ MATHTYPE result; + + result = FUNC(catan) (BUILD_COMPLEX (0, 0)); + check ("real(catan(0 + i0)) = 0", __real__ result, 0); + check ("imag(catan(0 + i0)) = 0", __imag__ result, 0); + result = FUNC(catan) (BUILD_COMPLEX (minus_zero, 0)); + check ("real(catan(-0 + i0)) = -0", __real__ result, minus_zero); + check ("imag(catan(-0 + i0)) = 0", __imag__ result, 0); + result = FUNC(catan) (BUILD_COMPLEX (0, minus_zero)); + check ("real(catan(0 - i0)) = 0", __real__ result, 0); + check ("imag(catan(0 - i0)) = -0", __imag__ result, minus_zero); + result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_zero)); + check ("real(catan(-0 - i0)) = -0", __real__ result, minus_zero); + check ("imag(catan(-0 - i0)) = -0", __imag__ result, minus_zero); + + result = FUNC(catan) (BUILD_COMPLEX (plus_infty, plus_infty)); + check ("real(catan(+Inf + i Inf)) = pi/2", __real__ result, M_PI_2); + check ("imag(catan(+Inf + i Inf)) = 0", __imag__ result, 0); + result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_infty)); + check ("real(catan(+Inf - i Inf)) = pi/2", __real__ result, M_PI_2); + check ("imag(catan(+Inf - i Inf)) = -0", __imag__ result, minus_zero); + result = FUNC(catan) (BUILD_COMPLEX (minus_infty, plus_infty)); + check ("real(catan(-Inf + i Inf)) = -pi/2", __real__ result, -M_PI_2); + check ("imag(catan(-Inf + i Inf)) = 0", __imag__ result, 0.0); + result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_infty)); + check ("real(catan(-Inf - i Inf)) = -pi/2", __real__ result, -M_PI_2); + check ("imag(catan(-Inf - i Inf)) = -0", __imag__ result, minus_zero); + + result = FUNC(catan) (BUILD_COMPLEX (plus_infty, -10.0)); + check ("real(catan(+Inf - i10.0)) = pi/2", __real__ result, M_PI_2); + check ("imag(catan(+Inf |
