TorchLean API

FloatLib.Floats.Formats.Posit.Arithmetic.Square

Once-rounded posit squares #

The model square reuses exact dyadic multiplication. The public configured square reuses the selected certified multiplication kernel, including its packed carriers and width-generic fallback. Neither entry point adds a rounding step.

@[inline]
def FloatLib.Floats.Formats.Posit.Model.square {format : Format} (value : Model format) :
Model format

Square by exact multiplication followed by one standardized posit rounding. NaR propagates.

Instances For
    theorem FloatLib.Floats.Formats.Posit.Model.square_eq_spec {format : Format} (value : Model format) :
    value.square = Spec.mul value value

    Model squaring refines the exact rational multiplication specification.

    theorem FloatLib.Floats.Formats.Posit.Model.square_of_toRat {format : Format} (value : Model format) (q : ℚ) (hvalue : value.toRat? = some q) :
    value.square = roundRat format (q * q)

    The exact rational square is rounded once for every finite posit.

    @[simp]

    Not-a-Real propagates through squaring.

    @[inline]

    Square using the selected certified posit multiplication, with one final rounding.

    Instances For

      Public squaring uses the same certified multiplication call as value * value.

      Squaring preserves the selected multiplication capability's reference result.