rust/src/libcore/math.rs

19 lines
330 B
Rust
Raw Normal View History

// Generic functions that have been defined for all numeric types
//
// (may very well go away again soon)
/*
Function: min
Returns the minimum of two values
*/
pure fn min<copy T>(x: T, y: T) -> T { x < y ? x : y }
/*
Function: max
Returns the maximum of two values
*/
pure fn max<copy T>(x: T, y: T) -> T { x < y ? y : x }