https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93806

--- Comment #41 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Wed, 4 Mar 2020, rguenther at suse dot de wrote:

> We're actually careful about the sign of zero here when recording
> requivalences for propagation.  I don't see anything preventing
> equivalence based propagation for decimal floats though.
> Also not sure if actual FP formats are required to be always
> normalized ...

All finite DFP values that can be represented with fewer decimal digits 
than the maximum for the format, and where the least significant nonzero 
decimal digit has an exponent greater than the smallest possible for the 
format, have representations with more than one possible quantum exponent, 
which are not equivalent even though they compare equal, and thus 
comparing equal should not result in an equivalence being recorded.

E.g. _Decimal32 has 7-digit precision.  1.0DF and 1.00DF are different 
members of the same cohort, with quantum exponents -1 and -2, and compare 
equal but are not equivalent.  1.000001DF uses all 7 digits so is the 
unique member of its cohort, so it is valid to use 1.000001DF in place of 
anything that compared equal to 1.000001DF.  1E-101DF is the least 
positive subnormal value; as -101 is the lowest quantum exponent, anything 
with a nonzero digit in the 10^-101 place is the unique member of its 
cohort and so 1E-101DF can be used in place of anything that compared 
equal to 1E-101DF.

This is a separate matter from noncanonical encodings of DFP values.  A 
noncanonical encoding is a valid representation that *is* fully equivalent 
to some canonical encoding - but most operations are supposed to produce 
only canonically encoded results.  If a cohort has only one member but 
there are noncanonical encodings of that member, a canonical encoding can 
replace a noncanonical one (in general it's not required to propagate 
noncanonical encodings, even when permitted), but not vice versa.

Reply via email to