Module Name:    src
Committed By:   dsl
Date:           Mon Mar  3 08:00:50 UTC 2014

Modified Files:
        src/lib/libm/arch/i387: e_acos.S

Log Message:
Drop in a fabs() after the fsqrt().
While it may seem pointless, it the rouding mode is set to round towards
minus infinity then acos(-1) calculates atan2(sqrt(1.0 - 1.0), -1) the subtract
generates -0.0 which sqrt() preserves.
atan2(-0, -1) is -pi, but acos(-1) is expected to be +pi.
This might 'fix' the test failures seen in some environments, but they
are not failing due to an obvously incorrent x87 rounding mode.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libm/arch/i387/e_acos.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libm/arch/i387/e_acos.S
diff -u src/lib/libm/arch/i387/e_acos.S:1.8 src/lib/libm/arch/i387/e_acos.S:1.9
--- src/lib/libm/arch/i387/e_acos.S:1.8	Sat Jul 26 19:24:57 2003
+++ src/lib/libm/arch/i387/e_acos.S	Mon Mar  3 08:00:50 2014
@@ -7,7 +7,7 @@
 
 #include "abi.h"
 
-RCSID("$NetBSD: e_acos.S,v 1.8 2003/07/26 19:24:57 salo Exp $")
+RCSID("$NetBSD: e_acos.S,v 1.9 2014/03/03 08:00:50 dsl Exp $")
 
 /* acos = atan (sqrt(1 - x^2) / x) */
 ENTRY(__ieee754_acos)
@@ -18,6 +18,7 @@ ENTRY(__ieee754_acos)
 	fld1
 	fsubp				/* 1 - x^2 */
 	fsqrt				/* sqrt (1 - x^2) */
+	fabs				/* Change -0.0 to +0.0 */
 	fxch	%st(1)
 	fpatan
 	XMM_DOUBLE_EPILOGUE

Reply via email to