### ----------------------------------------------------
### -- Math::Handy
### -- Licenses: Artistic-2.0
### -- Authors: Stephen Schulze (thundergnat)
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use Math::Handy;

is-deeply(25!, 15511210043330985984000000, 'Postfix factorial');

is-deeply(factorial(25), 15511210043330985984000000, 'Routine factorial');

is-approx(Γ(1/2), π.sqrt, 'Gamma short form');

is-approx(gamma(1/2), π.sqrt, 'Gamma long form');

is-deeply((Σ (^1e2).grep: &is-prime), 1060, 'Sigma summation');

is-deeply((Π (^1e2).grep: &is-prime), 2305567963945518424753102147331756070, 'Pi product short form');

is-deeply((product (^1e2).grep: &is-prime), 2305567963945518424753102147331756070, 'Product long form');

is-deeply((33 /% 5), (6, 3), 'Divmod Real');

is-deeply((33 divmod 5), (6, 3), 'Divmod Int');

is-deeply((33.5 divmod 4.3), (8, 1), 'Divmod Int coerces');

is-deeply((33.5 /% 4.3), (7, 3.4), 'Divmod Real doesn\'t coerce');

is-deeply(digital-root(16781), (5, 2), 'additive digital root long form');

is-deeply(adr(16781), (5, 2), 'additive digital root short form');

is-deeply(multiplicative-digital-root(16781), (0, 4), 'multiplicative digital root long form');

is-deeply(mdr(16781), (0, 4), 'multiplicative digital root short form');

is-approx(180°, 3.141592653589793, 'Degrees to Radians');

is-approx(200ᵍ, 3.141592653589793, 'Gradians to Radians');

done-testing;


