Documentation

LeanPool.Flean.Subnorm

Subnormal Floating-Point Representations #

This module defines SubnormRep, the sign/mantissa representation of subnormal floating-point numbers, its rational interpretation, rounding to subnormals, and the validity and error properties of subnormal rounding.

structure SubnormRep (C : FloatCfg) :

A sign/mantissa representation of a subnormal floating-point number.

  • s : Bool

    The sign bit (true for negative).

  • m :

    The subnormal mantissa.

Instances For

    Negate a subnormal representation by flipping its sign bit.

    Equations
    Instances For

      A subnormal representation is nonzero when its mantissa is nonzero.

      Equations
      Instances For

        The rational value represented by a subnormal representation.

        Equations
        Instances For

          Round a rational to a subnormal representation using the rounder r.

          Equations
          Instances For
            theorem neg_subnormal_round {C : FloatCfg} (r : IntRounder) {q : } (h : q 0) :

            Round a rational down to a subnormal representation.

            Equations
            Instances For
              theorem subnormal_exp_small {C : FloatCfg} {q : } (q_nonneg : q 0) (h : Int.log 2 |q| < C.emin) :
              |q| * 2 ^ (-C.emin) < 1

              A subnormal rounding map is valid if it never overflows the precision on inputs below the smallest normal magnitude.

              Equations
              Instances For
                theorem subnorm_zero {C : FloatCfg} {s : Bool} :
                subnormalToQ { s := s, m := 0 } = 0
                theorem subnormal_round_neg {C : FloatCfg} (r : IntRounder) {q : } (h : q 0) :