about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBrendan Zabarauskas <bjzaba@yahoo.com.au>2013-04-29 22:15:58 +1000
committerBrendan Zabarauskas <bjzaba@yahoo.com.au>2013-04-29 22:15:58 +1000
commitd3f494f5c3ce96da2e0c8090fc17a8738e4396c1 (patch)
tree463ace42bc61f9e62e87839ecaae5f057cf81eb9 /src
parent20ad931bf337db2efd25e6571e322d31b5b83877 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/core.rc2
-rw-r--r--src/libcore/num/f32.rs2
-rw-r--r--src/libcore/num/f64.rs2
-rw-r--r--src/libcore/num/float.rs2
-rw-r--r--src/libcore/num/num.rs6
-rw-r--r--src/libcore/prelude.rs2
6 files changed, 5 insertions, 11 deletions
diff --git a/src/libcore/core.rc b/src/libcore/core.rc
index bf92a30f7ce..979a02d9f9c 100644
--- a/src/libcore/core.rc
+++ b/src/libcore/core.rc
@@ -105,7 +105,7 @@ pub use iter::{ExtendedMutableIter};
 
 pub use num::{Num, NumCast};
 pub use num::{Orderable, Signed, Unsigned, Round};
-pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
+pub use num::{Algebraic, Trigonometric, Exponential};
 pub use num::{Integer, Fractional, Real, RealExt};
 pub use num::{Bitwise, BitCount, Bounded};
 pub use num::{Primitive, Int, Float};
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index e687f482fa9..8c34219ae21 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -425,9 +425,7 @@ impl Exponential for f32 {
 
     #[inline(always)]
     fn log10(&self) -> f32 { log10(*self) }
-}
 
-impl Hyperbolic for f32 {
     #[inline(always)]
     fn sinh(&self) -> f32 { sinh(*self) }
 
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index d00e6ae2c0d..19951ad7cff 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -437,9 +437,7 @@ impl Exponential for f64 {
 
     #[inline(always)]
     fn log10(&self) -> f64 { log10(*self) }
-}
 
-impl Hyperbolic for f64 {
     #[inline(always)]
     fn sinh(&self) -> f64 { sinh(*self) }
 
diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs
index 3aa8848cdbe..c64f36f065f 100644
--- a/src/libcore/num/float.rs
+++ b/src/libcore/num/float.rs
@@ -547,9 +547,7 @@ impl Exponential for float {
     fn log10(&self) -> float {
         (*self as f64).log10() as float
     }
-}
 
-impl Hyperbolic for float {
     #[inline(always)]
     fn sinh(&self) -> float {
         (*self as f64).sinh() as float
diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs
index 3e43ebfef12..30a1213f7ff 100644
--- a/src/libcore/num/num.rs
+++ b/src/libcore/num/num.rs
@@ -131,9 +131,9 @@ pub trait Exponential {
     fn log(&self) -> Self;
     fn log2(&self) -> Self;
     fn log10(&self) -> Self;
-}
 
-pub trait Hyperbolic: Exponential {
+    // The Hyperbolic Functions are trivially implemented in terms of `exp`, so it's  simpler
+    // to group them within this trait. In the future these would have default implementations.
     fn sinh(&self) -> Self;
     fn cosh(&self) -> Self;
     fn tanh(&self) -> Self;
@@ -146,7 +146,7 @@ pub trait Real: Signed
               + Fractional
               + Algebraic
               + Trigonometric
-              + Hyperbolic {
+              + Exponential {
     // Common Constants
     // FIXME (#5527): These should be associated constants
     fn pi() -> Self;
diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs
index 5fef01e65de..1b20efe0cca 100644
--- a/src/libcore/prelude.rs
+++ b/src/libcore/prelude.rs
@@ -39,7 +39,7 @@ pub use iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
 pub use iter::{Times, ExtendedMutableIter};
 pub use num::{Num, NumCast};
 pub use num::{Orderable, Signed, Unsigned, Round};
-pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
+pub use num::{Algebraic, Trigonometric, Exponential};
 pub use num::{Integer, Fractional, Real, RealExt};
 pub use num::{Bitwise, BitCount, Bounded};
 pub use num::{Primitive, Int, Float};