-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathldexp_test.go
55 lines (48 loc) · 899 Bytes
/
ldexp_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package bench
import (
"math"
"testing"
chewxy "github.com/chewxy/math32"
"github.com/klokare/math32"
)
func BenchmarkLdexpKlokare(b *testing.B) {
for i := 0; i < b.N; i++ {
for n := -5; n <= 5; n++ {
for _, x := range values {
dummy32 = math32.Ldexp(x, n)
}
}
}
}
func BenchmarkLdexpGolang64(b *testing.B) {
values := values64()
b.ResetTimer()
for i := 0; i < b.N; i++ {
for n := -5; n <= 5; n++ {
for _, x := range values {
dummy64 = math.Ldexp(x, n)
}
}
}
}
func BenchmarkLdexpChewxy(b *testing.B) {
for i := 0; i < b.N; i++ {
for n := -5; n <= 5; n++ {
for _, x := range values {
dummy32 = chewxy.Ldexp(x, n)
}
}
}
}
// barnex does not implement Ldexp
/*
func BenchmarkLdexpBarnex(b *testing.B) {
for i := 0; i < b.N; i++ {
for n := -5; n <= 5; n++ {
for _, x := range values {
dummy32 = barnex.Ldexp(x, n)
}
}
}
}
*/