Consolidate signed-zero canonicalization of floating-point range endpoints.
Standardizes how +0.0 and -0.0 are represented in floating-point ranges.
This change unifies the signed-zero canonicalization for floating-point range endpoints within the frange library. Previously, set() and flush_denormals_to_zero() handled zero endpoints differently, potentially leading to inconsistencies. By ensuring a single representation for zero endpoints, this commit lays the groundwork for more robust handling of signed zeros and simplifies range comparisons.
In Details
The frange library's canonicalization of zero endpoints in floating-point ranges was inconsistent between set() and flush_denormals_to_zero(). This commit consolidates this logic to ensure a single, unified representation, which is a prerequisite for upcoming changes like implementing frange sub-ranges and correctly handling signed zeros in comparisons via frange_cmp().
- signed zero
- In floating-point arithmetic, zero can have a sign, represented as +0.0 and -0.0. While numerically equal, they can arise from different operations and may have implications for comparisons and behavior in certain mathematical functions.
- frange
- A GCC internal data structure representing a range of floating-point values. It is used in optimization passes to track possible values of expressions.
- canonicalization
- The process of converting an expression or data structure into a standard or canonical form. In this context, it means ensuring that representations of floating-point zero are consistent.