Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#![feature(staged_api)]
#![feature(termination_trait_lib)]
#![feature(test)]
#![feature(total_cmp)]

// Public reexports
pub use self::bench::{black_box, Bencher};
Expand Down
18 changes: 1 addition & 17 deletions library/test/src/stats.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
#![allow(missing_docs)]
#![allow(deprecated)] // Float

use std::cmp::Ordering::{self, Equal, Greater, Less};
use std::mem;

#[cfg(test)]
mod tests;

fn local_cmp(x: f64, y: f64) -> Ordering {
// arbitrarily decide that NaNs are larger than everything.
if y.is_nan() {
Less
} else if x.is_nan() {
Greater
} else if x < y {
Less
} else if x == y {
Equal
} else {
Greater
}
}

fn local_sort(v: &mut [f64]) {
v.sort_by(|x: &f64, y: &f64| local_cmp(*x, *y));
v.sort_by(|x: &f64, y: &f64| x.total_cmp(y));
}

/// Trait that provides simple descriptive statistics on a univariate set of numeric samples.
Expand Down