forked from gonum/gonum
/
extremes.go
90 lines (78 loc) · 1.3 KB
/
extremes.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright ©2020 The Gonum 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 testrand
import "math"
const (
maxUint = ^uint(0)
maxInt = int(maxUint >> 1)
)
var (
extremeFloat64Unit = [...]float64{
0,
math.SmallestNonzeroFloat64,
0.5,
1 - math.SmallestNonzeroFloat64,
1,
}
extremeFloat64Norm = [...]float64{
-math.MaxFloat64,
-math.MaxFloat64 / 2,
-1,
-math.SmallestNonzeroFloat64,
0,
math.SmallestNonzeroFloat64,
1,
math.MaxFloat64 / 2,
math.MaxFloat64,
}
extremeFloat64Exp = [...]float64{
0,
math.SmallestNonzeroFloat64,
1,
math.MaxFloat64 / 2,
math.MaxFloat64,
}
extremeFloat32Unit = [...]float32{
0,
math.SmallestNonzeroFloat32,
0.5,
1 - math.SmallestNonzeroFloat32,
1,
}
extremeInt = [...]int{
0,
1,
maxInt / 2,
maxInt - 1,
maxInt,
}
extremeInt31 = [...]int32{
0,
1,
math.MaxInt32 / 2,
math.MaxInt32 - 1,
math.MaxInt32,
}
extremeInt63 = [...]int64{
0,
1,
math.MaxInt64 / 2,
math.MaxInt64 - 1,
math.MaxInt64,
}
extremeUint32 = [...]uint32{
0,
1,
math.MaxUint32 / 2,
math.MaxUint32 - 1,
math.MaxUint32,
}
extremeUint64 = [...]uint64{
0,
1,
math.MaxUint64 / 2,
math.MaxUint64 - 1,
math.MaxUint64,
}
)