File tree Expand file tree Collapse file tree 5 files changed +22
-1
lines changed
branches/incoming/src/libcore/num Expand file tree Collapse file tree 5 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9
- refs/heads/incoming: c69f8ea91a47830c8acf33774610a1c23136091f
9
+ refs/heads/incoming: 8badea49b0291d5ea0979a8edfb1ebb4f01b043d
10
10
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -414,6 +414,12 @@ impl Trigonometric for f32 {
414
414
415
415
#[ inline( always) ]
416
416
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
+ }
417
423
}
418
424
419
425
impl Exponential for f32 {
Original file line number Diff line number Diff line change @@ -426,6 +426,12 @@ impl Trigonometric for f64 {
426
426
427
427
#[ inline( always) ]
428
428
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
+ }
429
435
}
430
436
431
437
impl Exponential for f64 {
Original file line number Diff line number Diff line change @@ -530,6 +530,14 @@ impl Trigonometric for float {
530
530
fn atan2 ( & self , other : float ) -> float {
531
531
( * self as f64 ) . atan2 ( other as f64 ) as float
532
532
}
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
+ }
533
541
}
534
542
535
543
impl Exponential for float {
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ pub trait Trigonometric {
118
118
fn acos ( & self ) -> Self ;
119
119
fn atan ( & self ) -> Self ;
120
120
fn atan2 ( & self , other : Self ) -> Self ;
121
+ fn sin_cos ( & self ) -> ( Self , Self ) ;
121
122
}
122
123
123
124
pub trait Exponential {
You can’t perform that action at this time.
0 commit comments