math : add error and gamma functions; sort all functions

This commit is contained in:
Koustav Chowdhury 2019-07-12 11:16:40 +05:30 committed by Alexander Medvednikov
parent 9a957ccc18
commit 08866f1331
2 changed files with 51 additions and 18 deletions

View file

@ -31,3 +31,17 @@ fn test_factorial() {
assert math.factorial(5) == 120
assert math.factorial(0) == 1
}
fn test_erf() {
assert math.erf(0) == 0
assert math.erf(1.5) + math.erf(-1.5) == 0
assert math.erfc(0) == 1
assert math.erf(2.5) + math.erfc(2.5) == 1
assert math.erfc(3.6) + math.erfc(-3.6) == 2
}
fn test_gamma() {
assert math.gamma(1) == 1
assert math.gamma(5) == 24
assert math.log_gamma(4.5) == math.log(math.gamma(4.5))
}