GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gimple-range-op

gimple-range-op now widens sqrt reverse operations for better precision.

Floating-point range analysis for square roots now correctly widens operands, improving precision for glibc's sqrt hook.

The gimple-range-op pass has been updated to correctly handle the precision of square root operations, particularly for glibc’s sqrt precision hook. Previously, the widening step (adding or subtracting half an ulp) was not applied consistently for reverse operations, leading to inaccurate ranges. This change ensures that the widen method is used, providing a more robust and precise range analysis for square roots.

In Details

The cfn_sqrt::op1_range method in gimple-range-op.cc previously failed to apply the widen adjustment when computing the range for reverse operations. This commit modifies it to always use widen (adding 0.5ulp or 1ulp) before feeding the result into frange_arithmetic. This addresses issues where the target hook's precision value (e.g., 0.5ulp) was not adequately accounted for, leading to incorrect ranges, especially around values like 25.0.

For Context
gimple-range-op
A GCC optimization pass that analyzes and computes the possible range of values for expressions represented in GIMPLE (GCC's intermediate representation).
sqrt
The square root mathematical function.
reverse op
In the context of range analysis, a 'reverse operation' likely refers to calculating the input range required to produce a specific output range. For sqrt, it means finding the input range that yields a given output range.
ulp
Unit in the Last Place. It represents the smallest possible change in the least significant bit of a floating-point number. Used to measure precision errors.
hook
A mechanism allowing a library or framework to be extended or customized by user-provided code or specific implementations, such as target-specific mathematical function behavior.
Filed Under: optimizationfloatrange-analysis