Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

:timing
:sccache 1
:dep num = "0.4.0"
use num;

num::integer::div_rem

let (div, rem) = num::integer::div_rem(8, 5);
println!("div: {}, rem: {}", div, rem);
div: 1, rem: 3

num::signum

num::signum(8)
1
num::signum(-9)
-1
num::signum(-0)
0
num::signum(-0.0)
-1.0

num::integer::binomial

The function num::integer::binomial(n, k) calculates the number of combinations of choosing k from n.

num::integer::binomial(4, 2)
6
num::integer::binomial(10, 3)
120
num::integer::binomial(3, 3)
1
num::integer::binomial(1, 2)
0
num::integer::binomial(2, 3)
0