diff options
| author | Jyun-Yan You <jyyou@cs.nctu.edu.tw> | 2012-09-05 02:03:56 +0800 |
|---|---|---|
| committer | Jyun-Yan You <jyyou@cs.nctu.edu.tw> | 2012-09-05 02:03:56 +0800 |
| commit | ff4b754958cc3acc32dcb9231aafceff692a4f95 (patch) | |
| tree | 018ea20d4e81331423abd59294b7e3b454d57d5b /src/libcore | |
| parent | 147e9380e270ae8c27d241837251f14b33596450 (diff) | |
| download | rust-ff4b754958cc3acc32dcb9231aafceff692a4f95.tar.gz rust-ff4b754958cc3acc32dcb9231aafceff692a4f95.zip | |
use native log2 function and enable freebsd tests in uv_ll
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cmath.rs | 6 | ||||
| -rw-r--r-- | src/libcore/f32.rs | 15 | ||||
| -rw-r--r-- | src/libcore/f64.rs | 15 |
3 files changed, 0 insertions, 36 deletions
diff --git a/src/libcore/cmath.rs b/src/libcore/cmath.rs index 29dff86b237..7225fd2ee46 100644 --- a/src/libcore/cmath.rs +++ b/src/libcore/cmath.rs @@ -65,9 +65,6 @@ extern mod c_double { // renamed: to be consitent with log as ln #[link_name="log1p"] pure fn ln1p(n: c_double) -> c_double; pure fn log10(n: c_double) -> c_double; - #[cfg(target_os="linux")] - #[cfg(target_os="macos")] - #[cfg(target_os="win32")] pure fn log2(n: c_double) -> c_double; #[link_name="ilogb"] pure fn ilog_radix(n: c_double) -> c_int; pure fn modf(n: c_double, &iptr: c_double) -> c_double; @@ -143,9 +140,6 @@ extern mod c_float { #[link_name="logf"] pure fn ln(n: c_float) -> c_float; #[link_name="logbf"] pure fn log_radix(n: c_float) -> c_float; #[link_name="log1pf"] pure fn ln1p(n: c_float) -> c_float; - #[cfg(target_os="linux")] - #[cfg(target_os="macos")] - #[cfg(target_os="win32")] #[link_name="log2f"] pure fn log2(n: c_float) -> c_float; #[link_name="log10f"] pure fn log10(n: c_float) -> c_float; #[link_name="ilogbf"] pure fn ilog_radix(n: c_float) -> c_int; diff --git a/src/libcore/f32.rs b/src/libcore/f32.rs index e1cf9946284..991b6d9d5f0 100644 --- a/src/libcore/f32.rs +++ b/src/libcore/f32.rs @@ -152,25 +152,10 @@ pure fn signbit(x: f32) -> int { if is_negative(x) { return 1; } else { return 0; } } -#[cfg(target_os="linux")] -#[cfg(target_os="macos")] -#[cfg(target_os="win32")] pure fn logarithm(n: f32, b: f32) -> f32 { return log2(n) / log2(b); } -#[cfg(target_os="freebsd")] -pure fn logarithm(n: f32, b: f32) -> f32 { - // FIXME (#2000): check if it is good to use log2 instead of ln here; - // in theory should be faster since the radix is 2 - return ln(n) / ln(b); -} - -#[cfg(target_os="freebsd")] -pure fn log2(n: f32) -> f32 { - return ln(n) / consts::ln_2; -} - impl f32: num::Num { pure fn add(&&other: f32) -> f32 { return self + other; } pure fn sub(&&other: f32) -> f32 { return self - other; } diff --git a/src/libcore/f64.rs b/src/libcore/f64.rs index 3abfd44e838..8ae40b355d5 100644 --- a/src/libcore/f64.rs +++ b/src/libcore/f64.rs @@ -179,25 +179,10 @@ pure fn signbit(x: f64) -> int { if is_negative(x) { return 1; } else { return 0; } } -#[cfg(target_os="linux")] -#[cfg(target_os="macos")] -#[cfg(target_os="win32")] pure fn logarithm(n: f64, b: f64) -> f64 { return log2(n) / log2(b); } -#[cfg(target_os="freebsd")] -pure fn logarithm(n: f64, b: f64) -> f64 { - // FIXME (#2000): check if it is good to use log2 instead of ln here; in - // theory should be faster since the radix is 2 - return ln(n) / ln(b); -} - -#[cfg(target_os="freebsd")] -pure fn log2(n: f64) -> f64 { - return ln(n) / consts::ln_2; -} - impl f64: num::Num { pure fn add(&&other: f64) -> f64 { return self + other; } pure fn sub(&&other: f64) -> f64 { return self - other; } |
