Skip to content

Commit

Permalink
Remove RealExt
Browse files Browse the repository at this point in the history
These functions are of little utility outside a small subset of use cases. If people need them for their own projects then they can use their own bindings for libm (which aren't hard to make).
  • Loading branch information
brendanzab committed Jan 12, 2014
1 parent 0091a15 commit 1246f0b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 49 deletions.
32 changes: 1 addition & 31 deletions src/libstd/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use cmath::c_double_utils;
use default::Default;
use libc::{c_double, c_int};
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
use num::{Zero, One, RealExt, strconv};
use num::{Zero, One, strconv};
use num;
use to_str;
use unstable::intrinsics;
Expand Down Expand Up @@ -560,36 +560,6 @@ impl Real for f64 {
}
}

impl RealExt for f64 {
#[inline]
fn lgamma(&self) -> (int, f64) {
let mut sign = 0;
let result = lgamma(*self, &mut sign);
(sign as int, result)
}

#[inline]
fn tgamma(&self) -> f64 { tgamma(*self) }

#[inline]
fn j0(&self) -> f64 { j0(*self) }

#[inline]
fn j1(&self) -> f64 { j1(*self) }

#[inline]
fn jn(&self, n: int) -> f64 { jn(n as c_int, *self) }

#[inline]
fn y0(&self) -> f64 { y0(*self) }

#[inline]
fn y1(&self) -> f64 { y1(*self) }

#[inline]
fn yn(&self, n: int) -> f64 { yn(n as c_int, *self) }
}

impl Bounded for f64 {
#[inline]
fn min_value() -> f64 { 2.2250738585072014e-308 }
Expand Down
18 changes: 0 additions & 18 deletions src/libstd/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,24 +324,6 @@ pub trait Real: Signed
/// Inverse hyperbolic tangent function.
#[inline(always)] pub fn atanh<T: Real>(value: T) -> T { value.atanh() }

/// Methods that are harder to implement and not commonly used.
pub trait RealExt: Real {
// FIXME (#5527): usages of `int` should be replaced with an associated
// integer type once these are implemented

// Gamma functions
fn lgamma(&self) -> (int, Self);
fn tgamma(&self) -> Self;

// Bessel functions
fn j0(&self) -> Self;
fn j1(&self) -> Self;
fn jn(&self, n: int) -> Self;
fn y0(&self) -> Self;
fn y1(&self) -> Self;
fn yn(&self, n: int) -> Self;
}

/// Collects the bitwise operators under one trait.
pub trait Bitwise: Not<Self>
+ BitAnd<Self,Self>
Expand Down

0 comments on commit 1246f0b

Please sign in to comment.