@@ -910,12 +910,12 @@ impl_to_primitive_uint! { u32 }
910
910
impl_to_primitive_uint ! { u64 }
911
911
912
912
macro_rules! impl_to_primitive_float_to_float {
913
- ( $SrcT: ty , $DstT: ty , $slf: expr) => (
913
+ ( $SrcT: ident , $DstT: ident , $slf: expr) => (
914
914
if size_of:: <$SrcT>( ) <= size_of:: <$DstT>( ) {
915
915
Some ( $slf as $DstT)
916
916
} else {
917
917
let n = $slf as f64 ;
918
- let max_value: $SrcT = Float :: max_value ( ) ;
918
+ let max_value: $SrcT = :: $SrcT :: MAX_VALUE ;
919
919
if -max_value as f64 <= n && n <= max_value as f64 {
920
920
Some ( $slf as $DstT)
921
921
} else {
@@ -926,7 +926,7 @@ macro_rules! impl_to_primitive_float_to_float {
926
926
}
927
927
928
928
macro_rules! impl_to_primitive_float {
929
- ( $T: ty ) => (
929
+ ( $T: ident ) => (
930
930
impl ToPrimitive for $T {
931
931
#[ inline]
932
932
fn to_int( & self ) -> Option <int> { Some ( * self as int) }
@@ -1251,24 +1251,34 @@ pub trait Float
1251
1251
// FIXME (#5527): These should be associated constants
1252
1252
1253
1253
/// Returns the number of binary digits of mantissa that this type supports.
1254
+ #[ deprecated = "use `std::f32::MANTISSA_DIGITS` or `std::f64::MANTISSA_DIGITS` as appropriate" ]
1254
1255
fn mantissa_digits ( unused_self : Option < Self > ) -> uint ;
1255
1256
/// Returns the number of base-10 digits of precision that this type supports.
1257
+ #[ deprecated = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate" ]
1256
1258
fn digits ( unused_self : Option < Self > ) -> uint ;
1257
1259
/// Returns the difference between 1.0 and the smallest representable number larger than 1.0.
1260
+ #[ deprecated = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate" ]
1258
1261
fn epsilon ( ) -> Self ;
1259
1262
/// Returns the minimum binary exponent that this type can represent.
1263
+ #[ deprecated = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate" ]
1260
1264
fn min_exp ( unused_self : Option < Self > ) -> int ;
1261
1265
/// Returns the maximum binary exponent that this type can represent.
1266
+ #[ deprecated = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate" ]
1262
1267
fn max_exp ( unused_self : Option < Self > ) -> int ;
1263
1268
/// Returns the minimum base-10 exponent that this type can represent.
1269
+ #[ deprecated = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate" ]
1264
1270
fn min_10_exp ( unused_self : Option < Self > ) -> int ;
1265
1271
/// Returns the maximum base-10 exponent that this type can represent.
1272
+ #[ deprecated = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate" ]
1266
1273
fn max_10_exp ( unused_self : Option < Self > ) -> int ;
1267
1274
/// Returns the smallest finite value that this type can represent.
1275
+ #[ deprecated = "use `std::f32::MIN_VALUE` or `std::f64::MIN_VALUE` as appropriate" ]
1268
1276
fn min_value ( ) -> Self ;
1269
1277
/// Returns the smallest normalized positive number that this type can represent.
1278
+ #[ deprecated = "use `std::f32::MIN_POS_VALUE` or `std::f64::MIN_POS_VALUE` as appropriate" ]
1270
1279
fn min_pos_value ( unused_self : Option < Self > ) -> Self ;
1271
1280
/// Returns the largest finite value that this type can represent.
1281
+ #[ deprecated = "use `std::f32::MAX_VALUE` or `std::f64::MAX_VALUE` as appropriate" ]
1272
1282
fn max_value ( ) -> Self ;
1273
1283
1274
1284
/// Returns true if this value is NaN and false otherwise.
0 commit comments