math: faster hypot
Use hardware sqrt for faster hypot; preserve software-only
hypot as hypotGo (like sqrtGo); enable benchmarking of
hypotGo.
R=rsc
CC=golang-dev
https://golang.org/cl/229049
diff --git a/src/pkg/math/all_test.go b/src/pkg/math/all_test.go
index 6279499..8cb5756 100644
--- a/src/pkg/math/all_test.go
+++ b/src/pkg/math/all_test.go
@@ -1754,6 +1754,12 @@
}
}
+func BenchmarkHypotGo(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ HypotGo(3, 4)
+ }
+}
+
func BenchmarkIlogb(b *testing.B) {
for i := 0; i < b.N; i++ {
Ilogb(.5)