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.
Instances For
IEEE exception status #
The value-only operations above remain the basic executable API. The wrappers below return the same value together with the five exception indicators defined by IEEE 754. Tininess is detected after rounding, and underflow is reported only when the rounded result is both tiny and inexact.
The status is computed from the exact dyadic or rational intermediate already used by each operation. No host floating-point operation or numerical tolerance enters this classification.
Instances For
Instances For
No exception was raised.
Instances For
Accumulate exception indicators from two operations.
Instances For
An executable binary32 value paired with the exception status produced while computing it.
- value : IEEE32Exec
- status : IEEEStatus
Instances For
Instances For
Instances For
Whether a finite binary32 result is zero or subnormal.
Instances For
Classify rounding an exact dyadic to the supplied binary32 result.
Instances For
Classify rounding an exact signed rational to the supplied binary32 result.
Instances For
Binary32 addition with IEEE exception status.
Instances For
Binary32 subtraction with IEEE exception status.
Instances For
Binary32 multiplication with IEEE exception status.
Instances For
Binary32 division with IEEE exception status.
Instances For
Fused multiply-add with IEEE exception status.
Instances For
Binary32 square root with IEEE exception status.
Instances For
After-rounding dyadic underflow is reported only for an inexact result.
After-rounding rational underflow is reported only for an inexact result.