num: clean up lint
MODIFY
num/dual/dual.go
num/dual/dual.go
@@ -15,8 +15,6 @@ type Number struct {
Real, Emag float64
}
-var zero = Number{}
-
// Format implements fmt.Formatter.
func (d Number) Format(fs fmt.State, c rune) {
prec, pOk := fs.Precision()

MODIFY
num/dual/dual_test.go
num/dual/dual_test.go
@@ -73,7 +73,6 @@ func dLog(x float64) float64 {
}
return 1 / x
}
-func dPow(x, y float64) float64 { return y * math.Pow(x, y-1) }
func dSqrt(x float64) float64 {
// For whatever reason, math.Sqrt(-0) returns -0.
// In this case, that is clearly a wrong approach.

MODIFY
num/dualcmplx/dual.go
num/dualcmplx/dual.go
@@ -16,8 +16,6 @@ type Number struct {
Real, Dual complex128
}
-var zero Number
-
// Format implements fmt.Formatter.
func (d Number) Format(fs fmt.State, c rune) {
prec, pOk := fs.Precision()

MODIFY
num/dualcmplx/dual_test.go
num/dualcmplx/dual_test.go
@@ -449,8 +449,3 @@ func same(a, b complex128, tol float64) bool {
return ((math.IsNaN(real(a)) && (math.IsNaN(real(b)))) || floats.EqualWithinAbsOrRel(real(a), real(b), tol, tol)) &&
((math.IsNaN(imag(a)) && (math.IsNaN(imag(b)))) || floats.EqualWithinAbsOrRel(imag(a), imag(b), tol, tol))
}
-
-func equalApprox(a, b complex128, tol float64) bool {
- return floats.EqualWithinAbsOrRel(real(a), real(b), tol, tol) &&
- floats.EqualWithinAbsOrRel(imag(a), imag(b), tol, tol)
-}

MODIFY
num/dualquat/dual.go
num/dualquat/dual.go
@@ -19,10 +19,7 @@ type Number struct {
Real, Dual quat.Number
}
-var (
- zero Number
- zeroQuat quat.Number
-)
+var zeroQuat quat.Number
// Format implements fmt.Formatter.
func (d Number) Format(fs fmt.State, c rune) {
@@ -147,23 +144,3 @@ func Abs(d Number) dual.Number {
Emag: quat.Abs(d.Dual),
}
}
-
-func addRealQuat(r float64, q quat.Number) quat.Number {
- q.Real += r
- return q
-}
-
-func addQuatReal(q quat.Number, r float64) quat.Number {
- q.Real += r
- return q
-}
-
-func subRealQuat(r float64, q quat.Number) quat.Number {
- q.Real = r - q.Real
- return q
-}
-
-func subQuatReal(q quat.Number, r float64) quat.Number {
- q.Real -= r
- return q
-}

MODIFY
num/hyperdual/hyperdual.go
num/hyperdual/hyperdual.go
@@ -15,10 +15,7 @@ type Number struct {
Real, E1mag, E2mag, E1E2mag float64
}
-var (
- zero = Number{}
- negZero = math.Float64frombits(1 << 63)
-)
+var negZero = math.Float64frombits(1 << 63)
// Format implements fmt.Formatter.
func (d Number) Format(fs fmt.State, c rune) {

MODIFY
num/hyperdual/hyperdual_test.go
num/hyperdual/hyperdual_test.go
@@ -73,7 +73,6 @@ func dLog(x float64) float64 {
}
return 1 / x
}
-func dPow(x, y float64) float64 { return y * math.Pow(x, y-1) }
func dSqrt(x float64) float64 {
// For whatever reason, math.Sqrt(-0) returns -0.
// In this case, that is clearly a wrong approach.
@@ -107,7 +106,6 @@ func d2Log(x float64) float64 {
}
return -1 / (x * x)
}
-func d2Pow(x, y float64) float64 { return y * (y - 1) * math.Pow(x, y-2) }
func d2Sqrt(x float64) float64 {
// Again math.Sqyu, and math.Pow are odd.
switch x {

num: clean up lint