Documentation

Miri.Interpreter.Float

Exact binary IEEE encodings and rational arithmetic for the four MIR float widths. No Lean/host Float is used. Finite rounding is nearest, ties to even, as used by pinned rustc_apfloat's default MIR operations.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Equations
      Instances For
        Instances For
          Equations
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        Instances For
                          Equations
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Equations
                                  Instances For
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      Round an exact nonnegative rational with a separate sign. Clamping the working exponent to MIN_EXP gives gradual subnormal underflow, including ties at signed zero. Overflow after rounding produces infinity.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        Cast finite values with correct rounding. NaN payload conversion first quiets, shifts to the target precision, and forces the target quiet bit, as pinned ieee.rs::convert_r does. Miri's adjust_nan is applied separately.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          All outcomes generated by pinned Miri operator.rs::generate_nan. Sign choice is independent of candidate choice. A fixed seed is not a safety model.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            MIR arithmetic's base result. NaN payload/sign selection is subsequently performed by nanChoices/adjust_nan; finite arithmetic never calls a host float.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For

                                              IEEE partial ordering: both signs of zero compare equal; all NaNs are unordered. Infinities are ordered without rational approximation.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  Rust as float-to-int conversion saturates and truncates toward zero; NaNs map to zero. Width and signedness are from the target compiler layout.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    theorem Miri.Interpreter.FloatBits.roundRatio_zero (format : FloatFormat) (negative : Bool) (denominator : Nat) (nonzero : denominator ≠ 0) :
                                                    roundRatio format negative 0 denominator = Except.ok (zero format negative)

                                                    Every exact zero retains its input sign under nearest-even conversion.

                                                    theorem Miri.Interpreter.FloatBits.nan_toInteger (value : FloatBits) (negative : Bool) (payload width : Nat) (decoded : value.decode = Except.ok { negative := negative, value := FloatClass.nan payload }) (nonzero : width ≠ 0) (bounded : width ≤ 128) (isSigned : Bool) :
                                                    value.toInteger width isSigned = Except.ok 0

                                                    Saturating integer casts of any decoded NaN are exactly zero.