Lines Matching +full:one +full:- +full:to +full:- +full:one

1 /*-
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 #include "test-utils.h"
45 * exceptions we should check. We need to be lenient for several
47 * to raise FE_OVERFLOW without raising FE_INEXACT.
81 * This is needed because clang constant-folds fma in ways that are incorrect
84 static volatile double one = 1.0; variable
96 testall(-0.0, 0.0, 0.0, rd ? -0.0 : 0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
97 testall(0.0, -0.0, 0.0, rd ? -0.0 : 0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
98 testall(-0.0, -0.0, 0.0, 0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
99 testall(0.0, 0.0, -0.0, rd ? -0.0 : 0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
100 testall(-0.0, -0.0, -0.0, rd ? -0.0 : 0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
102 testall(-0.0, 0.0, -0.0, -0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
103 testall(0.0, -0.0, -0.0, -0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
105 testall(-one, one, one, rd ? -0.0 : 0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
106 testall(one, -one, one, rd ? -0.0 : 0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
107 testall(-one, -one, -one, rd ? -0.0 : 0.0, ALL_STD_EXCEPT, 0); in test_zeroes()
112 test(fmaf, -FLT_MIN, FLT_MIN, 0.0, -0.0, in test_zeroes()
114 test(fma, -DBL_MIN, DBL_MIN, 0.0, -0.0, in test_zeroes()
116 test(fmal, -LDBL_MIN, LDBL_MIN, 0.0, -0.0, in test_zeroes()
124 testall(INFINITY, 1.0, -1.0, INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
125 testall(-1.0, INFINITY, 0.0, -INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
128 testall(1.0, 1.0, -INFINITY, -INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
130 testall(INFINITY, -INFINITY, 1.0, -INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
132 testall(-INFINITY, -INFINITY, INFINITY, INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
135 testall(INFINITY, 0.0, -0.0, NAN, ALL_STD_EXCEPT, FE_INVALID); in test_infinities()
140 testall(INFINITY, INFINITY, -INFINITY, NAN, in test_infinities()
142 testall(-INFINITY, INFINITY, INFINITY, NAN, in test_infinities()
144 testall(INFINITY, -1.0, INFINITY, NAN, in test_infinities()
147 test(fmaf, FLT_MAX, FLT_MAX, -INFINITY, -INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
148 test(fma, DBL_MAX, DBL_MAX, -INFINITY, -INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
149 test(fmal, LDBL_MAX, LDBL_MAX, -INFINITY, -INFINITY, in test_infinities()
151 test(fmaf, FLT_MAX, -FLT_MAX, INFINITY, INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
152 test(fma, DBL_MAX, -DBL_MAX, INFINITY, INFINITY, ALL_STD_EXCEPT, 0); in test_infinities()
153 test(fmal, LDBL_MAX, -LDBL_MAX, INFINITY, INFINITY, in test_infinities()
162 testall(1.0, -1.0, NAN, NAN, ALL_STD_EXCEPT, 0); in test_nans()
177 * Tests for cases where z is very small compared to x*y.
184 test(fmaf, one, one, 0x1.0p-100, 1.0 + FLT_EPSILON, in test_small_z()
186 test(fma, one, one, 0x1.0p-200, 1.0 + DBL_EPSILON, in test_small_z()
188 test(fmal, one, one, 0x1.0p-200, 1.0 + LDBL_EPSILON, in test_small_z()
191 testall(0x1.0p100, one, 0x1.0p-100, 0x1.0p100, in test_small_z()
197 test(fmaf, -one, one, -0x1.0p-100, -(1.0 + FLT_EPSILON), in test_small_z()
199 test(fma, -one, one, -0x1.0p-200, -(1.0 + DBL_EPSILON), in test_small_z()
201 test(fmal, -one, one, -0x1.0p-200, -(1.0 + LDBL_EPSILON), in test_small_z()
204 testall(0x1.0p100, -one, -0x1.0p-100, -0x1.0p100, in test_small_z()
210 test(fmaf, one, one, -0x1.0p-100, 1.0 - FLT_EPSILON / 2, in test_small_z()
212 test(fma, one, one, -0x1.0p-200, 1.0 - DBL_EPSILON / 2, in test_small_z()
214 test(fmal, one, one, -0x1.0p-200, 1.0 - LDBL_EPSILON / 2, in test_small_z()
217 testall(0x1.0p100, one, -0x1.0p-100, 0x1.0p100, in test_small_z()
223 test(fmaf, -one, one, 0x1.0p-100, -1.0 + FLT_EPSILON / 2, in test_small_z()
225 test(fma, -one, one, 0x1.0p-200, -1.0 + DBL_EPSILON / 2, in test_small_z()
227 test(fmal, -one, one, 0x1.0p-200, -1.0 + LDBL_EPSILON / 2, in test_small_z()
230 testall(-0x1.0p100, one, 0x1.0p-100, -0x1.0p100, in test_small_z()
236 * Tests for cases where z is very large compared to x*y.
243 test(fmaf, 0x1.0p-50, 0x1.0p-50, 1.0, 1.0 + FLT_EPSILON, in test_big_z()
245 test(fma, 0x1.0p-100, 0x1.0p-100, 1.0, 1.0 + DBL_EPSILON, in test_big_z()
247 test(fmal, 0x1.0p-100, 0x1.0p-100, 1.0, 1.0 + LDBL_EPSILON, in test_big_z()
250 testall(-0x1.0p-50, -0x1.0p-50, 0x1.0p100, 0x1.0p100, in test_big_z()
256 test(fmaf, -0x1.0p-50, 0x1.0p-50, -1.0, -(1.0 + FLT_EPSILON), in test_big_z()
258 test(fma, -0x1.0p-100, 0x1.0p-100, -1.0, -(1.0 + DBL_EPSILON), in test_big_z()
260 test(fmal, -0x1.0p-100, 0x1.0p-100, -1.0, -(1.0 + LDBL_EPSILON), in test_big_z()
263 testall(0x1.0p-50, -0x1.0p-50, -0x1.0p100, -0x1.0p100, in test_big_z()
269 test(fmaf, -0x1.0p-50, -0x1.0p-50, -1.0, in test_big_z()
270 -1.0 + FLT_EPSILON / 2, ALL_STD_EXCEPT, FE_INEXACT); in test_big_z()
271 test(fma, -0x1.0p-100, -0x1.0p-100, -1.0, in test_big_z()
272 -1.0 + DBL_EPSILON / 2, ALL_STD_EXCEPT, FE_INEXACT); in test_big_z()
273 test(fmal, -0x1.0p-100, -0x1.0p-100, -1.0, in test_big_z()
274 -1.0 + LDBL_EPSILON / 2, ALL_STD_EXCEPT, FE_INEXACT); in test_big_z()
276 testall(0x1.0p-50, 0x1.0p-50, -0x1.0p100, -0x1.0p100, in test_big_z()
282 test(fmaf, 0x1.0p-50, -0x1.0p-50, 1.0, 1.0 - FLT_EPSILON / 2, in test_big_z()
284 test(fma, 0x1.0p-100, -0x1.0p-100, 1.0, 1.0 - DBL_EPSILON / 2, in test_big_z()
286 test(fmal, 0x1.0p-100, -0x1.0p-100, 1.0, 1.0 - LDBL_EPSILON / 2, in test_big_z()
289 testall(-0x1.0p-50, 0x1.0p-50, 0x1.0p100, 0x1.0p100, in test_big_z()
298 /* ilogb(x*y) - ilogb(z) = 20 */ in test_accuracy()
299 testrnd(fmaf, -0x1.c139d8p-51, -0x1.600e7ap32, 0x1.26558cp-38, in test_accuracy()
300 0x1.34e48ap-18, 0x1.34e48cp-18, 0x1.34e48ap-18, 0x1.34e48ap-18, in test_accuracy()
302 testrnd(fma, -0x1.c139d7b84f1a3p-51, -0x1.600e7a2a16484p32, in test_accuracy()
303 0x1.26558cac31580p-38, 0x1.34e48a78aae97p-18, in test_accuracy()
304 0x1.34e48a78aae97p-18, 0x1.34e48a78aae96p-18, in test_accuracy()
305 0x1.34e48a78aae96p-18, ALL_STD_EXCEPT, FE_INEXACT); in test_accuracy()
307 testrnd(fmal, -0x1.c139d7b84f1a3079263afcc5bae3p-51L, in test_accuracy()
308 -0x1.600e7a2a164840edbe2e7d301a72p32L, in test_accuracy()
309 0x1.26558cac315807eb07e448042101p-38L, in test_accuracy()
310 0x1.34e48a78aae96c76ed36077dd387p-18L, in test_accuracy()
311 0x1.34e48a78aae96c76ed36077dd388p-18L, in test_accuracy()
312 0x1.34e48a78aae96c76ed36077dd387p-18L, in test_accuracy()
313 0x1.34e48a78aae96c76ed36077dd387p-18L, in test_accuracy()
316 testrnd(fmal, -0x1.c139d7b84f1a307ap-51L, -0x1.600e7a2a164840eep32L, in test_accuracy()
317 0x1.26558cac315807ecp-38L, 0x1.34e48a78aae96c78p-18L, in test_accuracy()
318 0x1.34e48a78aae96c78p-18L, 0x1.34e48a78aae96c76p-18L, in test_accuracy()
319 0x1.34e48a78aae96c76p-18L, ALL_STD_EXCEPT, FE_INEXACT); in test_accuracy()
321 testrnd(fmal, -0x1.c139d7b84f1a3p-51L, -0x1.600e7a2a16484p32L, in test_accuracy()
322 0x1.26558cac31580p-38L, 0x1.34e48a78aae97p-18L, in test_accuracy()
323 0x1.34e48a78aae97p-18L, 0x1.34e48a78aae96p-18L, in test_accuracy()
324 0x1.34e48a78aae96p-18L, ALL_STD_EXCEPT, FE_INEXACT); in test_accuracy()
327 /* ilogb(x*y) - ilogb(z) = -40 */ in test_accuracy()
328 testrnd(fmaf, 0x1.98210ap53, 0x1.9556acp-24, 0x1.d87da4p70, in test_accuracy()
331 testrnd(fma, 0x1.98210ac83fe2bp53, 0x1.9556ac1475f0fp-24, in test_accuracy()
337 0x1.9556ac1475f0f28968b61d0de65ap-24L, in test_accuracy()
345 testrnd(fmal, 0x1.98210ac83fe2a8f6p53L, 0x1.9556ac1475f0f28ap-24L, in test_accuracy()
350 testrnd(fmal, 0x1.98210ac83fe2bp53L, 0x1.9556ac1475f0fp-24L, in test_accuracy()
356 /* ilogb(x*y) - ilogb(z) = 0 */ in test_accuracy()
357 testrnd(fmaf, 0x1.31ad02p+100, 0x1.2fbf7ap-42, -0x1.c3e106p+58, in test_accuracy()
358 -0x1.64c27cp+56, -0x1.64c27ap+56, -0x1.64c27cp+56, in test_accuracy()
359 -0x1.64c27ap+56, ALL_STD_EXCEPT, FE_INEXACT); in test_accuracy()
360 testrnd(fma, 0x1.31ad012ede8aap+100, 0x1.2fbf79c839067p-42, in test_accuracy()
361 -0x1.c3e106929056ep+58, -0x1.64c282b970a5fp+56, in test_accuracy()
362 -0x1.64c282b970a5ep+56, -0x1.64c282b970a5fp+56, in test_accuracy()
363 -0x1.64c282b970a5ep+56, ALL_STD_EXCEPT, FE_INEXACT); in test_accuracy()
366 0x1.2fbf79c839066f0f5c68f6d2e814p-42L, in test_accuracy()
367 -0x1.c3e106929056ec19de72bfe64215p+58L, in test_accuracy()
368 -0x1.64c282b970a612598fc025ca8cddp+56L, in test_accuracy()
369 -0x1.64c282b970a612598fc025ca8cddp+56L, in test_accuracy()
370 -0x1.64c282b970a612598fc025ca8cdep+56L, in test_accuracy()
371 -0x1.64c282b970a612598fc025ca8cddp+56L, in test_accuracy()
374 testrnd(fmal, 0x1.31ad012ede8aa4eap+100L, 0x1.2fbf79c839066aeap-42L, in test_accuracy()
375 -0x1.c3e106929056e61p+58L, -0x1.64c282b970a60298p+56L, in test_accuracy()
376 -0x1.64c282b970a60298p+56L, -0x1.64c282b970a6029ap+56L, in test_accuracy()
377 -0x1.64c282b970a60298p+56L, ALL_STD_EXCEPT, FE_INEXACT); in test_accuracy()
379 testrnd(fmal, 0x1.31ad012ede8aap+100L, 0x1.2fbf79c839067p-42L, in test_accuracy()
380 -0x1.c3e106929056ep+58L, -0x1.64c282b970a5fp+56L, in test_accuracy()
381 -0x1.64c282b970a5ep+56L, -0x1.64c282b970a5fp+56L, in test_accuracy()
382 -0x1.64c282b970a5ep+56L, ALL_STD_EXCEPT, FE_INEXACT); in test_accuracy()
385 /* x*y (rounded) ~= -z */ in test_accuracy()
387 testrnd(fmaf, 0x1.bbffeep-30, -0x1.1d164cp-74, 0x1.ee7296p-104, in test_accuracy()
388 -0x1.c46ea8p-128, -0x1.c46ea8p-128, -0x1.c46ea8p-128, in test_accuracy()
389 -0x1.c46ea8p-128, ALL_STD_EXCEPT & ~FE_INEXACT, 0); in test_accuracy()
390 testrnd(fma, 0x1.bbffeea6fc7d6p-30, 0x1.1d164c6cbf078p-74, in test_accuracy()
391 -0x1.ee72993aff948p-104, -0x1.71f72ac7d9d8p-159, in test_accuracy()
392 -0x1.71f72ac7d9d8p-159, -0x1.71f72ac7d9d8p-159, in test_accuracy()
393 -0x1.71f72ac7d9d8p-159, ALL_STD_EXCEPT & ~FE_INEXACT, 0); in test_accuracy()
395 testrnd(fmal, 0x1.bbffeea6fc7d65927d147f437675p-30L, in test_accuracy()
396 0x1.1d164c6cbf078b7a22607d1cd6a2p-74L, in test_accuracy()
397 -0x1.ee72993aff94973876031bec0944p-104L, in test_accuracy()
398 0x1.64e086175b3a2adc36e607058814p-217L, in test_accuracy()
399 0x1.64e086175b3a2adc36e607058814p-217L, in test_accuracy()
400 0x1.64e086175b3a2adc36e607058814p-217L, in test_accuracy()
401 0x1.64e086175b3a2adc36e607058814p-217L, in test_accuracy()
404 testrnd(fmal, 0x1.bbffeea6fc7d6592p-30L, 0x1.1d164c6cbf078b7ap-74L, in test_accuracy()
405 -0x1.ee72993aff949736p-104L, 0x1.af190e7a1ee6ad94p-168L, in test_accuracy()
406 0x1.af190e7a1ee6ad94p-168L, 0x1.af190e7a1ee6ad94p-168L, in test_accuracy()
407 0x1.af190e7a1ee6ad94p-168L, ALL_STD_EXCEPT & ~FE_INEXACT, 0); in test_accuracy()
409 testrnd(fmal, 0x1.bbffeea6fc7d6p-30L, 0x1.1d164c6cbf078p-74L, in test_accuracy()
410 -0x1.ee72993aff948p-104L, -0x1.71f72ac7d9d8p-159L, in test_accuracy()
411 -0x1.71f72ac7d9d8p-159L, -0x1.71f72ac7d9d8p-159L, in test_accuracy()
412 -0x1.71f72ac7d9d8p-159L, ALL_STD_EXCEPT & ~FE_INEXACT, 0); in test_accuracy()
423 * c = -0x0.0000000000000000000000000080...1p+1 in test_double_rounding()
426 * The correct behavior is to round DOWN to 0x1.2000000000001p+1 in in test_double_rounding()
427 * round-to-nearest mode. An implementation that computes a*b+c in in test_double_rounding()
433 -0x1.0000000000001p-104, 0x1.2000000000001p+1, in test_double_rounding()
437 -0x1.0000000000001p-104, 0x1.2000000000001p+1, in test_double_rounding()
441 -0x1.0000000000001p-104, 0x1.2000000000002p+1, in test_double_rounding()
445 test(fmaf, 0x1.800002p+0, 0x1.800002p+0, -0x1.000002p-46, 0x1.200002p+1, in test_double_rounding()
448 test(fmaf, 0x1.800002p+0, 0x1.800002p+0, -0x1.000002p-46, 0x1.200002p+1, in test_double_rounding()
451 test(fmaf, 0x1.800002p+0, 0x1.800002p+0, -0x1.000002p-46, 0x1.200004p+1, in test_double_rounding()
456 test(fmal, 0x1.4p+0L, 0x1.0000000000000004p+0L, 0x1p-128L, in test_double_rounding()
461 -0x1.0000000000000000000000000001p-224L, in test_double_rounding()
543 * - Tests for subnormals in ATF_TP_ADD_TCS()
544 * - Cancellation tests (e.g., z = (double)x*y, but x*y is inexact) in ATF_TP_ADD_TCS()