about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-03-31 07:00:26 -0400
committerDaniel Micay <danielmicay@gmail.com>2014-03-31 17:41:52 -0400
commit8ca5caf4d936e3193c81c7e9cfa1c6a99717b14a (patch)
tree46b326699b4c280dcc119add28b9c37a35d19cbf /src/libstd/num
parente63b2d30775fdb6661cdd2160bf0111371144bc9 (diff)
downloadrust-8ca5caf4d936e3193c81c7e9cfa1c6a99717b14a.tar.gz
rust-8ca5caf4d936e3193c81c7e9cfa1c6a99717b14a.zip
num: rm wrapping of `Float` methods as functions
The `Float` trait methods will be usable as functions via UFCS, and
we came to a consensus to remove duplicate functions like this a long
time ago.

It does still make sense to keep the duplicate functions when the trait
methods are static, unless the decision to leave out the in-scope trait
name resolution for static methods changes.
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/mod.rs73
1 files changed, 0 insertions, 73 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index feff0e7e6c0..2c628112957 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -553,79 +553,6 @@ pub trait Float: Signed + Round + Primitive {
     fn to_radians(&self) -> Self;
 }
 
-/// Returns the exponential of the number, minus `1`, `exp(n) - 1`, in a way
-/// that is accurate even if the number is close to zero.
-#[inline(always)] pub fn exp_m1<T: Float>(value: T) -> T { value.exp_m1() }
-/// Returns the natural logarithm of the number plus `1`, `ln(n + 1)`, more
-/// accurately than if the operations were performed separately.
-#[inline(always)] pub fn ln_1p<T: Float>(value: T) -> T { value.ln_1p() }
-/// Fused multiply-add. Computes `(a * b) + c` with only one rounding error.
-///
-/// This produces a more accurate result with better performance (on some
-/// architectures) than a separate multiplication operation followed by an add.
-#[inline(always)] pub fn mul_add<T: Float>(a: T, b: T, c: T) -> T { a.mul_add(b, c) }
-
-/// Raise a number to a power.
-///
-/// # Example
-///
-/// ```rust
-/// use std::num;
-///
-/// let sixteen: f64 = num::powf(2.0, 4.0);
-/// assert_eq!(sixteen, 16.0);
-/// ```
-#[inline(always)] pub fn powf<T: Float>(value: T, n: T) -> T { value.powf(&n) }
-/// Take the square root of a number.
-#[inline(always)] pub fn sqrt<T: Float>(value: T) -> T { value.sqrt() }
-/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
-#[inline(always)] pub fn rsqrt<T: Float>(value: T) -> T { value.rsqrt() }
-/// Take the cubic root of a number.
-#[inline(always)] pub fn cbrt<T: Float>(value: T) -> T { value.cbrt() }
-/// Calculate the length of the hypotenuse of a right-angle triangle given legs
-/// of length `x` and `y`.
-#[inline(always)] pub fn hypot<T: Float>(x: T, y: T) -> T { x.hypot(&y) }
-/// Sine function.
-#[inline(always)] pub fn sin<T: Float>(value: T) -> T { value.sin() }
-/// Cosine function.
-#[inline(always)] pub fn cos<T: Float>(value: T) -> T { value.cos() }
-/// Tangent function.
-#[inline(always)] pub fn tan<T: Float>(value: T) -> T { value.tan() }
-/// Compute the arcsine of the number.
-#[inline(always)] pub fn asin<T: Float>(value: T) -> T { value.asin() }
-/// Compute the arccosine of the number.
-#[inline(always)] pub fn acos<T: Float>(value: T) -> T { value.acos() }
-/// Compute the arctangent of the number.
-#[inline(always)] pub fn atan<T: Float>(value: T) -> T { value.atan() }
-/// Compute the arctangent with 2 arguments.
-#[inline(always)] pub fn atan2<T: Float>(x: T, y: T) -> T { x.atan2(&y) }
-/// Simultaneously computes the sine and cosine of the number.
-#[inline(always)] pub fn sin_cos<T: Float>(value: T) -> (T, T) { value.sin_cos() }
-/// Returns `e^(value)`, (the exponential function).
-#[inline(always)] pub fn exp<T: Float>(value: T) -> T { value.exp() }
-/// Returns 2 raised to the power of the number, `2^(value)`.
-#[inline(always)] pub fn exp2<T: Float>(value: T) -> T { value.exp2() }
-/// Returns the natural logarithm of the number.
-#[inline(always)] pub fn ln<T: Float>(value: T) -> T { value.ln() }
-/// Returns the logarithm of the number with respect to an arbitrary base.
-#[inline(always)] pub fn log<T: Float>(value: T, base: T) -> T { value.log(&base) }
-/// Returns the base 2 logarithm of the number.
-#[inline(always)] pub fn log2<T: Float>(value: T) -> T { value.log2() }
-/// Returns the base 10 logarithm of the number.
-#[inline(always)] pub fn log10<T: Float>(value: T) -> T { value.log10() }
-/// Hyperbolic sine function.
-#[inline(always)] pub fn sinh<T: Float>(value: T) -> T { value.sinh() }
-/// Hyperbolic cosine function.
-#[inline(always)] pub fn cosh<T: Float>(value: T) -> T { value.cosh() }
-/// Hyperbolic tangent function.
-#[inline(always)] pub fn tanh<T: Float>(value: T) -> T { value.tanh() }
-/// Inverse hyperbolic sine function.
-#[inline(always)] pub fn asinh<T: Float>(value: T) -> T { value.asinh() }
-/// Inverse hyperbolic cosine function.
-#[inline(always)] pub fn acosh<T: Float>(value: T) -> T { value.acosh() }
-/// Inverse hyperbolic tangent function.
-#[inline(always)] pub fn atanh<T: Float>(value: T) -> T { value.atanh() }
-
 /// A generic trait for converting a value to a number.
 pub trait ToPrimitive {
     /// Converts the value of `self` to an `int`.