2018-09-21 01:54:12 +08:00
|
|
|
use na;
|
2018-09-20 16:50:34 +08:00
|
|
|
|
2018-09-21 01:54:12 +08:00
|
|
|
use traits::Number;
|
2018-09-20 16:50:34 +08:00
|
|
|
|
2018-09-22 19:18:59 +08:00
|
|
|
/// Returns the maximum value among three.
|
2018-09-21 01:54:12 +08:00
|
|
|
pub fn max3<N: Number>(a: N, b: N, c: N) -> N {
|
|
|
|
na::sup(&na::sup(&a, &b), &c)
|
2018-09-20 16:50:34 +08:00
|
|
|
}
|
|
|
|
|
2018-09-22 19:18:59 +08:00
|
|
|
/// Returns the maximum value among four.
|
2018-09-21 01:54:12 +08:00
|
|
|
pub fn max4<N: Number>(a: N, b: N, c: N, d: N) -> N {
|
|
|
|
na::sup(&na::sup(&a, &b), &na::sup(&c, &d))
|
2018-09-20 16:50:34 +08:00
|
|
|
}
|
|
|
|
|
2018-09-22 19:18:59 +08:00
|
|
|
/// Returns the maximum value among three.
|
2018-09-21 01:54:12 +08:00
|
|
|
pub fn min3<N: Number>(a: N, b: N, c: N) -> N {
|
|
|
|
na::inf(&na::inf(&a, &b), &c)
|
2018-09-20 16:50:34 +08:00
|
|
|
}
|
|
|
|
|
2018-09-22 19:18:59 +08:00
|
|
|
/// Returns the maximum value among four.
|
2018-09-21 01:54:12 +08:00
|
|
|
pub fn min4<N: Number>(a: N, b: N, c: N, d: N) -> N {
|
|
|
|
na::inf(&na::inf(&a, &b), &na::inf(&c, &d))
|
|
|
|
}
|