File tree Expand file tree Collapse file tree 6 files changed +11
-8
lines changed Expand file tree Collapse file tree 6 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1414
1515 let bits = F :: BITS . cast ( ) ;
1616 let significand_bits = F :: SIG_BITS ;
17- let max_exponent = F :: EXP_MAX ;
17+ let max_exponent = F :: EXP_SAT ;
1818
1919 let implicit_bit = F :: IMPLICIT_BIT ;
2020 let significand_mask = F :: SIG_MASK ;
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ where
107107
108108 let significand_bits = F :: SIG_BITS ;
109109 // Saturated exponent, representing infinity
110- let exponent_sat: F :: Int = F :: EXP_MAX . cast ( ) ;
110+ let exponent_sat: F :: Int = F :: EXP_SAT . cast ( ) ;
111111
112112 let exponent_bias = F :: EXP_BIAS ;
113113 let implicit_bit = F :: IMPLICIT_BIT ;
Original file line number Diff line number Diff line change 2626
2727 let dst_bits = R :: BITS ;
2828 let dst_sign_bits = R :: SIG_BITS ;
29- let dst_inf_exp = R :: EXP_MAX ;
29+ let dst_inf_exp = R :: EXP_SAT ;
3030 let dst_exp_bias = R :: EXP_BIAS ;
3131 let dst_min_normal = R :: IMPLICIT_BIT ;
3232
Original file line number Diff line number Diff line change @@ -51,11 +51,14 @@ pub(crate) trait Float:
5151 /// The bitwidth of the exponent.
5252 const EXP_BITS : u32 = Self :: BITS - Self :: SIG_BITS - 1 ;
5353
54- /// The saturated value of the exponent (infinite representation), in the rightmost postiion.
55- const EXP_MAX : u32 = ( 1 << Self :: EXP_BITS ) - 1 ;
54+ /// The saturated (maximum bitpattern) value of the exponent, i.e. the infinite
55+ /// representation.
56+ ///
57+ /// This is in the rightmost position, use `EXP_MASK` for the shifted value.
58+ const EXP_SAT : u32 = ( 1 << Self :: EXP_BITS ) - 1 ;
5659
5760 /// The exponent bias value.
58- const EXP_BIAS : u32 = Self :: EXP_MAX >> 1 ;
61+ const EXP_BIAS : u32 = Self :: EXP_SAT >> 1 ;
5962
6063 /// A mask for the sign bit.
6164 const SIGN_MASK : Self :: Int ;
Original file line number Diff line number Diff line change 1414
1515 let bits = F :: BITS ;
1616 let significand_bits = F :: SIG_BITS ;
17- let max_exponent = F :: EXP_MAX ;
17+ let max_exponent = F :: EXP_SAT ;
1818
1919 let exponent_bias = F :: EXP_BIAS ;
2020
Original file line number Diff line number Diff line change 2929 let dst_zero = R :: Int :: ZERO ;
3030 let dst_one = R :: Int :: ONE ;
3131 let dst_bits = R :: BITS ;
32- let dst_inf_exp = R :: EXP_MAX ;
32+ let dst_inf_exp = R :: EXP_SAT ;
3333 let dst_exp_bias = R :: EXP_BIAS ;
3434
3535 let underflow_exponent: F :: Int = ( src_exp_bias + 1 - dst_exp_bias) . cast ( ) ;
You can’t perform that action at this time.
0 commit comments