This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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 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."

This patch has been updated and verified on powerpc32 with todays CVS.


2007-04-03  Steven Munroe  <sjmunroe@us.ibm.com>

	[BZ #3268]
	* math/libm-test.inc (fma_test): New tests.

diff -urN libc25-cvstip-20070320/math/libm-test.inc libc25/math/libm-test.inc
--- libc25-cvstip-20070320/math/libm-test.inc	2007-03-15 15:10:16.000000000 -0500
+++ libc25/math/libm-test.inc	2007-03-30 15:30:26.000000000 -0500
@@ -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);
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]