math: 386 FPU hypot
Added 386 FPU version of Hypot; modified all_test.go to test
Hypot with large arguments. Also edited sqrt.go to remove
Sqrt(0) as a special case.
R=rsc
CC=golang-dev
https://golang.org/cl/186180
diff --git a/src/pkg/math/all_test.go b/src/pkg/math/all_test.go
index 15d289b..97c52d3 100644
--- a/src/pkg/math/all_test.go
+++ b/src/pkg/math/all_test.go
@@ -585,9 +585,9 @@
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]); a != f {
- t.Errorf("Hypot(%g, %g) = %g, want %g\n", tanh[i], tanh[i], f, a)
+ a := Fabs(1e200 * tanh[i] * Sqrt(2))
+ if f := Hypot(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
+ t.Errorf("Hypot(%g, %g) = %g, want %g\n", 1e200*tanh[i], 1e200*tanh[i], f, a)
}
}
for i := 0; i < len(vfhypotSC); i++ {