Change-Id: If061f1f120573cb109d97fa40806e160603cd593
Reviewed-on: https://go-review.googlesource.com/31871
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
rn := 0.0
d := 0.0
for {
- rn += 1
+ rn++
f *= rn
- rn += 1
+ rn++
f *= rn
x2 *= x
y2 *= y
t /= f
d += t
- rn += 1
+ rn++
f *= rn
- rn += 1
+ rn++
f *= rn
x2 *= x
y2 *= y
}
t := Float64frombits(uint64(0x3ff-k) << 52) // 2**-k
y := x - (e + t)
- y += 1
+ y++
y = Float64frombits(Float64bits(y) + uint64(k)<<52) // add k to y's exponent
return y
}
q1 := w*z - 1
k := 1
for q1 < 1e9 {
- k += 1
+ k++
z += h
q0, q1 = q1, z*q1-q0
}
if iu < 0x0006a09e667f3bcd { // mantissa of Sqrt(2)
u = Float64frombits(iu | 0x3ff0000000000000) // normalize u
} else {
- k += 1
+ k++
u = Float64frombits(iu | 0x3fe0000000000000) // normalize u/2
iu = (0x0010000000000000 - iu) >> 2
}
if f == 0 {
if k == 0 {
return 0
- } else {
- c += float64(k) * Ln2Lo
- return float64(k)*Ln2Hi + c
}
+ c += float64(k) * Ln2Lo
+ return float64(k)*Ln2Hi + c
}
R = hfsq * (1.0 - 0.66666666666666666*f) // avoid division
if k == 0 {
// map zeros to origin
if j&1 == 1 {
- j += 1
- y += 1
+ j++
+ y++
}
j &= 7 // octant modulo 2Pi radians (360 degrees)
if j > 3 {
// map zeros to origin
if j&1 == 1 {
- j += 1
- y += 1
+ j++
+ y++
}
j &= 7 // octant modulo 2Pi radians (360 degrees)
// reflect in x axis
y := float64(j) // integer part of x/(Pi/4), as float
if j&1 == 1 { // map zeros to origin
- j += 1
- y += 1
+ j++
+ y++
}
j &= 7 // octant modulo 2Pi radians (360 degrees)
if j > 3 { // reflect in x axis
/* map zeros and singularities to origin */
if j&1 == 1 {
- j += 1
- y += 1
+ j++
+ y++
}
z := ((x - y*PI4A) - y*PI4B) - y*PI4C