|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
T is a binary IEEE-754 format, as its numeric_limits declare (#697). More...
#include <pow2_scaling.hpp>
T is a binary IEEE-754 format, as its numeric_limits declare (#697).
For such a T, scaling by 2^-e is exact, so wherever a*a + b*b neither overflows nor loses a term to underflow, the scaled rotation and the plain formula give the same r, and givens_rotation can skip the scaling. They give the same c and s too, except where c or s is itself subnormal: there the scaled form rounds a 2^-e or b 2^-e before it divides, and the plain form rounds the quotient once, so the plain result is the correctly rounded one. This is a property of the format, not of the built-in types: a user-defined type that declares is_iec559 gets the same fast path. A tapered type (posit, takum) does not declare it, and keeps the scaled path, which keeps its arithmetic near 1, where it is most precise.