-
Notifications
You must be signed in to change notification settings - Fork 1
/
gammareg_test.go
114 lines (106 loc) · 2.95 KB
/
gammareg_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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package special_test
import (
"testing"
. "scientificgo.org/special"
"scientificgo.org/testutil"
)
var casesGammaRegQ = []struct {
Label string
In1, In2, Out float64
}{
{"", nan, 2, nan},
{"", -10, nan, nan},
{"", -inf, 456789, nan},
{"", 20, -2.432, nan},
{"", 10, 0, 1},
{"", 10, +inf, 0},
{"", +inf, +inf, 0.5},
{"", +inf, 456789, 1},
{"", 0, 10, 0},
{"", -10, 4.3, 0},
{"", 1, 1, 0.36787944117144233},
{"", 9.99, 20, 0.004954569877748838},
{"", 9.99, 200, 1.982646310671054e-72},
{"", 0.999, 200, 1.3757812606842123e-87},
{"", 420.1, 720.2, 2.79020552935468e-34},
{"", 1000, 1300, 1.8736155715785553e-18},
{"", 1000, 1600, 7.313139074297604e-59},
{"", 10000, 10600, 1.962192482133047e-09},
{"", 10000, 13600, 9.399356444057407e-231},
{"", 1e-05, 1e-06, 0.00013237427892869393},
{"", 100000, 1e-05, 1},
// {"",1e-10, 1e-05 , 1.0935719794146443e-09 },
{"", 1e-05, 1e-10, 0.00022446123970332708},
{"", -10.2, 1.99, -10.771647985412187},
{"", -9.2, 1.99, 2.2833353843893005},
{"", -19.2, 1.99, 4.844760972100303e+08},
{"", -19.2, 0.00199, 1.5611033767832837e+67},
{"", -9.9999, 1e-30, 3.603008059493326e+301},
{"", -9.99, 1e-30, 1.7779299225269738e+303},
}
func TestGammaRegQ(t *testing.T) { testutil.Test(t, tol, casesGammaRegQ, GammaRegQ) }
/*
func BenchmarkGammaRegQ(b *testing.B) {
GlobalF = bench(b, cGammaRegQ, "",
func(x []float64) float64 {
return GammaRegQ(x[0], x[1])
})
}
*/
var casesGammaRegP = []struct {
Label string
In1, In2, Out float64
}{
{"", nan, 2, nan},
{"", -10, nan, nan},
{"", -inf, 456789, nan},
{"", 20, -2.432, nan},
{"", 10, 0, 0},
{"", 10, +inf, 1},
{"", +inf, +inf, 0.5},
{"", +inf, 456789, 0},
{"", 0, 10, 1},
{"", 1, 1, 0.6321205588285577},
{"", 1, 10, 0.9999546000702375},
{"", 1, 50, 1},
{"", 10, 100, 1},
{"", 10, 150, 1},
{"", 50, 500, 1},
{"", 10, 250, 1},
{"", 100, 165, 0.9999999804505769},
{"", 250, 500, 1},
{"", 300, 101, 1.3305749570362612e-57},
{"", 300, 0.001, 0},
{"", 360, 20, 1.2865568842040574e-306},
{"", 360, 360, 0.5070088089381088},
{"", 150.5, 1.943e+07, 1},
{"", 475, 500, 0.8734349764734631},
{"", 4975, 5000, 0.6400425596444944},
{"", -0.5, 1, 1.0502545416600122},
{"", -15.5, 2, -273823.65628021094},
{"", 420, 700, 1},
{"", 9.99, 20, 0.9950454301222512},
{"", 9.99, 200, 1},
{"", 0.999, 200, 1},
{"", 1000, 1300, 1},
{"", 1000, 1600, 1},
{"", 10000, 10600, 0.9999999980378075},
{"", 10000, 13600, 1},
{"", 1e-05, 1e-06, 0.9998676257210714},
{"", 100000, 1e-05, 0},
{"", 1e-10, 1e-05, 0.999999998906428},
{"", 1e-05, 1e-10, 0.9997755387602967},
{"", -11.2, 1.99, -55.14334215125875},
{"", -9.2, 1.99, -1.28333538438931},
{"", -19.2, 1.99, -4.844760962100325e+08},
{"", -19.2, 0.00199, -1.561103376783299e+67},
}
func TestGammaRegP(t *testing.T) { testutil.Test(t, tol, casesGammaRegP, GammaRegP) }
/*
func BenchmarkGammaRegP(b *testing.B) {
GlobalF = bench(b, cGammaRegP, "",
func(x []float64) float64 {
return GammaRegP(x[0], x[1])
})
}
*/