TorchLean API

FloatLib.Floats.ExecFloat.Backends.Word.Narrow.Fma.Runtime

Native-word fused multiply-add for generic binary32 #

The fast path combines a product of at most 48 bits with the addend in one UInt64 when alignment permits it. A same-sign addend dominating the product by more than 48 scale bits is returned unchanged. Remaining gaps use exact dyadic alignment to preserve tie-breaking. Special-value policy remains outside this module. Correctness lives in Fma.Proof.

@[inline]

Finite binary32 fused multiply-add through exact dyadic coordinates.

Instances For
    @[inline]
    def FloatLib.Floats.Formats.BinaryInterchange.Model.NativeBinary32.fmaExactFinite? (productSign zSign : Bool) (product productScale zMantissa zProductScale : UInt64) :

    General exact finite binary32 FMA path using components already decoded by the native kernel.

    This retains arbitrary-gap alignment while avoiding a second decode and significand product.

    Instances For
      @[inline]

      Machine-word implementation of finite binary32 fused multiply-add.

      The exact product occupies at most 48 bits. When exponent alignment also fits in one UInt64, the product and addend are combined without constructing dyadics. An addend dominating a same-sign product by more than 48 scale bits is returned unchanged. Other gaps retain the generic exact path, including its tie-breaking behavior when a tiny addend perturbs a halfway product.

      Instances For