[Cfp-interest 1921] Fwd: (SC22WG14.18896) fabs, copysign, representations and N2651

Jim Thomas jaswthomas at sbcglobal.net
Tue Feb 16 09:03:19 PST 2021



> Begin forwarded message:
> 
> From: Joseph Myers <joseph at codesourcery.com>
> Subject: (SC22WG14.18896) fabs, copysign, representations and N2651
> Date: February 15, 2021 at 12:01:14 PM PST
> To: Jim Thomas <jaswthomas at sbcglobal.net>
> Cc: Martin Uecker <Martin.Uecker at med.uni-goettingen.de>, SC22 WG14 <sc22wg14 at open-std.org>
> 
> On Sat, 13 Feb 2021, Jim Thomas wrote:
> 
>>>> Recall that "representation" in 
>>>> ISO C is equivalent to "encoding" in IEEE 754; noncanonical encodings are 
>>>> considered the same representation as the canonical encoding in IEEE 754, 
>>>> but are different representations in ISO C.  IEEE 754 says these 
>>>> operations *may* propagate non-canonical encodings; the proposed ISO C 
>>>> wording would require such encodings to be propagated.  
>> 
>> IEEE 754 says of these operations: "they only affect the sign bit”. I 
>> understand this to mean that other bits in the bit encoding are 
>> unchanged, IEEE 754 does says they "may propagate non-canonical 
>> encodings”. I think this is not well stated, but is intended to 
>> distinguish these operations among computational operations which 
>> "generally produce only canonical significands”, and is not intended to 
>> specify an implementation option.
> 
> Looking again at exactly what IEEE 754 says here: "they only affect the 
> sign bit" is asserted for interchange formats.  (What exactly it means, 
> when operations aren't generally considered to work at the encoding level, 
> and the "may" in "may propagate" suggests the handling of non-canonical 
> encodings is deliberately not fully specified, is unclear.)  For 
> non-interchange formats, it is only said that these operations "match the 
> sign bit operations above at the representation level (see 3.2 and 3.3)" 
> (where 3.2 and 3.3 discuss what "representation" is in the IEEE 754 
> sense).
> 
> Annex F covers both interchange and non-interchange formats, and shouldn't 
> require interchange format semantics for operations on non-interchange 
> formats.
> 
>>>> * In ISO C, "representation" includes padding bits, but operations 
>>>> changing values should never be required to preserve padding bits.  
>>>> Although the IEEE 754 interchange formats don't typically have padding 
>>>> bits, the common x86 extended-precision format typically has padding bits 
>>>> in memory but not in registers (meaning it's not practical for these 
>>>> operations to preserve the value of padding bits).
>> 
>> The IEEE 754 encoding applies to what might be called the value bits in 
>> the C object representation. The requirement to only affect the sign bit 
>> means not to affect the other encoding (value) bits. This says nothing 
>> about padding bits.
> 
> IEEE 754 says nothing about padding bits, but the proposed wording for ISO 
> C, talking about "same bit representation", suggests padding bits are 
> preserved (which should not be required).
> 
> -- 
> Joseph S. Myers
> joseph at codesourcery.com



More information about the Cfp-interest mailing list