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.
This commit is contained in:
dsl 2014-03-03 08:00:50 +00:00
parent f2f5d9ff51
commit 77e93a9cb9
1 changed files with 2 additions and 1 deletions

View File

@ -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