uxarray.utils.computing.acc_sqrt_re#
- uxarray.utils.computing.acc_sqrt_re(value, error=0.0)#
Accurate square root: return (root, correction) s.t. root+correction ≈ sqrt(value+error).
Mirrors accusphgeom::numeric::acc_sqrt_re from eft.hpp. Computes root = fl(sqrt(value)), measures the rounding error of root*root via two_prod, then recovers a correction term from the residual. When
erroris provided (e.g. thelohalf of a compensated sum), it is folded into the residual so the correction accounts for the full compensated input.- Parameters:
- Returns:
root (float) – Rounded sqrt, fl(sqrt(value)).
correction (float) – Additive correction; root + correction ≈ sqrt(value + error) to ~1 ulp.
References
Rump, S. M. (2023). Fast and accurate computation of the Euclidean norm of a vector. Japan Journal of Industrial and Applied Mathematics, 40. https://doi.org/10.1007/s13160-023-00593-8