mirror of
https://github.com/vlang/v.git
synced 2025-09-16 07:52:32 +03:00
math : add error and gamma functions; sort all functions
This commit is contained in:
parent
9a957ccc18
commit
08866f1331
2 changed files with 51 additions and 18 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue