mirror of https://github.com/golang/go.git
math: correct Atan2(±y,+∞) = ±0 on s390x
The s390x assembly implementation was previously only handling this case correctly for x = -Pi. Update the special case handling for any y. Fixes #35446 Change-Id: I355575e9ec8c7ce8bd9db10d74f42a22f39a2f38 Reviewed-on: https://go-review.googlesource.com/c/go/+/223420 Run-TryBot: Brian Kessler <brian.m.kessler@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Munday <mike.munday@ibm.com> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
97585092f5
commit
6b6414cab4
|
|
@ -827,6 +827,8 @@ var vfatan2SC = [][2]float64{
|
||||||
{+Pi, Inf(-1)},
|
{+Pi, Inf(-1)},
|
||||||
{+Pi, 0},
|
{+Pi, 0},
|
||||||
{+Pi, Inf(1)},
|
{+Pi, Inf(1)},
|
||||||
|
{1.0, Inf(1)},
|
||||||
|
{-1.0, Inf(1)},
|
||||||
{+Pi, NaN()},
|
{+Pi, NaN()},
|
||||||
{Inf(1), Inf(-1)},
|
{Inf(1), Inf(-1)},
|
||||||
{Inf(1), -Pi},
|
{Inf(1), -Pi},
|
||||||
|
|
@ -864,6 +866,8 @@ var atan2SC = []float64{
|
||||||
Pi, // atan2(+Pi, -Inf)
|
Pi, // atan2(+Pi, -Inf)
|
||||||
Pi / 2, // atan2(+Pi, +0)
|
Pi / 2, // atan2(+Pi, +0)
|
||||||
0, // atan2(+Pi, +Inf)
|
0, // atan2(+Pi, +Inf)
|
||||||
|
0, // atan2(+1, +Inf)
|
||||||
|
Copysign(0, -1), // atan2(-1, +Inf)
|
||||||
NaN(), // atan2(+Pi, NaN)
|
NaN(), // atan2(+Pi, NaN)
|
||||||
3 * Pi / 4, // atan2(+Inf, -Inf)
|
3 * Pi / 4, // atan2(+Inf, -Inf)
|
||||||
Pi / 2, // atan2(+Inf, -Pi)
|
Pi / 2, // atan2(+Inf, -Pi)
|
||||||
|
|
|
||||||
|
|
@ -134,9 +134,9 @@ yIsPosInf:
|
||||||
MOVD $NegInf, R3
|
MOVD $NegInf, R3
|
||||||
CMPUBEQ R3, R1, negInfPosInf
|
CMPUBEQ R3, R1, negInfPosInf
|
||||||
|
|
||||||
//special case Atan2(-Pi, +Inf) = Pi
|
//special case Atan2(x, +Inf) = Copysign(0, x)
|
||||||
MOVD $NegPi, R3
|
CMPBLT R1, $0, returnNegZero
|
||||||
CMPUBEQ R3, R1, negPiPosInf
|
BR returnPosZero
|
||||||
|
|
||||||
Normal:
|
Normal:
|
||||||
FMOVD x+0(FP), F0
|
FMOVD x+0(FP), F0
|
||||||
|
|
@ -288,7 +288,10 @@ negInfPosInf:
|
||||||
MOVD $NegPiDiv4, R1
|
MOVD $NegPiDiv4, R1
|
||||||
MOVD R1, ret+16(FP)
|
MOVD R1, ret+16(FP)
|
||||||
RET
|
RET
|
||||||
negPiPosInf:
|
returnNegZero:
|
||||||
MOVD $NegZero, R1
|
MOVD $NegZero, R1
|
||||||
MOVD R1, ret+16(FP)
|
MOVD R1, ret+16(FP)
|
||||||
RET
|
RET
|
||||||
|
returnPosZero:
|
||||||
|
MOVD $0, ret+16(FP)
|
||||||
|
RET
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue