@@ -43,11 +43,11 @@ pub trait One {
43
43
}
44
44
45
45
pub trait Round {
46
- pure fn round ( & self , mode : RoundMode ) -> self ;
46
+ pure fn round ( & self , mode : RoundMode ) -> Self ;
47
47
48
- pure fn floor ( & self ) -> self ;
49
- pure fn ceil ( & self ) -> self ;
50
- pure fn fract ( & self ) -> self ;
48
+ pure fn floor ( & self ) -> Self ;
49
+ pure fn ceil ( & self ) -> Self ;
50
+ pure fn fract ( & self ) -> Self ;
51
51
}
52
52
53
53
pub enum RoundMode {
@@ -62,7 +62,7 @@ pub trait ToStrRadix {
62
62
}
63
63
64
64
pub trait FromStrRadix {
65
- static pub pure fn from_str_radix ( str : & str , radix : uint ) -> Option <self >;
65
+ static pub pure fn from_str_radix ( str : & str , radix : uint ) -> Option < Self > ;
66
66
}
67
67
68
68
// Generic math functions:
@@ -135,7 +135,8 @@ pub pure fn is_neg_zero<T: Num One Zero Eq>(num: &T) -> bool {
135
135
* - If code written to use this function doesn't care about it, it's
136
136
* probably assuming that `x^0` always equals `1`.
137
137
*/
138
- pub pure fn pow_with_uint < T : Num One Zero > ( radix : uint , pow : uint ) -> T {
138
+ pub pure fn pow_with_uint < T : Num One Zero Copy > ( radix : uint ,
139
+ pow : uint ) -> T {
139
140
let _0: T = Zero :: zero ( ) ;
140
141
let _1: T = One :: one ( ) ;
141
142
@@ -220,11 +221,11 @@ pub pure fn to_str_bytes_common<T: Num Zero One Eq Ord Round Copy>(
220
221
num : & T , radix : uint , special : bool , negative_zero : bool ,
221
222
sign : SignFormat , digits : SignificantDigits ) -> ( ~[ u8 ] , bool ) {
222
223
if radix as int < 2 {
223
- fail fmt ! ( "to_str_bytes_common: radix %? to low, \
224
- must lie in the range [2, 36]", radix) ;
224
+ die ! ( fmt!( "to_str_bytes_common: radix %? to low, \
225
+ must lie in the range [2, 36]", radix) ) ;
225
226
} else if radix as int > 36 {
226
- fail fmt ! ( "to_str_bytes_common: radix %? to high, \
227
- must lie in the range [2, 36]", radix) ;
227
+ die ! ( fmt!( "to_str_bytes_common: radix %? to high, \
228
+ must lie in the range [2, 36]", radix) ) ;
228
229
}
229
230
230
231
let _0: T = Zero :: zero ( ) ;
@@ -499,20 +500,20 @@ pub pure fn from_str_bytes_common<T: Num Zero One Ord Copy>(
499
500
) -> Option < T > {
500
501
match exponent {
501
502
ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e'
502
- => fail fmt ! ( "from_str_bytes_common: radix %? incompatible with \
503
- use of 'e' as decimal exponent", radix) ,
503
+ => die ! ( fmt!( "from_str_bytes_common: radix %? incompatible with \
504
+ use of 'e' as decimal exponent", radix) ) ,
504
505
ExpBin if radix >= DIGIT_P_RADIX // binary exponent 'p'
505
- => fail fmt ! ( "from_str_bytes_common: radix %? incompatible with \
506
- use of 'p' as binary exponent", radix) ,
506
+ => die ! ( fmt!( "from_str_bytes_common: radix %? incompatible with \
507
+ use of 'p' as binary exponent", radix) ) ,
507
508
_ if special && radix >= DIGIT_I_RADIX // first digit of 'inf'
508
- => fail fmt ! ( "from_str_bytes_common: radix %? incompatible with \
509
- special values 'inf' and 'NaN'", radix) ,
509
+ => die ! ( fmt!( "from_str_bytes_common: radix %? incompatible with \
510
+ special values 'inf' and 'NaN'", radix) ) ,
510
511
_ if radix as int < 2
511
- => fail fmt ! ( "from_str_bytes_common: radix %? to low, \
512
- must lie in the range [2, 36]", radix) ,
512
+ => die ! ( fmt!( "from_str_bytes_common: radix %? to low, \
513
+ must lie in the range [2, 36]", radix) ) ,
513
514
_ if radix as int > 36
514
- => fail fmt ! ( "from_str_bytes_common: radix %? to high, \
515
- must lie in the range [2, 36]", radix) ,
515
+ => die ! ( fmt!( "from_str_bytes_common: radix %? to high, \
516
+ must lie in the range [2, 36]", radix) ) ,
516
517
_ => ( )
517
518
}
518
519
0 commit comments