Skip to content

Commit 4c9c023

Browse files
alexd765bradfitz
authored andcommitted
math,math/cmplx: fix linter issues
Change-Id: If061f1f120573cb109d97fa40806e160603cd593 Reviewed-on: https://go-review.googlesource.com/31871 Reviewed-by: Rob Pike <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 426c287 commit 4c9c023

File tree

7 files changed

+17
-18
lines changed

7 files changed

+17
-18
lines changed

src/math/cmplx/tan.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,19 @@ func tanSeries(z complex128) float64 {
120120
rn := 0.0
121121
d := 0.0
122122
for {
123-
rn += 1
123+
rn++
124124
f *= rn
125-
rn += 1
125+
rn++
126126
f *= rn
127127
x2 *= x
128128
y2 *= y
129129
t := y2 + x2
130130
t /= f
131131
d += t
132132

133-
rn += 1
133+
rn++
134134
f *= rn
135-
rn += 1
135+
rn++
136136
f *= rn
137137
x2 *= x
138138
y2 *= y

src/math/expm1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func expm1(x float64) float64 {
229229
}
230230
t := Float64frombits(uint64(0x3ff-k) << 52) // 2**-k
231231
y := x - (e + t)
232-
y += 1
232+
y++
233233
y = Float64frombits(Float64bits(y) + uint64(k)<<52) // add k to y's exponent
234234
return y
235235
}

src/math/jn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func Jn(n int, x float64) float64 {
174174
q1 := w*z - 1
175175
k := 1
176176
for q1 < 1e9 {
177-
k += 1
177+
k++
178178
z += h
179179
q0, q1 = q1, z*q1-q0
180180
}

src/math/log1p.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func log1p(x float64) float64 {
167167
if iu < 0x0006a09e667f3bcd { // mantissa of Sqrt(2)
168168
u = Float64frombits(iu | 0x3ff0000000000000) // normalize u
169169
} else {
170-
k += 1
170+
k++
171171
u = Float64frombits(iu | 0x3fe0000000000000) // normalize u/2
172172
iu = (0x0010000000000000 - iu) >> 2
173173
}
@@ -179,10 +179,9 @@ func log1p(x float64) float64 {
179179
if f == 0 {
180180
if k == 0 {
181181
return 0
182-
} else {
183-
c += float64(k) * Ln2Lo
184-
return float64(k)*Ln2Hi + c
185182
}
183+
c += float64(k) * Ln2Lo
184+
return float64(k)*Ln2Hi + c
186185
}
187186
R = hfsq * (1.0 - 0.66666666666666666*f) // avoid division
188187
if k == 0 {

src/math/sin.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ func cos(x float64) float64 {
140140

141141
// map zeros to origin
142142
if j&1 == 1 {
143-
j += 1
144-
y += 1
143+
j++
144+
y++
145145
}
146146
j &= 7 // octant modulo 2Pi radians (360 degrees)
147147
if j > 3 {
@@ -200,8 +200,8 @@ func sin(x float64) float64 {
200200

201201
// map zeros to origin
202202
if j&1 == 1 {
203-
j += 1
204-
y += 1
203+
j++
204+
y++
205205
}
206206
j &= 7 // octant modulo 2Pi radians (360 degrees)
207207
// reflect in x axis

src/math/sincos.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ func sincos(x float64) (sin, cos float64) {
4040
y := float64(j) // integer part of x/(Pi/4), as float
4141

4242
if j&1 == 1 { // map zeros to origin
43-
j += 1
44-
y += 1
43+
j++
44+
y++
4545
}
4646
j &= 7 // octant modulo 2Pi radians (360 degrees)
4747
if j > 3 { // reflect in x axis

src/math/tan.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ func tan(x float64) float64 {
108108

109109
/* map zeros and singularities to origin */
110110
if j&1 == 1 {
111-
j += 1
112-
y += 1
111+
j++
112+
y++
113113
}
114114

115115
z := ((x - y*PI4A) - y*PI4B) - y*PI4C

0 commit comments

Comments
 (0)