about summary refs log tree commit diff
path: root/src/libcore/math.rs
blob: 9c83ce04bfe22950a68236a0a85d46f8e4ac2eef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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<T: copy>(x: T, y: T) -> T { x < y ? x : y }

/*
Function: max

Returns the maximum of two values
*/
pure fn max<T: copy>(x: T, y: T) -> T { x < y ? y : x }