Program Rust
Dec2flt_modelNumImpTraitsFloatU32
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
238 }239 }240 241 impl Float for f32 {242 type Int = u32;243 244 const INFINITY: Self = f32::INFINITY;245 const NEG_INFINITY: Self = f32::NEG_INFINITY;246 const NAN: Self = f32::NAN;247 // Bit-identical to the upstream `-f32::NAN`, without the unsupported248 // compile-time float negation.249 const NEG_NAN: Self = f32::from_bits(0xFFC0_0000);250 251 const BITS: u32 = 32;252 const SIG_TOTAL_BITS: u32 = Self::MANTISSA_DIGITS;253 const EXP_MASK: Self::Int = Self::EXPONENT_MASK;254 const SIG_MASK: Self::Int = Self::MANTISSA_MASK;255 256 const MIN_EXPONENT_ROUND_TO_EVEN: i32 = -17;257 const MAX_EXPONENT_ROUND_TO_EVEN: i32 = 10;258 // Exact value of trunc(128 / log2(10)) from the upstream default.259 const LARGEST_POWER_OF_TEN: i32 = 38;260 const SMALLEST_POWER_OF_TEN: i32 = -65;261 262 fn to_bits(self) -> Self::Int {263 self.to_bits()264 }265 266 fn classify(self) -> FpCategory {267 self.classify()268 }269 }270 271 impl FloatExt for f32 {272 #[inline]Aeneas declaration
The Lean below was mechanically extracted by Aeneas from Rust.
@[reducible]
impl_def F32.Insts.Dec2flt_modelNumImpTraitsFloatU32 : num.imp.traits.Float F32
Std.U32 := {
INFINITY := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.INFINITY
NEG_INFINITY := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.NEG_INFINITY
NAN := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.NAN
NEG_NAN := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.NEG_NAN
BITS := ok F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.BITS
SIG_TOTAL_BITS := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.SIG_TOTAL_BITS
EXP_MASK := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.EXP_MASK
SIG_MASK := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.SIG_MASK
SIG_BITS := num.imp.traits.Float.SIG_BITS.default
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32
EXP_BITS := num.imp.traits.Float.EXP_BITS.default
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32
EXP_SAT := num.imp.traits.Float.EXP_SAT.default
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32
INFINITE_POWER := num.imp.traits.Float.INFINITE_POWER.default
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32
EXP_BIAS := num.imp.traits.Float.EXP_BIAS.default
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32
EXP_MIN := num.imp.traits.Float.EXP_MIN.default
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32
MIN_EXPONENT_ROUND_TO_EVEN := ok
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.MIN_EXPONENT_ROUND_TO_EVEN
MAX_EXPONENT_ROUND_TO_EVEN := ok
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.MAX_EXPONENT_ROUND_TO_EVEN
LARGEST_POWER_OF_TEN := ok
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.LARGEST_POWER_OF_TEN
SMALLEST_POWER_OF_TEN := ok
F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.SMALLEST_POWER_OF_TEN
coreopsarithDivInst := F32.Insts.CoreOpsArithDivF32F32
coreopsarithNegInst := F32.Insts.CoreOpsArithNegF32
coreopsarithMulInst := F32.Insts.CoreOpsArithMulF32F32
coreopsarithAddInst := F32.Insts.CoreOpsArithAddF32F32
corecmpPartialEqInst := F32.Insts.CoreCmpPartialEqF32
corecmpPartialOrdInst := F32.Insts.CoreCmpPartialOrdF32
coredefaultDefaultInst := F32.Insts.CoreDefaultDefault
corecloneCloneInst := F32.Insts.CoreCloneClone
coremarkerCopyInst := F32.Insts.CoreMarkerCopy
IntInst := U32.Insts.Dec2flt_modelNumImpTraitsInt
coreconvertIntoSelf_IntU64Inst := core.convert.IntoFrom
core.convert.FromU64U32
classify := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.classify
to_bits := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32.to_bits
}Operations used here
CoreCmpPartialEqF32 · Rust library
CoreCmpPartialOrdF32 · Rust library
CoreDefaultDefault · Rust library
CoreOpsArithAddF32F32 · Rust library
CoreOpsArithMulF32F32 · Rust library
CoreOpsArithDivF32F32 · Rust library
CoreOpsArithNegF32 · Rust library
SMALLEST_POWER_OF_TEN · Program Rust
LARGEST_POWER_OF_TEN · Program Rust
MAX_EXPONENT_ROUND_TO_EVEN · Program Rust
Source details
| Declaration | F32.Insts.Dec2flt_modelNumImpTraitsFloatU32 |
|---|---|
| File | num/imp/../../traits.rs |
| Lines | 241:0–269:1 |
| Program version | Preparation 1 |