aboutsummaryrefslogtreecommitdiff
path: root/libcore/num
diff options
context:
space:
mode:
authorpravic <[email protected]>2016-04-29 21:26:11 +0300
committerpravic <[email protected]>2016-04-29 21:26:11 +0300
commit676cada527e5723dba925685822baee34bc5ec2f (patch)
treedf0fb7476a440a939f3d9129c0633c372d88e9cb /libcore/num
parentupdate libcore to 2016-04-29 nightly (diff)
parentapply libcore_nofp patch (diff)
downloadkmd-env-rs-676cada527e5723dba925685822baee34bc5ec2f.tar.xz
kmd-env-rs-676cada527e5723dba925685822baee34bc5ec2f.zip
Merge branch 'libcore'
Diffstat (limited to 'libcore/num')
-rw-r--r--libcore/num/flt2dec/decoder.rs3
-rw-r--r--libcore/num/mod.rs9
2 files changed, 12 insertions, 0 deletions
diff --git a/libcore/num/flt2dec/decoder.rs b/libcore/num/flt2dec/decoder.rs
index 6265691..0a28a14 100644
--- a/libcore/num/flt2dec/decoder.rs
+++ b/libcore/num/flt2dec/decoder.rs
@@ -12,6 +12,7 @@
use prelude::v1::*;
+#[cfg(not(disable_float))]
use {f32, f64};
use num::{Float, FpCategory};
@@ -57,10 +58,12 @@ pub trait DecodableFloat: Float + Copy {
fn min_pos_norm_value() -> Self;
}
+#[cfg(not(disable_float))]
impl DecodableFloat for f32 {
fn min_pos_norm_value() -> Self { f32::MIN_POSITIVE }
}
+#[cfg(not(disable_float))]
impl DecodableFloat for f64 {
fn min_pos_norm_value() -> Self { f64::MIN_POSITIVE }
}
diff --git a/libcore/num/mod.rs b/libcore/num/mod.rs
index 589ac90..e5f0469 100644
--- a/libcore/num/mod.rs
+++ b/libcore/num/mod.rs
@@ -58,7 +58,9 @@ impl<T: fmt::Display> fmt::Display for Wrapping<T> {
mod wrapping;
// All these modules are technically private and only exposed for libcoretest:
+#[cfg(not(disable_float))]
pub mod flt2dec;
+#[cfg(not(disable_float))]
pub mod dec2flt;
pub mod bignum;
pub mod diy_float;
@@ -125,6 +127,7 @@ macro_rules! zero_one_impl_float {
}
)*)
}
+#[cfg(not(disable_float))]
zero_one_impl_float! { f32 f64 }
macro_rules! checked_op {
@@ -2239,6 +2242,7 @@ pub enum FpCategory {
#[unstable(feature = "core_float",
reason = "stable interface is via `impl f{32,64}` in later crates",
issue = "32110")]
+#[cfg(not(disable_float))]
pub trait Float: Sized {
/// Returns the NaN value.
#[unstable(feature = "float_extras", reason = "needs removal",
@@ -2477,6 +2481,7 @@ impl fmt::Display for ParseIntError {
}
#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg(not(disable_float))]
pub use num::dec2flt::ParseFloatError;
// Conversion traits for primitive integer and float types
@@ -2524,6 +2529,9 @@ impl_from! { u32, i64 }
// they fit in the significand, which is 24 bits in f32 and 53 bits in f64.
// Lossy float conversions are not implemented at this time.
+#[cfg(not(disable_float))]
+mod _int_flot_conv {
+use convert::From;
// Signed -> Float
impl_from! { i8, f32 }
impl_from! { i8, f64 }
@@ -2540,3 +2548,4 @@ impl_from! { u32, f64 }
// Float -> Float
impl_from! { f32, f64 }
+}