diff options
| author | bors <bors@rust-lang.org> | 2013-05-16 23:43:30 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-16 23:43:30 -0700 |
| commit | 8badea49b0291d5ea0979a8edfb1ebb4f01b043d (patch) | |
| tree | 220c88170b5ccee6d86429503d9000ca9c67d41f /src/libcore/num/float.rs | |
| parent | c69f8ea91a47830c8acf33774610a1c23136091f (diff) | |
| parent | 56960817814975eb992a6770deba3b110c23ae90 (diff) | |
| download | rust-8badea49b0291d5ea0979a8edfb1ebb4f01b043d.tar.gz rust-8badea49b0291d5ea0979a8edfb1ebb4f01b043d.zip | |
auto merge of #6549 : bjz/rust/numeric-traits, r=thestinger
As discussed on issue #4819. This is a naive implementation, trusting LLVM to do the relevant optimizations. In the future this could be implemented more efficiently, but it's a start.
Diffstat (limited to 'src/libcore/num/float.rs')
| -rw-r--r-- | src/libcore/num/float.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs index 8b3c7b1e79e..681aafaab88 100644 --- a/src/libcore/num/float.rs +++ b/src/libcore/num/float.rs @@ -530,6 +530,14 @@ impl Trigonometric for float { fn atan2(&self, other: float) -> float { (*self as f64).atan2(other as f64) as float } + + /// Simultaneously computes the sine and cosine of the number + #[inline(always)] + fn sin_cos(&self) -> (float, float) { + match (*self as f64).sin_cos() { + (s, c) => (s as float, c as float) + } + } } impl Exponential for float { |
