cmp: switch min and max to TotalOrd
The `Float` trait provides correct `min` and `max` methods on floating point types, providing a consistent result regardless of the order the parameters are passed. These generic functions do not take the necessary performance hit to correctly support a partial order, so the true requirement should be given as a type bound. Closes #12712
This commit is contained in:
parent
3fbee34a89
commit
4e1c2158f2
4 changed files with 7 additions and 9 deletions
|
|
@ -353,8 +353,6 @@ fn pnorm(nums: &~[f64], p: uint) -> f64 {
|
|||
|
||||
fn main() {
|
||||
let numbers = vec::from_fn(1000000, |_| rand::random::<f64>());
|
||||
println!("Inf-norm = {}", *numbers.iter().max().unwrap());
|
||||
|
||||
let numbers_arc = Arc::new(numbers);
|
||||
|
||||
for num in range(1u, 10) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue