IEEE32 Executable Arithmetic #
This file defines executable binary32 arithmetic for the core operations: addition, subtraction, multiplication, division, square root, and fused multiply-add. The implementation follows IEEE-style case splits for NaN/Inf/zero and delegates finite rounding to the dyadic rounding kernel.
IEEE754 addition (round-to-nearest, ties-to-even), with NaN/Inf rules.
Instances For
IEEE754 subtraction (defined as addition with sign-flip).
Instances For
IEEE754 multiplication (round-to-nearest, ties-to-even), with NaN/Inf rules.
Instances For
IEEE754 division (round-to-nearest, ties-to-even), with NaN/Inf rules.
Instances For
IEEE754 fused multiply-add: compute x*y+z and round once (ties-to-even).
Instances For
If both inputs decode to dyadics, add is “exact dyadic add, then round once”.
Informal: for finite x,y, we compute the exact dyadic value dx + dy and apply IEEE
round-to-nearest-even.
If both inputs decode to dyadics, mul is “exact dyadic multiply, then round once”.
Informal: for finite x,y, the exact product is a dyadic with mantissa dx.mant * dy.mant and
exponent dx.exp + dy.exp, and we round that back to binary32.
If all inputs decode to dyadics, fma x y z is “exact dyadic (x*y) + z, then round once”.
Informal: for finite inputs, we compute the exact dyadic product dx*dy, add dz, and finally
apply IEEE round-to-nearest-even.
If x and y decode to dyadics and the denominator mantissa is nonzero, div x y is obtained by
forming the exact rational quotient and rounding once.
Informal: for finite nonzero y, we compute the exact value (dx.mant * 2^dx.exp) / (dy.mant * 2^dy.exp)
as a rational num/den with an exponent adjustment, then apply IEEE round-to-nearest-even.
IEEE754 square root (ties-to-even).
Instances For
Compare two exact dyadics by exact integer comparison.
This is used internally by executable rounding and special-case logic. The implementation normalizes the exponents to a common minimum exponent and compares the scaled integer mantissas.