TorchLean API

FloatLib.Floats.Formats.P3109.Arithmetic.Square

Once-projected P3109 squares #

Squaring reuses exact multiplication and projects once into the requested destination. The source and destination may have different widths, precisions, signedness, and domains.

@[inline]

Square the exact decoded operand and project once into target, by default the operand's format, with multiplication's NaN and infinity behavior.

Instances For
    theorem FloatLib.Floats.ExecFloat.P3109.square_eq_mul {format : Formats.P3109.Format} (value : P3109 format) (target : Formats.P3109.Format) (mode : Formats.P3109.RoundingMode) (saturation : Formats.P3109.SaturationMode) :
    value.square target mode saturation = value.mul value target mode saturation

    Squaring is multiplication of the operand by itself, for every projection option.

    theorem FloatLib.Floats.ExecFloat.P3109.decode_square_finite {format : Formats.P3109.Format} (value : P3109 format) (target : Formats.P3109.Format) (mode : Formats.P3109.RoundingMode) (saturation : Formats.P3109.SaturationMode) (q : ℚ) (hvalue : value.toClosedRat = Numerics.NumericalValue.finite q) :
    Formats.P3109.Format.SameDatum (value.square target mode saturation).decode (target.projectRatValue { rounding := mode, saturation := saturation } (Numerics.NumericalValue.finite (q * q)))

    A finite square is projected from the exact rational square with no intermediate rounding.