Skip to content

Commit 5c047b9

Browse files
committed
tests: Add test for math special functions.
1 parent 5cbeace commit 5c047b9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/float/math_fun_special.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# test the special functions imported from math
2+
3+
try:
4+
from math import *
5+
except ImportError:
6+
print("SKIP")
7+
import sys
8+
sys.exit()
9+
10+
test_values = [-8., -2.5, -1, -0.5, 0.0, 0.5, 2.5, 8.,]
11+
pos_test_values = [0.001, 0.1, 0.5, 1.0, 1.5, 10.,]
12+
13+
functions = [
14+
('erf', erf, test_values),
15+
('erfc', erfc, test_values),
16+
('gamma', gamma, pos_test_values),
17+
('lgamma', lgamma, pos_test_values + [50., 100.,]),
18+
]
19+
20+
for function_name, function, test_vals in functions:
21+
print(function_name)
22+
for value in test_vals:
23+
print("{:.5g}".format(function(value)))

0 commit comments

Comments
 (0)