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 14
14
15
15
let bits = F :: BITS . cast ( ) ;
16
16
let significand_bits = F :: SIG_BITS ;
17
- let max_exponent = F :: EXP_MAX ;
17
+ let max_exponent = F :: EXP_SAT ;
18
18
19
19
let implicit_bit = F :: IMPLICIT_BIT ;
20
20
let significand_mask = F :: SIG_MASK ;
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ where
107
107
108
108
let significand_bits = F :: SIG_BITS ;
109
109
// Saturated exponent, representing infinity
110
- let exponent_sat: F :: Int = F :: EXP_MAX . cast ( ) ;
110
+ let exponent_sat: F :: Int = F :: EXP_SAT . cast ( ) ;
111
111
112
112
let exponent_bias = F :: EXP_BIAS ;
113
113
let implicit_bit = F :: IMPLICIT_BIT ;
Original file line number Diff line number Diff line change 26
26
27
27
let dst_bits = R :: BITS ;
28
28
let dst_sign_bits = R :: SIG_BITS ;
29
- let dst_inf_exp = R :: EXP_MAX ;
29
+ let dst_inf_exp = R :: EXP_SAT ;
30
30
let dst_exp_bias = R :: EXP_BIAS ;
31
31
let dst_min_normal = R :: IMPLICIT_BIT ;
32
32
Original file line number Diff line number Diff line change @@ -51,11 +51,14 @@ pub(crate) trait Float:
51
51
/// The bitwidth of the exponent.
52
52
const EXP_BITS : u32 = Self :: BITS - Self :: SIG_BITS - 1 ;
53
53
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 ;
56
59
57
60
/// The exponent bias value.
58
- const EXP_BIAS : u32 = Self :: EXP_MAX >> 1 ;
61
+ const EXP_BIAS : u32 = Self :: EXP_SAT >> 1 ;
59
62
60
63
/// A mask for the sign bit.
61
64
const SIGN_MASK : Self :: Int ;
Original file line number Diff line number Diff line change 14
14
15
15
let bits = F :: BITS ;
16
16
let significand_bits = F :: SIG_BITS ;
17
- let max_exponent = F :: EXP_MAX ;
17
+ let max_exponent = F :: EXP_SAT ;
18
18
19
19
let exponent_bias = F :: EXP_BIAS ;
20
20
Original file line number Diff line number Diff line change 29
29
let dst_zero = R :: Int :: ZERO ;
30
30
let dst_one = R :: Int :: ONE ;
31
31
let dst_bits = R :: BITS ;
32
- let dst_inf_exp = R :: EXP_MAX ;
32
+ let dst_inf_exp = R :: EXP_SAT ;
33
33
let dst_exp_bias = R :: EXP_BIAS ;
34
34
35
35
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