Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
In [3]:
:timing
:sccache 1
:dep num = "0.4.0"
In [4]:
use num;
num::integer::div_rem¶
In [5]:
let (div, rem) = num::integer::div_rem(8, 5);
println!("div: {}, rem: {}", div, rem);
num::signum¶
In [6]:
num::signum(8)
Out[6]:
In [8]:
num::signum(-9)
Out[8]:
In [9]:
num::signum(-0)
Out[9]:
In [10]:
num::signum(-0.0)
Out[10]:
num::integer::binomial¶
The function num::integer::binomial(n, k)
calculates the number of combinations of choosing k
from n
.
In [5]:
num::integer::binomial(4, 2)
Out[5]:
In [6]:
num::integer::binomial(10, 3)
Out[6]:
In [9]:
num::integer::binomial(3, 3)
Out[9]:
In [7]:
num::integer::binomial(1, 2)
Out[7]:
In [8]:
num::integer::binomial(2, 3)
Out[8]:
In [ ]: