|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
The magnitudes m = max(|a|, |b|) for which the plain formula is safe, as the open interval (lo, hi): hi = sqrt(max) / 4, so a*a + b*b <= 2 m^2 stays below max; lo = 4 sqrt(min / eps), so m^2 > 16 min / eps, and any b*b too small to be normal is below half an ulp of a*a and drops out of the sum exactly as it does in the scaled form. More...
#include <pow2_scaling.hpp>
Public Attributes | |
| T | lo |
| T | hi |
The magnitudes m = max(|a|, |b|) for which the plain formula is safe, as the open interval (lo, hi): hi = sqrt(max) / 4, so a*a + b*b <= 2 m^2 stays below max; lo = 4 sqrt(min / eps), so m^2 > 16 min / eps, and any b*b too small to be normal is below half an ulp of a*a and drops out of the sum exactly as it does in the scaled form.
The factors of 4 cover the rounding of the square roots.
Both bounds are one namespace-scope object, so a call pays no initialization guard, and they are set together. Code that runs during another translation unit's static initialization may read the object before it is initialized. It then holds its zero-initialized value, lo = hi = 0, which empties the interval and sends every call down the scaled path, still correct. Two separate variables could be read with hi set and lo still 0, which would send tiny magnitudes down the plain path.
| T mtl::math::detail::plain_givens_bounds< T >::hi |
| T mtl::math::detail::plain_givens_bounds< T >::lo |