]> Cypherpunks repositories - gostls13.git/commitdiff
math,math/cmplx: fix linter issues
authorAlexander Döring <email@alexd.ch>
Mon, 24 Oct 2016 20:40:31 +0000 (22:40 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 24 Oct 2016 23:25:46 +0000 (23:25 +0000)
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>

src/math/cmplx/tan.go
src/math/expm1.go
src/math/jn.go
src/math/log1p.go
src/math/sin.go
src/math/sincos.go
src/math/tan.go

index 9485315d8d00dd45abbae5fc9ef4c4b9fe6e1154..03c351ad67b44cbf7ae1824b528da90254717ca8 100644 (file)
@@ -120,9 +120,9 @@ func tanSeries(z complex128) float64 {
        rn := 0.0
        d := 0.0
        for {
-               rn += 1
+               rn++
                f *= rn
-               rn += 1
+               rn++
                f *= rn
                x2 *= x
                y2 *= y
@@ -130,9 +130,9 @@ func tanSeries(z complex128) float64 {
                t /= f
                d += t
 
-               rn += 1
+               rn++
                f *= rn
-               rn += 1
+               rn++
                f *= rn
                x2 *= x
                y2 *= y
index 8ce67e5e619472b69dd97edee44dc2c451fb45db..7dd75a88f4351aae93c78e6683c5017c382905f2 100644 (file)
@@ -229,7 +229,7 @@ func expm1(x float64) float64 {
                }
                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
        }
index 721112f77c42f89f4d9a7cbee8ca2ff37c546ffa..342278257ad909637c100e7d53fff18338dd5868 100644 (file)
@@ -174,7 +174,7 @@ func Jn(n int, x float64) float64 {
                        q1 := w*z - 1
                        k := 1
                        for q1 < 1e9 {
-                               k += 1
+                               k++
                                z += h
                                q0, q1 = q1, z*q1-q0
                        }
index d1bddfb1005a7aa605bb0cb61d074a317c16f84c..b128a1620c880eb524fab7a603b9b82db7b8fb06 100644 (file)
@@ -167,7 +167,7 @@ func log1p(x float64) float64 {
                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
                }
@@ -179,10 +179,9 @@ func log1p(x float64) float64 {
                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 {
index ed85f21be484a56f359d4b71c2b60a5f8b8a6a14..7a75a5f63d4e2987d335e146832a56687a3aed0b 100644 (file)
@@ -140,8 +140,8 @@ func cos(x float64) float64 {
 
        // 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 {
@@ -200,8 +200,8 @@ func sin(x float64) float64 {
 
        // 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
index 718030319928a40fd503dc64e76a47d6a3cff723..6e663d0c58a64f49849c06e4c84d28250d0a18dc 100644 (file)
@@ -40,8 +40,8 @@ func sincos(x float64) (sin, cos float64) {
        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
index 285eff1aba27ea643ee9056c06dd5bbf8aae2c39..aa2fb37e81b95c35d650cde682509cef80f8314b 100644 (file)
@@ -108,8 +108,8 @@ func tan(x float64) float64 {
 
        /* map zeros and singularities to origin */
        if j&1 == 1 {
-               j += 1
-               y += 1
+               j++
+               y++
        }
 
        z := ((x - y*PI4A) - y*PI4B) - y*PI4C