We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 497d241 commit 47e71f3Copy full SHA for 47e71f3
src/math/pow.go
@@ -83,13 +83,7 @@ func pow(x, y float64) float64 {
83
return 1 / Sqrt(x)
84
}
85
86
- absy := y
87
- flip := false
88
- if absy < 0 {
89
- absy = -absy
90
- flip = true
91
- }
92
- yi, yf := Modf(absy)
+ yi, yf := Modf(Abs(y))
93
if yf != 0 && x < 0 {
94
return NaN()
95
@@ -147,9 +141,9 @@ func pow(x, y float64) float64 {
147
141
148
142
149
143
// ans = a1*2**ae
150
- // if flip { ans = 1 / ans }
144
+ // if y < 0 { ans = 1 / ans }
151
145
// but in the opposite order
152
- if flip {
146
+ if y < 0 {
153
a1 = 1 / a1
154
ae = -ae
155
0 commit comments