| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "test_math.h" | ||
| 2 | |||
| 3 | #include "gate/tests.h" | ||
| 4 | #include "gate/mathematics.h" | ||
| 5 | |||
| 6 | #include <math.h> | ||
| 7 | |||
| 8 | |||
| 9 | #if !defined(NAN) || !defined(INFINITY) | ||
| 10 | static gate_real32_t zero_float = 0.0f; | ||
| 11 | static gate_real64_t zero_double = 0.0; | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #if defined(NAN) | ||
| 15 | 1 | static gate_real32_t create_float_nan() { return NAN; } | |
| 16 | 1 | static gate_real64_t create_double_nan() { return NAN; } | |
| 17 | #else | ||
| 18 | static gate_real32_t create_float_nan() { return zero_float / zero_float; } | ||
| 19 | static gate_real64_t create_double_nan() { return zero_double / zero_double; } | ||
| 20 | #endif | ||
| 21 | |||
| 22 | #if defined(INFINITY) | ||
| 23 | 1 | static gate_real32_t create_float_inf() { return INFINITY; } | |
| 24 | 1 | static gate_real64_t create_double_inf() { return INFINITY; } | |
| 25 | #else | ||
| 26 | static gate_real32_t create_float_inf() { return 1.0f / zero_float; } | ||
| 27 | static gate_real64_t create_double_inf() { return 1.0 / zero_double; } | ||
| 28 | #endif | ||
| 29 | |||
| 30 | typedef struct | ||
| 31 | { | ||
| 32 | gate_real64_t parameter; | ||
| 33 | gate_real64_t expected; | ||
| 34 | } math_value_table_t; | ||
| 35 | |||
| 36 | 20 | static gate_bool_t test_math_table(gate_real64_t(*func)(gate_real64_t), math_value_table_t const* table, gate_size_t table_count) | |
| 37 | { | ||
| 38 | gate_size_t ndx; | ||
| 39 | gate_real64_t result; | ||
| 40 | gate_bool_t test_succeeded; | ||
| 41 | 20 | gate_bool_t succeeded = true; | |
| 42 |
2/2✓ Branch 0 taken 99 times.
✓ Branch 1 taken 20 times.
|
119 | for (ndx = 0; ndx != table_count; ++ndx) |
| 43 | { | ||
| 44 | 99 | result = func(table[ndx].parameter); | |
| 45 | 99 | test_succeeded = true; | |
| 46 | 99 | test_succeeded &= (result > table[ndx].expected - 0.0001); | |
| 47 | 99 | test_succeeded &= (result < table[ndx].expected + 0.0001); | |
| 48 |
1/2✓ Branch 0 taken 99 times.
✗ Branch 1 not taken.
|
99 | GATE_TEST_TRACE_MESSAGE(test_succeeded ? "test_math_table SUCCEEDED" : "test_math_table FAILED"); |
| 49 | 99 | succeeded &= test_succeeded; | |
| 50 | } | ||
| 51 | 20 | return succeeded; | |
| 52 | } | ||
| 53 | |||
| 54 | static math_value_table_t sin_table[] = | ||
| 55 | { | ||
| 56 | { 0.0, 0.0 }, | ||
| 57 | { 1.0, 0.84147098 }, | ||
| 58 | { 2.0, 0.90929742 }, | ||
| 59 | { 3.0, 0.14112000 }, | ||
| 60 | { -1.0, -0.84147098 }, | ||
| 61 | { -2.0, -0.90929742 }, | ||
| 62 | { -3.0, -0.14112000 } | ||
| 63 | }; | ||
| 64 | |||
| 65 | static math_value_table_t cos_table[] = | ||
| 66 | { | ||
| 67 | { 0.0, 1.0 }, | ||
| 68 | { 1.0, 0.54030230 }, | ||
| 69 | { 2.0, -0.41614683 }, | ||
| 70 | { 3.0, -0.98999249 }, | ||
| 71 | { -1.0, 0.54030230 }, | ||
| 72 | { -2.0, -0.41614683 }, | ||
| 73 | { -3.0, -0.98999249 } | ||
| 74 | }; | ||
| 75 | |||
| 76 | static math_value_table_t tan_table[] = | ||
| 77 | { | ||
| 78 | { 0.0, 0.0 }, | ||
| 79 | { 1.0, 1.5574077246549 }, | ||
| 80 | { 2.0, -2.1850398632615 }, | ||
| 81 | { 3.0, -0.1425465431 }, | ||
| 82 | { 4.0, 1.15782128235 }, | ||
| 83 | }; | ||
| 84 | |||
| 85 | static math_value_table_t asin_table[] = | ||
| 86 | { | ||
| 87 | { 0.0, 0.0 }, | ||
| 88 | { 0.3, 0.304692654 }, | ||
| 89 | { 0.6, 0.643501109 }, | ||
| 90 | { 0.9, 1.119769515 }, | ||
| 91 | { 0.95, 1.2532358975 }, | ||
| 92 | { 0.96, 1.2870022176 }, | ||
| 93 | { 1.0, 1.570796326794 } | ||
| 94 | }; | ||
| 95 | |||
| 96 | static math_value_table_t acos_table[] = | ||
| 97 | { | ||
| 98 | { 0.0, 1.5707963268 }, | ||
| 99 | { 0.3, 1.26610367278 }, | ||
| 100 | { 0.6, 0.927295218 }, | ||
| 101 | { 1.0, 0.0 } | ||
| 102 | }; | ||
| 103 | |||
| 104 | static math_value_table_t atan_table[] = | ||
| 105 | { | ||
| 106 | { 0.0, 0.0 }, | ||
| 107 | { 0.1, 0.09966865249 }, | ||
| 108 | { 0.5, 0.463647609 }, | ||
| 109 | { 0.9, 0.73281510179 }, | ||
| 110 | { 0.98, 0.7752974968 }, | ||
| 111 | { 1.0, 0.785398163397 }, | ||
| 112 | { 2.0, 1.107148717794 }, | ||
| 113 | { 3.0, 1.249045772398 } | ||
| 114 | }; | ||
| 115 | |||
| 116 | static math_value_table_t sinh_table[] = | ||
| 117 | { | ||
| 118 | { 0.0, 0.0 }, | ||
| 119 | { 1.0, 1.1752011936438 }, | ||
| 120 | { 2.0, 3.626860407847 }, | ||
| 121 | { 3.0, 10.0178749274 } | ||
| 122 | }; | ||
| 123 | |||
| 124 | static math_value_table_t cosh_table[] = | ||
| 125 | { | ||
| 126 | { 0.0, 1.0 }, | ||
| 127 | { 1.0, 1.5430806348 }, | ||
| 128 | { 2.0, 3.762195691 }, | ||
| 129 | { 3.0, 10.0676619958 } | ||
| 130 | }; | ||
| 131 | |||
| 132 | static math_value_table_t tanh_table[] = | ||
| 133 | { | ||
| 134 | { 0.0, 0.0 }, | ||
| 135 | { 1.0, 0.761594155956 }, | ||
| 136 | { 2.0, 0.96402758 }, | ||
| 137 | { 3.0, 0.995054753687 }, | ||
| 138 | }; | ||
| 139 | |||
| 140 | static math_value_table_t asinh_table[] = | ||
| 141 | { | ||
| 142 | { 0.0, 0.0 }, | ||
| 143 | { 1.0, 0.881373587 }, | ||
| 144 | { 2.0, 1.443635475 }, | ||
| 145 | { 3.0, 1.818446459 } | ||
| 146 | }; | ||
| 147 | |||
| 148 | static math_value_table_t acosh_table[] = | ||
| 149 | { | ||
| 150 | { 1.0, 0.0 }, | ||
| 151 | { 2.0, 1.3169578969 }, | ||
| 152 | { 3.0, 1.762747174039 } | ||
| 153 | }; | ||
| 154 | |||
| 155 | static math_value_table_t atanh_table[] = | ||
| 156 | { | ||
| 157 | { 0.0, 0.0 }, | ||
| 158 | { 0.5, 0.549306144334 }, | ||
| 159 | { 0.9, 1.472219489583 }, | ||
| 160 | { 0.1, 0.100335347731 } | ||
| 161 | }; | ||
| 162 | |||
| 163 | static math_value_table_t exp_table[] = | ||
| 164 | { | ||
| 165 | { 0.0, 1.0 }, | ||
| 166 | { 1.0, GATE_MATH_CONST_E }, | ||
| 167 | { 5.0, 148.4131591 }, | ||
| 168 | { 12.0, 162754.791419 }, | ||
| 169 | { 24.0, 26489122129.843472 } | ||
| 170 | }; | ||
| 171 | |||
| 172 | static math_value_table_t log_table[] = | ||
| 173 | { | ||
| 174 | { 1.0, 0.0 }, | ||
| 175 | { 10.0, 2.302585092994 }, | ||
| 176 | { 20000.0, 9.903487552536 }, | ||
| 177 | { 4000000.0, 15.2018049191 } | ||
| 178 | }; | ||
| 179 | |||
| 180 | static math_value_table_t log10_table[] = | ||
| 181 | { | ||
| 182 | { 1.0, 0.0 }, | ||
| 183 | { 2.0, 0.30103 }, | ||
| 184 | { 22.0, 1.342422681 }, | ||
| 185 | { 2222.0, 3.3467440546 } | ||
| 186 | }; | ||
| 187 | |||
| 188 | static math_value_table_t sqrt_table[] = | ||
| 189 | { | ||
| 190 | { 4.0, 2.0 }, | ||
| 191 | { 25.0, 5.0 }, | ||
| 192 | { 10.0, 3.162277 }, | ||
| 193 | { 40.0, 6.324555 }, | ||
| 194 | { 32767.0, 181.016573 } | ||
| 195 | }; | ||
| 196 | |||
| 197 | static math_value_table_t ceil_table[] = | ||
| 198 | { | ||
| 199 | { 0.0, 0.0 }, | ||
| 200 | { 42.0, 42.0 }, | ||
| 201 | { 42.1, 43.0 }, | ||
| 202 | { -42.0, -42.0 }, | ||
| 203 | { -42.1, -42.0 } | ||
| 204 | }; | ||
| 205 | |||
| 206 | static math_value_table_t floor_table[] = | ||
| 207 | { | ||
| 208 | { 0.0, 0.0 }, | ||
| 209 | { 42.0, 42.0 }, | ||
| 210 | { 42.1, 42.0 }, | ||
| 211 | { -42.0, -42.0 }, | ||
| 212 | { -42.1, -43.0 } | ||
| 213 | }; | ||
| 214 | |||
| 215 | static math_value_table_t deg2rad_table[] = | ||
| 216 | { | ||
| 217 | { 0.0, 0.0 }, | ||
| 218 | { 90.0, GATE_MATH_CONST_PI / 2.0 }, | ||
| 219 | { 180.0, GATE_MATH_CONST_PI }, | ||
| 220 | { 270.0, GATE_MATH_CONST_PI * 1.5 }, | ||
| 221 | { 360.0, GATE_MATH_CONST_PI * 2.0 } | ||
| 222 | }; | ||
| 223 | |||
| 224 | static math_value_table_t rad2deg_table[] = | ||
| 225 | { | ||
| 226 | { 0.0, 0.0 }, | ||
| 227 | { GATE_MATH_CONST_PI / 2.0, 90.0 }, | ||
| 228 | { GATE_MATH_CONST_PI, 180.0 }, | ||
| 229 | { -GATE_MATH_CONST_PI / 2.0, -90.0 }, | ||
| 230 | { -GATE_MATH_CONST_PI, -180.0 } | ||
| 231 | }; | ||
| 232 | |||
| 233 | |||
| 234 | 1 | GATE_TEST_FUNCTION(test_math) | |
| 235 | { | ||
| 236 | 1 | GATE_TEST_UNIT_BEGIN(test_math); | |
| 237 | |||
| 238 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_iszero(0.0), true); |
| 239 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_iszero(0.1), false); |
| 240 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_iszero(-0.1), false); |
| 241 | |||
| 242 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_iszero(0.0f), true); |
| 243 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_iszero(0.1f), false); |
| 244 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_iszero(-0.1f), false); |
| 245 | |||
| 246 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_isnan(1.0), false); |
| 247 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_isnan(create_double_nan()), true); |
| 248 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_isnanf(1.0f), false); |
| 249 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_isnanf(create_float_nan()), true); |
| 250 | |||
| 251 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_isinfinite(1.0), false); |
| 252 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_isinfinite(create_double_inf()), true); |
| 253 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_isinfinitef(1.0f), false); |
| 254 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_isinfinitef(create_float_inf()), true); |
| 255 | |||
| 256 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i8(0) == 0); |
| 257 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i8(1) > 0); |
| 258 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i8(-1) < 0); |
| 259 | |||
| 260 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i16(0) == 0); |
| 261 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i16(1) > 0); |
| 262 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i16(-1) < 0); |
| 263 | |||
| 264 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i32(0) == 0); |
| 265 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i32(1) > 0); |
| 266 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i32(-1) < 0); |
| 267 | |||
| 268 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i64(0) == 0); |
| 269 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i64(1) > 0); |
| 270 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_i64(-1) < 0); |
| 271 | |||
| 272 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_r32(0.0f) == 0); |
| 273 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_r32(1.0f) > 0); |
| 274 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_r32(-1.0f) < 0); |
| 275 | |||
| 276 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_r64(0.0) == 0); |
| 277 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_r64(1.0) > 0); |
| 278 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_signum_r64(-1.0) < 0); |
| 279 | |||
| 280 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i8(0) == 0); |
| 281 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i8(42) == 42); |
| 282 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i8(-42) == 42); |
| 283 | |||
| 284 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i16(0) == 0); |
| 285 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i16(42) == 42); |
| 286 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i16(-42) == 42); |
| 287 | |||
| 288 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i32(0) == 0); |
| 289 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i32(42) == 42); |
| 290 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i32(-42) == 42); |
| 291 | |||
| 292 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i64(0) == 0); |
| 293 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i64(42) == 42); |
| 294 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(gate_math_abs_i64(-42) == 42); |
| 295 | |||
| 296 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszero(gate_math_abs_r32(0.0f))); |
| 297 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszero(gate_math_abs_r32(42.0f) - 42.0f)); |
| 298 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszero(gate_math_abs_r32(-42.0f) - 42.0f)); |
| 299 | |||
| 300 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszero(gate_math_abs_r32(0.0))); |
| 301 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszero(gate_math_abs_r32(42.0) - 42.0)); |
| 302 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszero(gate_math_abs_r32(-42.0) - 42.0)); |
| 303 | |||
| 304 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_min_i16(3, (gate_int16_t)2, (gate_int16_t)1, (gate_int16_t)3), 1); |
| 305 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_min_i32(3, (gate_int32_t)2, (gate_int32_t)1, (gate_int32_t)3), 1); |
| 306 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_min_i64(3, (gate_int64_t)2, (gate_int64_t)1, (gate_int64_t)3), 1); |
| 307 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszerof(gate_math_min_r32(3, 2.0f, 1.0f, 3.0f) - 1.0f)); |
| 308 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszero(gate_math_min_r64(3, 2.0, 1.0, 3.0) - 1.0)); |
| 309 | |||
| 310 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_max_i16(3, (gate_int16_t)2, (gate_int16_t)1, (gate_int16_t)3), 3); |
| 311 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_max_i32(3, (gate_int32_t)2, (gate_int32_t)1, (gate_int32_t)3), 3); |
| 312 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_max_i64(3, (gate_int64_t)2, (gate_int64_t)1, (gate_int64_t)3), 3); |
| 313 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszerof(gate_math_max_r32(3, 2.0f, 1.0f, 3.0f) - 3.0f)); |
| 314 |
1/2✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | GATE_TEST_CHECK(gate_math_iszero(gate_math_max_r64(3, 2.0, 1.0, 3.0) - 3.0)); |
| 315 | |||
| 316 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK_EQUAL(gate_math_decimal_length(0.12345), 5); |
| 317 | |||
| 318 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_sin, sin_table, sizeof(sin_table) / sizeof(sin_table[0]))); |
| 319 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_cos, cos_table, sizeof(cos_table) / sizeof(cos_table[0]))); |
| 320 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_tan, tan_table, sizeof(tan_table) / sizeof(tan_table[0]))); |
| 321 | |||
| 322 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_asin, asin_table, sizeof(asin_table) / sizeof(asin_table[0]))); |
| 323 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_acos, acos_table, sizeof(acos_table) / sizeof(acos_table[0]))); |
| 324 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_atan, atan_table, sizeof(atan_table) / sizeof(atan_table[0]))); |
| 325 | |||
| 326 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_sinh, sinh_table, sizeof(sinh_table) / sizeof(sinh_table[0]))); |
| 327 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_cosh, cosh_table, sizeof(cosh_table) / sizeof(cosh_table[0]))); |
| 328 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_tanh, tanh_table, sizeof(tanh_table) / sizeof(tanh_table[0]))); |
| 329 | |||
| 330 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_asinh, asinh_table, sizeof(asinh_table) / sizeof(asinh_table[0]))); |
| 331 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_acosh, acosh_table, sizeof(acosh_table) / sizeof(acosh_table[0]))); |
| 332 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_atanh, atanh_table, sizeof(atanh_table) / sizeof(atanh_table[0]))); |
| 333 | |||
| 334 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_exp, exp_table, sizeof(exp_table) / sizeof(exp_table[0]))); |
| 335 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_log, log_table, sizeof(log_table) / sizeof(log_table[0]))); |
| 336 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_log10, log10_table, sizeof(log10_table) / sizeof(log10_table[0]))); |
| 337 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_sqrt, sqrt_table, sizeof(sqrt_table) / sizeof(sqrt_table[0]))); |
| 338 | |||
| 339 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_ceil, ceil_table, sizeof(ceil_table) / sizeof(ceil_table[0]))); |
| 340 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_floor, floor_table, sizeof(floor_table) / sizeof(floor_table[0]))); |
| 341 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_deg2rad, deg2rad_table, sizeof(deg2rad_table) / sizeof(deg2rad_table[0]))); |
| 342 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | GATE_TEST_CHECK(test_math_table(&gate_math_rad2deg, rad2deg_table, sizeof(rad2deg_table) / sizeof(rad2deg_table[0]))); |
| 343 | |||
| 344 | 1 | GATE_TEST_UNIT_END; | |
| 345 | |||
| 346 | //GATE_CORE_API gate_real64_t gate_math_atan2(gate_real64_t y, gate_real64_t x); | ||
| 347 | //GATE_CORE_API gate_real64_t gate_math_frexp(gate_real64_t value, int* exp); | ||
| 348 | //GATE_CORE_API gate_real64_t gate_math_ldexp(gate_real64_t value, int exp); | ||
| 349 | //GATE_CORE_API gate_real64_t gate_math_modf(gate_real64_t value, gate_real64_t* intpart); | ||
| 350 | |||
| 351 | //GATE_CORE_API gate_int64_t gate_math_pow_i64(gate_int64_t base, gate_uint16_t exp); | ||
| 352 | //GATE_CORE_API gate_real64_t gate_math_pow_iexp(gate_real64_t base, gate_uint16_t exp); | ||
| 353 | //GATE_CORE_API gate_real64_t gate_math_pow(gate_real64_t base, gate_real64_t exp); | ||
| 354 | } | ||
| 355 | |||
| 356 |