math: remove the leading F from Fabs etc.
The letter is a holdover from C and unnecessary in Go.
Gofix module included.
Fixes #2306.
R=golang-dev, gri, dsymonds
CC=golang-dev
https://golang.org/cl/5158043
diff --git a/src/pkg/cmath/asin.go b/src/pkg/cmath/asin.go
index d6a3ca4..01ce80a 100644
--- a/src/pkg/cmath/asin.go
+++ b/src/pkg/cmath/asin.go
@@ -50,7 +50,7 @@
// Asin returns the inverse sine of x.
func Asin(x complex128) complex128 {
if imag(x) == 0 {
- if math.Fabs(real(x)) > 1 {
+ if math.Abs(real(x)) > 1 {
return complex(math.Pi/2, 0) // DOMAIN error
}
return complex(math.Asin(real(x)), 0)
@@ -67,7 +67,7 @@
func Asinh(x complex128) complex128 {
// TODO check range
if imag(x) == 0 {
- if math.Fabs(real(x)) > 1 {
+ if math.Abs(real(x)) > 1 {
return complex(math.Pi/2, 0) // DOMAIN error
}
return complex(math.Asinh(real(x)), 0)
diff --git a/src/pkg/cmath/sin.go b/src/pkg/cmath/sin.go
index 8900ecd..486b717 100644
--- a/src/pkg/cmath/sin.go
+++ b/src/pkg/cmath/sin.go
@@ -122,7 +122,7 @@
// calculate sinh and cosh
func sinhcosh(x float64) (sh, ch float64) {
- if math.Fabs(x) <= 0.5 {
+ if math.Abs(x) <= 0.5 {
return math.Sinh(x), math.Cosh(x)
}
e := math.Exp(x)
diff --git a/src/pkg/cmath/sqrt.go b/src/pkg/cmath/sqrt.go
index e77a9b9..4e7e805 100644
--- a/src/pkg/cmath/sqrt.go
+++ b/src/pkg/cmath/sqrt.go
@@ -76,7 +76,7 @@
b := imag(x)
var scale float64
// Rescale to avoid internal overflow or underflow.
- if math.Fabs(a) > 4 || math.Fabs(b) > 4 {
+ if math.Abs(a) > 4 || math.Abs(b) > 4 {
a *= 0.25
b *= 0.25
scale = 2
@@ -89,11 +89,11 @@
var t float64
if a > 0 {
t = math.Sqrt(0.5*r + 0.5*a)
- r = scale * math.Fabs((0.5*b)/t)
+ r = scale * math.Abs((0.5*b)/t)
t *= scale
} else {
r = math.Sqrt(0.5*r - 0.5*a)
- t = scale * math.Fabs((0.5*b)/r)
+ t = scale * math.Abs((0.5*b)/r)
r *= scale
}
if b < 0 {
diff --git a/src/pkg/cmath/tan.go b/src/pkg/cmath/tan.go
index 94b5175..67dc22a 100644
--- a/src/pkg/cmath/tan.go
+++ b/src/pkg/cmath/tan.go
@@ -58,7 +58,7 @@
// Tan returns the tangent of x.
func Tan(x complex128) complex128 {
d := math.Cos(2*real(x)) + math.Cosh(2*imag(x))
- if math.Fabs(d) < 0.25 {
+ if math.Abs(d) < 0.25 {
d = tanSeries(x)
}
if d == 0 {
@@ -109,8 +109,8 @@
// Taylor series expansion for cosh(2y) - cos(2x)
func tanSeries(z complex128) float64 {
const MACHEP = 1.0 / (1 << 53)
- x := math.Fabs(2 * real(z))
- y := math.Fabs(2 * imag(z))
+ x := math.Abs(2 * real(z))
+ y := math.Abs(2 * imag(z))
x = reducePi(x)
x = x * x
y = y * y
@@ -139,7 +139,7 @@
t = y2 - x2
t /= f
d += t
- if math.Fabs(t/d) <= MACHEP {
+ if math.Abs(t/d) <= MACHEP {
break
}
}
@@ -174,7 +174,7 @@
// Cot returns the cotangent of x.
func Cot(x complex128) complex128 {
d := math.Cosh(2*imag(x)) - math.Cos(2*real(x))
- if math.Fabs(d) < 0.25 {
+ if math.Abs(d) < 0.25 {
d = tanSeries(x)
}
if d == 0 {