func TestAcos(t *testing.T) {
for i := 0; i < len(vf); i++ {
- // if f := Acos(vf[i] / 10); !veryclose(acos[i], f) {
if f := Acos(vf[i] / 10); !close(acos[i], f) {
t.Errorf("Acos(%g) = %g, want %g\n", vf[i]/10, f, acos[i])
}
func TestSqrt(t *testing.T) {
for i := 0; i < len(vf); i++ {
a := Fabs(vf[i])
- if f := Sqrt(a); !veryclose(sqrt[i], f) {
- t.Errorf("Sqrt(%g) = %g, want %g\n", a, f, floor[i])
+ if f := SqrtGo(a); sqrt[i] != f {
+ t.Errorf("sqrtGo(%g) = %g, want %g\n", a, f, sqrt[i])
+ }
+ a = Fabs(vf[i])
+ if f := Sqrt(a); sqrt[i] != f {
+ t.Errorf("Sqrt(%g) = %g, want %g\n", a, f, sqrt[i])
}
}
}
func TestHypot(t *testing.T) {
for i := 0; i < len(vf); i++ {
a := Fabs(tanh[i] * Sqrt(2))
- if f := Hypot(tanh[i], tanh[i]); !veryclose(a, f) {
+ if f := Hypot(tanh[i], tanh[i]); a != f {
t.Errorf("Hypot(%g, %g) = %g, want %g\n", tanh[i], tanh[i], f, a)
}
}
--- /dev/null
+// Copyright 2010 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package math
+
+// Make sqrtGo available for testing.
+
+func SqrtGo(x float64) float64 { return sqrtGo(x) }