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 23:36:08 +08:00
|
|
|
/// Returns the maximum among three values.
|
|
|
|
pub fn max3_scalar<N: Number>(a: N, b: N, c: N) -> N {
|
2018-09-21 01:54:12 +08:00
|
|
|
na::sup(&na::sup(&a, &b), &c)
|
2018-09-20 16:50:34 +08:00
|
|
|
}
|
|
|
|
|
2018-09-22 23:36:08 +08:00
|
|
|
/// Returns the maximum among four values.
|
|
|
|
pub fn max4_scalar<N: Number>(a: N, b: N, c: N, d: N) -> N {
|
2018-09-21 01:54:12 +08:00
|
|
|
na::sup(&na::sup(&a, &b), &na::sup(&c, &d))
|
2018-09-20 16:50:34 +08:00
|
|
|
}
|
|
|
|
|
2018-09-23 21:59:24 +08:00
|
|
|
/// Returns the minimum among three values.
|
2018-09-22 23:36:08 +08:00
|
|
|
pub fn min3_scalar<N: Number>(a: N, b: N, c: N) -> N {
|
2018-09-21 01:54:12 +08:00
|
|
|
na::inf(&na::inf(&a, &b), &c)
|
2018-09-20 16:50:34 +08:00
|
|
|
}
|
|
|
|
|
2018-09-23 21:59:24 +08:00
|
|
|
/// Returns the minimum among four values.
|
2018-09-22 23:36:08 +08:00
|
|
|
pub fn min4_scalar<N: Number>(a: N, b: N, c: N, d: N) -> N {
|
2018-09-21 01:54:12 +08:00
|
|
|
na::inf(&na::inf(&a, &b), &na::inf(&c, &d))
|
|
|
|
}
|