-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcephes_zeta_test.jule
More file actions
40 lines (37 loc) · 1.11 KB
/
cephes_zeta_test.jule
File metadata and controls
40 lines (37 loc) · 1.11 KB
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
// Copyright 2025 mertcandav.
// Use of this source code is governed by a BSD 3-Clause
// license that can be found in the LICENSE file.
use "std/math"
use "std/testing"
let testsZeta: []betaTest = [
// Results computed using scipy.special.zeta
{1, 1, math::Inf(1)},
{1.00001, 0.5, 100001.96352290553},
{1.0001, 25, 9996.8017690244506},
{1.001, 1, 1000.5772884760117},
{1.01, 10, 97.773405639173305},
{1.5, 2, 1.6123753486854886},
{1.5, 20, 0.45287361712938717},
{2, -0.7, 14.28618087263834},
{2.5, 0.5, 6.2471106345688137},
{5, 2.5, 0.013073166646113805},
{7.5, 5, 7.9463377443314306e-06},
{10, -0.5, 2048.0174503557578},
{10, 0.5, 1024.0174503557578},
{10, 7.5, 2.5578265694201971e-9},
{12, 2.5, 1.7089167198843551e-5},
{17, 0.5, 131072.00101513157},
{20, -2.5, 2097152.0006014798},
{20, 0.75, 315.3368689825316},
{25, 0.25, 1125899906842624.0},
{30, 1, 1.0000000009313275},
]
#test
fn testZeta(t: &testing::T) {
for i, test in testsZeta {
got := Zeta(test.p, test.q)
if !Tolerance(got, test.want, 1e-10) {
t.Errorf("test {} Zeta({}, {}) failed: got {} want {}", i, test.p, test.q, got, test.want)
}
}
}