diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-10-26 16:24:31 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-10-26 18:32:34 -0700 |
| commit | 4d669036f3264403f1663b14997a1e30db7b7e73 (patch) | |
| tree | 1d232920316333cbf8ccb287cf29f9756b60a3be /src/lib/math.rs | |
| parent | 1b75e5c315f00e6a10b1eca0a2f501107fd8063e (diff) | |
| download | rust-4d669036f3264403f1663b14997a1e30db7b7e73.tar.gz rust-4d669036f3264403f1663b14997a1e30db7b7e73.zip | |
Add more std documentation
Diffstat (limited to 'src/lib/math.rs')
| -rw-r--r-- | src/lib/math.rs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/lib/math.rs b/src/lib/math.rs index c9a27f0eca9..5f35d0d06d7 100644 --- a/src/lib/math.rs +++ b/src/lib/math.rs @@ -10,15 +10,72 @@ native "llvm" mod llvm { fn atan(n: float) -> float = "atan.f64"; } +/* +Function: sqrt + +Returns the square root +*/ fn sqrt(x: float) -> float { llvm::sqrt(x) } + +/* +Function: sin + +Returns the sine of an angle +*/ fn sin(x: float) -> float { llvm::sin(x) } + +/* +Function: cos + +Returns the cosine of an angle +*/ fn cos(x: float) -> float { llvm::cos(x) } + +/* +Function: tan + +Returns the tangent of an angle +*/ fn tan(x: float) -> float { llvm::tan(x) } + +/* +Function: asin + +Returns the arcsine of an angle +*/ fn asin(x: float) -> float { llvm::asin(x) } + +/* +Function: acos + +Returns the arccosine of an angle +*/ fn acos(x: float) -> float { llvm::acos(x) } + +/* +Function: atan + +Returns the arctangent of an angle +*/ fn atan(x: float) -> float { llvm::atan(x) } +/* +Const: pi + +Archimedes' constant +*/ const pi: float = 3.141592653589793; +/* +Function: min + +Returns the minimum of two values +*/ fn min<T>(x: T, y: T) -> T { x < y ? x : y } + +/* +Function: max + +Returns the maximum of two values +*/ fn max<T>(x: T, y: T) -> T { x < y ? y : x } |
