This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH][BZ #3268] Additional fma tests
- From: Steven Munroe <munroesj at us dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 24 Jan 2007 14:37:28 -0600
- Subject: [PATCH][BZ #3268] Additional fma tests
Previous soft-fp work exposed a general lack of correct Fused Multiply Add (fma) implemetations for platforms that don't implement fma in hardware (soft-fp or hard-fp that doesn't implement fma).
This patch also updates libm-test.inc to actually test for the full percision of fma. IEEE-754r states:
2 Definitions
"fused multiply-add: The operation fma(x,y,z) computes (x ï )+z as if with unbounded range and precision, rounding only once to the destination format; see subclause 5.1. "
5.1 Arithmetic
"The operation fma(x,y,z) computes (xï)+z as if with unbounded range and precision, rounding only once to the destination format. No underflow, overflow, or inexact exception (subclause 7) can arise due to the multiply, but only due to the add; and so fused multiply-add differs from a multiply operation followed by an add operation."
2007-01-17 Steven Munroe <sjmunroe@us.ibm.com>
[BZ #3268]
* math/libm-test.inc (fma_test): New tests.
diff -urN libc25-cvstip-20070123/math/libm-test.inc libc24/math/libm-test.inc
--- libc25-cvstip-20070123/math/libm-test.inc 2006-09-20 14:36:26.000000000 -0500
+++ libc24/math/libm-test.inc 2007-01-23 10:01:53.000000000 -0600
@@ -2766,6 +2766,12 @@
TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
+ TEST_fff_f (fma, 8388609.0L, 8388609.0L, -70368752566272.0L, 8388609.0L);
+
+#ifdef TEST_DOUBLE
+ TEST_fff_f (fma, 0x1.0000000000001p+52, 0x1.0000000000001p+52, -0x1.0000000000001p+104, 0x1.0000000000001p+52);
+#endif
+
END (fma);
}