File tree Expand file tree Collapse file tree 2 files changed +2
-17
lines changed Expand file tree Collapse file tree 2 files changed +2
-17
lines changed Original file line number Diff line number Diff line change 2929#![ feature( staged_api) ]
3030#![ feature( termination_trait_lib) ]
3131#![ feature( test) ]
32+ #![ feature( total_cmp) ]
3233
3334// Public reexports
3435pub use self :: bench:: { black_box, Bencher } ;
Original file line number Diff line number Diff line change 11#![ allow( missing_docs) ]
22#![ allow( deprecated) ] // Float
33
4- use std:: cmp:: Ordering :: { self , Equal , Greater , Less } ;
54use std:: mem;
65
76#[ cfg( test) ]
87mod tests;
98
10- fn local_cmp ( x : f64 , y : f64 ) -> Ordering {
11- // arbitrarily decide that NaNs are larger than everything.
12- if y. is_nan ( ) {
13- Less
14- } else if x. is_nan ( ) {
15- Greater
16- } else if x < y {
17- Less
18- } else if x == y {
19- Equal
20- } else {
21- Greater
22- }
23- }
24-
259fn local_sort ( v : & mut [ f64 ] ) {
26- v. sort_by ( |x : & f64 , y : & f64 | local_cmp ( * x , * y) ) ;
10+ v. sort_by ( |x : & f64 , y : & f64 | x . total_cmp ( y) ) ;
2711}
2812
2913/// Trait that provides simple descriptive statistics on a univariate set of numeric samples.
You can’t perform that action at this time.
0 commit comments