@@ -33,7 +33,7 @@ use core::str::FromStr;
33
33
#[ cfg( feature = "std" ) ]
34
34
use std:: error:: Error ;
35
35
36
- #[ cfg( feature = "bigint" ) ]
36
+ #[ cfg( feature = "num- bigint" ) ]
37
37
use num_bigint:: { BigInt , BigUint , Sign , ToBigInt } ;
38
38
39
39
use num_integer:: Integer ;
@@ -63,7 +63,7 @@ pub type Rational32 = Ratio<i32>;
63
63
/// Alias for a `Ratio` of 64-bit-sized integers.
64
64
pub type Rational64 = Ratio < i64 > ;
65
65
66
- #[ cfg( feature = "bigint" ) ]
66
+ #[ cfg( feature = "num- bigint" ) ]
67
67
/// Alias for arbitrary precision rationals.
68
68
pub type BigRational = Ratio < BigInt > ;
69
69
@@ -257,7 +257,7 @@ impl<T: Clone + Integer> Ratio<T> {
257
257
}
258
258
}
259
259
260
- #[ cfg( feature = "bigint" ) ]
260
+ #[ cfg( feature = "num- bigint" ) ]
261
261
impl Ratio < BigInt > {
262
262
/// Converts a float into a rational number.
263
263
pub fn from_float < T : FloatCore > ( f : T ) -> Option < BigRational > {
@@ -1173,7 +1173,7 @@ impl RatioErrorKind {
1173
1173
}
1174
1174
}
1175
1175
1176
- #[ cfg( feature = "bigint" ) ]
1176
+ #[ cfg( feature = "num- bigint" ) ]
1177
1177
impl FromPrimitive for Ratio < BigInt > {
1178
1178
fn from_i64 ( n : i64 ) -> Option < Self > {
1179
1179
Some ( Ratio :: from_integer ( n. into ( ) ) )
@@ -1361,7 +1361,7 @@ where
1361
1361
Some ( Ratio :: new ( n1, d1) )
1362
1362
}
1363
1363
1364
- #[ cfg( not( feature = "bigint" ) ) ]
1364
+ #[ cfg( not( feature = "num- bigint" ) ) ]
1365
1365
macro_rules! to_primitive_small {
1366
1366
( $( $type_name: ty) * ) => ( $(
1367
1367
impl ToPrimitive for Ratio <$type_name> {
@@ -1388,13 +1388,13 @@ macro_rules! to_primitive_small {
1388
1388
) * )
1389
1389
}
1390
1390
1391
- #[ cfg( not( feature = "bigint" ) ) ]
1391
+ #[ cfg( not( feature = "num- bigint" ) ) ]
1392
1392
to_primitive_small ! ( u8 i8 u16 i16 u32 i32 ) ;
1393
1393
1394
- #[ cfg( all( target_pointer_width = "32" , not( feature = "bigint" ) ) ) ]
1394
+ #[ cfg( all( target_pointer_width = "32" , not( feature = "num- bigint" ) ) ) ]
1395
1395
to_primitive_small ! ( usize isize ) ;
1396
1396
1397
- #[ cfg( not( feature = "bigint" ) ) ]
1397
+ #[ cfg( not( feature = "num- bigint" ) ) ]
1398
1398
macro_rules! to_primitive_64 {
1399
1399
( $( $type_name: ty) * ) => ( $(
1400
1400
impl ToPrimitive for Ratio <$type_name> {
@@ -1424,13 +1424,13 @@ macro_rules! to_primitive_64 {
1424
1424
) * )
1425
1425
}
1426
1426
1427
- #[ cfg( not( feature = "bigint" ) ) ]
1427
+ #[ cfg( not( feature = "num- bigint" ) ) ]
1428
1428
to_primitive_64 ! ( u64 i64 ) ;
1429
1429
1430
- #[ cfg( all( target_pointer_width = "64" , not( feature = "bigint" ) ) ) ]
1430
+ #[ cfg( all( target_pointer_width = "64" , not( feature = "num- bigint" ) ) ) ]
1431
1431
to_primitive_64 ! ( usize isize ) ;
1432
1432
1433
- #[ cfg( feature = "bigint" ) ]
1433
+ #[ cfg( feature = "num- bigint" ) ]
1434
1434
impl < T : Clone + Integer + ToPrimitive + ToBigInt > ToPrimitive for Ratio < T > {
1435
1435
fn to_i64 ( & self ) -> Option < i64 > {
1436
1436
self . to_integer ( ) . to_i64 ( )
@@ -1467,7 +1467,7 @@ trait Bits {
1467
1467
fn bits ( & self ) -> u64 ;
1468
1468
}
1469
1469
1470
- #[ cfg( feature = "bigint" ) ]
1470
+ #[ cfg( feature = "num- bigint" ) ]
1471
1471
impl Bits for BigInt {
1472
1472
fn bits ( & self ) -> u64 {
1473
1473
self . bits ( )
@@ -1590,9 +1590,9 @@ fn hash<T: Hash>(x: &T) -> u64 {
1590
1590
1591
1591
#[ cfg( test) ]
1592
1592
mod test {
1593
- #[ cfg( all( feature = "bigint" ) ) ]
1593
+ #[ cfg( all( feature = "num- bigint" ) ) ]
1594
1594
use super :: BigInt ;
1595
- #[ cfg( feature = "bigint" ) ]
1595
+ #[ cfg( feature = "num- bigint" ) ]
1596
1596
use super :: BigRational ;
1597
1597
use super :: { Ratio , Rational , Rational64 } ;
1598
1598
@@ -1676,14 +1676,14 @@ mod test {
1676
1676
denom : 1 ,
1677
1677
} ;
1678
1678
1679
- #[ cfg( feature = "bigint" ) ]
1679
+ #[ cfg( feature = "num- bigint" ) ]
1680
1680
pub fn to_big ( n : Rational ) -> BigRational {
1681
1681
Ratio :: new (
1682
1682
FromPrimitive :: from_isize ( n. numer ) . unwrap ( ) ,
1683
1683
FromPrimitive :: from_isize ( n. denom ) . unwrap ( ) ,
1684
1684
)
1685
1685
}
1686
- #[ cfg( not( feature = "bigint" ) ) ]
1686
+ #[ cfg( not( feature = "num- bigint" ) ) ]
1687
1687
pub fn to_big ( n : Rational ) -> Rational {
1688
1688
Ratio :: new (
1689
1689
FromPrimitive :: from_isize ( n. numer ) . unwrap ( ) ,
@@ -2607,11 +2607,11 @@ mod test {
2607
2607
assert_eq ! ( Pow :: pow( r, & e) , expected) ;
2608
2608
assert_eq ! ( Pow :: pow( & r, e) , expected) ;
2609
2609
assert_eq ! ( Pow :: pow( & r, & e) , expected) ;
2610
- #[ cfg( feature = "bigint" ) ]
2610
+ #[ cfg( feature = "num- bigint" ) ]
2611
2611
test_big ( r, e, expected) ;
2612
2612
}
2613
2613
2614
- #[ cfg( feature = "bigint" ) ]
2614
+ #[ cfg( feature = "num- bigint" ) ]
2615
2615
fn test_big ( r : Rational , e : i32 , expected : Rational ) {
2616
2616
let r = BigRational :: new_raw ( r. numer . into ( ) , r. denom . into ( ) ) ;
2617
2617
let expected = BigRational :: new_raw ( expected. numer . into ( ) , expected. denom . into ( ) ) ;
@@ -2662,7 +2662,7 @@ mod test {
2662
2662
}
2663
2663
}
2664
2664
2665
- #[ cfg( feature = "bigint" ) ]
2665
+ #[ cfg( feature = "num- bigint" ) ]
2666
2666
#[ test]
2667
2667
fn test_from_float ( ) {
2668
2668
use num_traits:: float:: FloatCore ;
@@ -2709,7 +2709,7 @@ mod test {
2709
2709
) ;
2710
2710
}
2711
2711
2712
- #[ cfg( feature = "bigint" ) ]
2712
+ #[ cfg( feature = "num- bigint" ) ]
2713
2713
#[ test]
2714
2714
fn test_from_float_fail ( ) {
2715
2715
use core:: { f32, f64} ;
@@ -2870,7 +2870,7 @@ mod test {
2870
2870
}
2871
2871
2872
2872
#[ test]
2873
- #[ cfg( feature = "bigint" ) ]
2873
+ #[ cfg( feature = "num- bigint" ) ]
2874
2874
fn test_ratio_to_i128 ( ) {
2875
2875
assert_eq ! (
2876
2876
1i128 << 70 ,
@@ -2881,7 +2881,7 @@ mod test {
2881
2881
}
2882
2882
2883
2883
#[ test]
2884
- #[ cfg( feature = "bigint" ) ]
2884
+ #[ cfg( feature = "num- bigint" ) ]
2885
2885
fn test_big_ratio_to_f64 ( ) {
2886
2886
assert_eq ! (
2887
2887
BigRational :: new(
0 commit comments