Skip to content

Commit d3f494f

Browse files
committed
Merge Exponential and Hyperbolic traits
The Hyperbolic Functions are trivially implemented in terms of `exp`, so it's simpler to group them the Exponential trait. In the future these would have default implementations.
1 parent 20ad931 commit d3f494f

File tree

6 files changed

+5
-11
lines changed

6 files changed

+5
-11
lines changed

src/libcore/core.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub use iter::{ExtendedMutableIter};
105105

106106
pub use num::{Num, NumCast};
107107
pub use num::{Orderable, Signed, Unsigned, Round};
108-
pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
108+
pub use num::{Algebraic, Trigonometric, Exponential};
109109
pub use num::{Integer, Fractional, Real, RealExt};
110110
pub use num::{Bitwise, BitCount, Bounded};
111111
pub use num::{Primitive, Int, Float};

src/libcore/num/f32.rs

-2
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,7 @@ impl Exponential for f32 {
425425

426426
#[inline(always)]
427427
fn log10(&self) -> f32 { log10(*self) }
428-
}
429428

430-
impl Hyperbolic for f32 {
431429
#[inline(always)]
432430
fn sinh(&self) -> f32 { sinh(*self) }
433431

src/libcore/num/f64.rs

-2
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,7 @@ impl Exponential for f64 {
437437

438438
#[inline(always)]
439439
fn log10(&self) -> f64 { log10(*self) }
440-
}
441440

442-
impl Hyperbolic for f64 {
443441
#[inline(always)]
444442
fn sinh(&self) -> f64 { sinh(*self) }
445443

src/libcore/num/float.rs

-2
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,7 @@ impl Exponential for float {
547547
fn log10(&self) -> float {
548548
(*self as f64).log10() as float
549549
}
550-
}
551550
552-
impl Hyperbolic for float {
553551
#[inline(always)]
554552
fn sinh(&self) -> float {
555553
(*self as f64).sinh() as float

src/libcore/num/num.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ pub trait Exponential {
131131
fn log(&self) -> Self;
132132
fn log2(&self) -> Self;
133133
fn log10(&self) -> Self;
134-
}
135134

136-
pub trait Hyperbolic: Exponential {
135+
// The Hyperbolic Functions are trivially implemented in terms of `exp`, so it's simpler
136+
// to group them within this trait. In the future these would have default implementations.
137137
fn sinh(&self) -> Self;
138138
fn cosh(&self) -> Self;
139139
fn tanh(&self) -> Self;
@@ -146,7 +146,7 @@ pub trait Real: Signed
146146
+ Fractional
147147
+ Algebraic
148148
+ Trigonometric
149-
+ Hyperbolic {
149+
+ Exponential {
150150
// Common Constants
151151
// FIXME (#5527): These should be associated constants
152152
fn pi() -> Self;

src/libcore/prelude.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub use iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
3939
pub use iter::{Times, ExtendedMutableIter};
4040
pub use num::{Num, NumCast};
4141
pub use num::{Orderable, Signed, Unsigned, Round};
42-
pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
42+
pub use num::{Algebraic, Trigonometric, Exponential};
4343
pub use num::{Integer, Fractional, Real, RealExt};
4444
pub use num::{Bitwise, BitCount, Bounded};
4545
pub use num::{Primitive, Int, Float};

0 commit comments

Comments
 (0)