name old time/op new time/op delta
PowInt 55.7ns ± 1% 53.4ns ± 2% -4.15% (p=0.000 n=9+9)
PowFrac 133ns ± 1% 133ns ± 2% ~ (p=0.587 n=8+9)
Change-Id: Ica0f4c2cbd554f2195c6d1762ed26742ff8e3924
Reviewed-on: https://go-review.googlesource.com/c/85375
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
return 1 / Sqrt(x)
}
- absy := y
- flip := false
- if absy < 0 {
- absy = -absy
- flip = true
- }
- yi, yf := Modf(absy)
+ yi, yf := Modf(Abs(y))
if yf != 0 && x < 0 {
return NaN()
}
}
// ans = a1*2**ae
- // if flip { ans = 1 / ans }
+ // if y < 0 { ans = 1 / ans }
// but in the opposite order
- if flip {
+ if y < 0 {
a1 = 1 / a1
ae = -ae
}