1/* Test ctanh. 2 Copyright (C) 1997-2022 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; if not, see 17 <https://www.gnu.org/licenses/>. */ 18 19#include "libm-test-driver.c" 20 21static const struct test_c_c_data ctanh_test_data[] = 22 { 23 TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0), 24 TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0), 25 TEST_c_c (ctanh, plus_infty, 2, 1.0, minus_zero), 26 TEST_c_c (ctanh, plus_infty, 3, 1.0, minus_zero), 27 TEST_c_c (ctanh, plus_infty, 4, 1.0, 0.0), 28 TEST_c_c (ctanh, plus_infty, min_value, 1.0, 0.0), 29 TEST_c_c (ctanh, plus_infty, min_subnorm_value, 1.0, 0.0), 30 TEST_c_c (ctanh, plus_infty, 0x1p127, 1.0, 0.0), 31 TEST_c_c (ctanh, plus_infty, 0x1.11p127, 1.0, minus_zero), 32#if !TEST_COND_binary32 33 TEST_c_c (ctanh, plus_infty, 0x1p1023, 1.0, minus_zero), 34 TEST_c_c (ctanh, plus_infty, 0x1.5p1023, 1.0, 0.0), 35#endif 36#if MAX_EXP >= 16384 37 TEST_c_c (ctanh, plus_infty, 0x1p16383L, 1.0, 0.0), 38 TEST_c_c (ctanh, plus_infty, 0x1.2p16383L, 1.0, minus_zero), 39#endif 40 TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero), 41 TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero), 42 TEST_c_c (ctanh, plus_infty, -2, 1.0, 0.0), 43 TEST_c_c (ctanh, plus_infty, -3, 1.0, 0.0), 44 TEST_c_c (ctanh, plus_infty, -4, 1.0, minus_zero), 45 TEST_c_c (ctanh, plus_infty, -min_value, 1.0, minus_zero), 46 TEST_c_c (ctanh, plus_infty, -min_subnorm_value, 1.0, minus_zero), 47 TEST_c_c (ctanh, plus_infty, -0x1p127, 1.0, minus_zero), 48 TEST_c_c (ctanh, plus_infty, -0x1.11p127, 1.0, 0.0), 49#if !TEST_COND_binary32 50 TEST_c_c (ctanh, plus_infty, -0x1p1023, 1.0, 0.0), 51 TEST_c_c (ctanh, plus_infty, -0x1.5p1023, 1.0, minus_zero), 52#endif 53#if MAX_EXP >= 16384 54 TEST_c_c (ctanh, plus_infty, -0x1p16383L, 1.0, minus_zero), 55 TEST_c_c (ctanh, plus_infty, -0x1.2p16383L, 1.0, 0.0), 56#endif 57 TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0), 58 TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0), 59 TEST_c_c (ctanh, minus_infty, 2, -1.0, minus_zero), 60 TEST_c_c (ctanh, minus_infty, 3, -1.0, minus_zero), 61 TEST_c_c (ctanh, minus_infty, 4, -1.0, 0.0), 62 TEST_c_c (ctanh, minus_infty, min_value, -1.0, 0.0), 63 TEST_c_c (ctanh, minus_infty, min_subnorm_value, -1.0, 0.0), 64 TEST_c_c (ctanh, minus_infty, 0x1p127, -1.0, 0.0), 65 TEST_c_c (ctanh, minus_infty, 0x1.11p127, -1.0, minus_zero), 66#if !TEST_COND_binary32 67 TEST_c_c (ctanh, minus_infty, 0x1p1023, -1.0, minus_zero), 68 TEST_c_c (ctanh, minus_infty, 0x1.5p1023, -1.0, 0.0), 69#endif 70#if MAX_EXP >= 16384 71 TEST_c_c (ctanh, minus_infty, 0x1p16383L, -1.0, 0.0), 72 TEST_c_c (ctanh, minus_infty, 0x1.2p16383L, -1.0, minus_zero), 73#endif 74 TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero), 75 TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero), 76 TEST_c_c (ctanh, minus_infty, -2, -1.0, 0.0), 77 TEST_c_c (ctanh, minus_infty, -3, -1.0, 0.0), 78 TEST_c_c (ctanh, minus_infty, -4, -1.0, minus_zero), 79 TEST_c_c (ctanh, minus_infty, -min_value, -1.0, minus_zero), 80 TEST_c_c (ctanh, minus_infty, -min_subnorm_value, -1.0, minus_zero), 81 TEST_c_c (ctanh, minus_infty, -0x1p127, -1.0, minus_zero), 82 TEST_c_c (ctanh, minus_infty, -0x1.11p127, -1.0, 0.0), 83#if !TEST_COND_binary32 84 TEST_c_c (ctanh, minus_infty, -0x1p1023, -1.0, 0.0), 85 TEST_c_c (ctanh, minus_infty, -0x1.5p1023, -1.0, minus_zero), 86#endif 87#if MAX_EXP >= 16384 88 TEST_c_c (ctanh, minus_infty, -0x1p16383L, -1.0, minus_zero), 89 TEST_c_c (ctanh, minus_infty, -0x1.2p16383L, -1.0, 0.0), 90#endif 91 92 TEST_c_c (ctanh, 0, plus_infty, 0, qnan_value, INVALID_EXCEPTION), 93 TEST_c_c (ctanh, 2, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), 94 TEST_c_c (ctanh, 0, minus_infty, 0, qnan_value, INVALID_EXCEPTION), 95 TEST_c_c (ctanh, 2, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), 96 TEST_c_c (ctanh, minus_zero, plus_infty, minus_zero, qnan_value, INVALID_EXCEPTION), 97 TEST_c_c (ctanh, -2, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), 98 TEST_c_c (ctanh, minus_zero, minus_infty, minus_zero, qnan_value, INVALID_EXCEPTION), 99 TEST_c_c (ctanh, -2, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION), 100 101 TEST_c_c (ctanh, plus_infty, qnan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN), 102 TEST_c_c (ctanh, plus_infty, plus_infty, 1.0, 0.0, IGNORE_ZERO_INF_SIGN), 103 TEST_c_c (ctanh, plus_infty, minus_infty, 1.0, 0.0, IGNORE_ZERO_INF_SIGN), 104 TEST_c_c (ctanh, minus_infty, qnan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN), 105 TEST_c_c (ctanh, minus_infty, plus_infty, -1.0, 0.0, IGNORE_ZERO_INF_SIGN), 106 TEST_c_c (ctanh, minus_infty, minus_infty, -1.0, 0.0, IGNORE_ZERO_INF_SIGN), 107 108 TEST_c_c (ctanh, qnan_value, 0, qnan_value, 0.0), 109 TEST_c_c (ctanh, qnan_value, minus_zero, qnan_value, minus_zero), 110 111 TEST_c_c (ctanh, qnan_value, 0.5, qnan_value, qnan_value, INVALID_EXCEPTION_OK), 112 TEST_c_c (ctanh, qnan_value, -4.5, qnan_value, qnan_value, INVALID_EXCEPTION_OK), 113 114 TEST_c_c (ctanh, 0, qnan_value, 0, qnan_value), 115 TEST_c_c (ctanh, 5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK), 116 TEST_c_c (ctanh, minus_zero, qnan_value, minus_zero, qnan_value), 117 TEST_c_c (ctanh, -0.25, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK), 118 119 TEST_c_c (ctanh, qnan_value, qnan_value, qnan_value, qnan_value), 120 121 AUTO_TESTS_c_c (ctanh), 122 }; 123 124static void 125ctanh_test (void) 126{ 127 ALL_RM_TEST (ctanh, 0, ctanh_test_data, RUN_TEST_LOOP_c_c, END_COMPLEX); 128} 129 130static void 131do_test (void) 132{ 133 ctanh_test (); 134} 135 136/* 137 * Local Variables: 138 * mode:c 139 * End: 140 */ 141