mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-21 20:17:55 +00:00
Rename EXP_MAX
to EXP_SAT
"Maximum" is technically correct here with regards to what the bitpattern can represent, but it is not the numeric maximum value of the exponent which has a relationship with the bias. So, replace the maximum terminology with "saturated" to indicate it only means the full bitpattern. This change is more relevant to `libm` than `compiler-builtins`.
This commit is contained in:
parent
b47d3cc2f8
commit
7065cd0420
@ -14,7 +14,7 @@ where
|
||||
|
||||
let bits = F::BITS.cast();
|
||||
let significand_bits = F::SIG_BITS;
|
||||
let max_exponent = F::EXP_MAX;
|
||||
let max_exponent = F::EXP_SAT;
|
||||
|
||||
let implicit_bit = F::IMPLICIT_BIT;
|
||||
let significand_mask = F::SIG_MASK;
|
||||
|
@ -107,7 +107,7 @@ where
|
||||
|
||||
let significand_bits = F::SIG_BITS;
|
||||
// Saturated exponent, representing infinity
|
||||
let exponent_sat: F::Int = F::EXP_MAX.cast();
|
||||
let exponent_sat: F::Int = F::EXP_SAT.cast();
|
||||
|
||||
let exponent_bias = F::EXP_BIAS;
|
||||
let implicit_bit = F::IMPLICIT_BIT;
|
||||
|
@ -26,7 +26,7 @@ where
|
||||
|
||||
let dst_bits = R::BITS;
|
||||
let dst_sign_bits = R::SIG_BITS;
|
||||
let dst_inf_exp = R::EXP_MAX;
|
||||
let dst_inf_exp = R::EXP_SAT;
|
||||
let dst_exp_bias = R::EXP_BIAS;
|
||||
let dst_min_normal = R::IMPLICIT_BIT;
|
||||
|
||||
|
@ -51,11 +51,14 @@ pub(crate) trait Float:
|
||||
/// The bitwidth of the exponent.
|
||||
const EXP_BITS: u32 = Self::BITS - Self::SIG_BITS - 1;
|
||||
|
||||
/// The saturated value of the exponent (infinite representation), in the rightmost postiion.
|
||||
const EXP_MAX: u32 = (1 << Self::EXP_BITS) - 1;
|
||||
/// The saturated (maximum bitpattern) value of the exponent, i.e. the infinite
|
||||
/// representation.
|
||||
///
|
||||
/// This is in the rightmost position, use `EXP_MASK` for the shifted value.
|
||||
const EXP_SAT: u32 = (1 << Self::EXP_BITS) - 1;
|
||||
|
||||
/// The exponent bias value.
|
||||
const EXP_BIAS: u32 = Self::EXP_MAX >> 1;
|
||||
const EXP_BIAS: u32 = Self::EXP_SAT >> 1;
|
||||
|
||||
/// A mask for the sign bit.
|
||||
const SIGN_MASK: Self::Int;
|
||||
|
@ -14,7 +14,7 @@ where
|
||||
|
||||
let bits = F::BITS;
|
||||
let significand_bits = F::SIG_BITS;
|
||||
let max_exponent = F::EXP_MAX;
|
||||
let max_exponent = F::EXP_SAT;
|
||||
|
||||
let exponent_bias = F::EXP_BIAS;
|
||||
|
||||
|
@ -29,7 +29,7 @@ where
|
||||
let dst_zero = R::Int::ZERO;
|
||||
let dst_one = R::Int::ONE;
|
||||
let dst_bits = R::BITS;
|
||||
let dst_inf_exp = R::EXP_MAX;
|
||||
let dst_inf_exp = R::EXP_SAT;
|
||||
let dst_exp_bias = R::EXP_BIAS;
|
||||
|
||||
let underflow_exponent: F::Int = (src_exp_bias + 1 - dst_exp_bias).cast();
|
||||
|
Loading…
Reference in New Issue
Block a user