Skip to content

Commit 7cdbc6e

Browse files
committed
---
yaml --- r: 59765 b: refs/heads/snap-stage3 c: 8badea4 h: refs/heads/master i: 59763: df5a359 v: v3
1 parent 21257c2 commit 7cdbc6e

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: c69f8ea91a47830c8acf33774610a1c23136091f
4+
refs/heads/snap-stage3: 8badea49b0291d5ea0979a8edfb1ebb4f01b043d
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcore/num/f32.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,12 @@ impl Trigonometric for f32 {
414414

415415
#[inline(always)]
416416
fn atan2(&self, other: f32) -> f32 { atan2(*self, other) }
417+
418+
/// Simultaneously computes the sine and cosine of the number
419+
#[inline(always)]
420+
fn sin_cos(&self) -> (f32, f32) {
421+
(self.sin(), self.cos())
422+
}
417423
}
418424

419425
impl Exponential for f32 {

branches/snap-stage3/src/libcore/num/f64.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@ impl Trigonometric for f64 {
426426

427427
#[inline(always)]
428428
fn atan2(&self, other: f64) -> f64 { atan2(*self, other) }
429+
430+
/// Simultaneously computes the sine and cosine of the number
431+
#[inline(always)]
432+
fn sin_cos(&self) -> (f64, f64) {
433+
(self.sin(), self.cos())
434+
}
429435
}
430436

431437
impl Exponential for f64 {

branches/snap-stage3/src/libcore/num/float.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,14 @@ impl Trigonometric for float {
530530
fn atan2(&self, other: float) -> float {
531531
(*self as f64).atan2(other as f64) as float
532532
}
533+
534+
/// Simultaneously computes the sine and cosine of the number
535+
#[inline(always)]
536+
fn sin_cos(&self) -> (float, float) {
537+
match (*self as f64).sin_cos() {
538+
(s, c) => (s as float, c as float)
539+
}
540+
}
533541
}
534542

535543
impl Exponential for float {

branches/snap-stage3/src/libcore/num/num.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ pub trait Trigonometric {
118118
fn acos(&self) -> Self;
119119
fn atan(&self) -> Self;
120120
fn atan2(&self, other: Self) -> Self;
121+
fn sin_cos(&self) -> (Self, Self);
121122
}
122123

123124
pub trait Exponential {

0 commit comments

Comments
 (0)