[Cfp-interest 1371] AI to reword note about negative constants

Jim Thomas jaswthomas at sbcglobal.net
Thu Aug 1 15:07:34 PDT 2019


Action item:
>     Jim: Reword CFP 1337 as per action item discussion in the 2019/07/17 meeting.


Here’s an updated draft note to go at the end of 6.4.4.2:

NOTE	Floating constants do not include a sign and are negated by the unary - operator (6.5.3.3) which negates the rounded value of the constant. In contrast, the numeric conversion functions in the strto family (7.22.1.5, 7.22.1.6) include the sign as part of the input value and convert and round the negated input. Negating before rounding and negating after rounding might yield different results, depending on the rounding direction and whether the results are correctly rounded. For example, the results are the same when both are correctly rounded using rounding to nearest or rounding toward zero, but the results are different when both are inexact but correctly rounded using rounding toward positive infinity or rounding toward negative infinity. 

Conversions yielding exact results require no rounding, so are not affected by the order of negating and rounding. For decimal floating types, floating constants expressed within the precision and range of the evaluation format convert exactly. For standard floating types, hexadecimal floating constants expressed within the precision and range of the evaluation format convert exactly. 


- Jim Thomas


> On Jun 22, 2019, at 10:58 AM, Jim Thomas <jaswthomas at sbcglobal.net> wrote:
> 
> Action item:
>>     Jim: Draft a note to warn about CFP1315's rounding of negative constants issue.
>> 
> 
> 
> Here’s a draft note to go at the end of 6.4.4.2:
> 
> NOTE	Floating constants do not include a sign and are negated by the unary - operator (6.5.3.3) which negates the rounded value of the constant. In contrast, the numeric conversion functions in the strto family (7.22.1.5, 7.22.1.6) include the sign as part of the input value and convert and round the negated input. Negating before rounding and negating after rounding yield the same result with rounding to nearest and rounding toward zero, but yield different inexact results with rounding toward positive infinity and rounding toward negative infinity. Exact results require no rounding, so are not affected by the order of negating and rounding. For radix 10 types, floating constants expressed within the precision of the evaluation format convert exactly. For radix 2 types, hexadecimal floating constants expressed within the precision of the evaluation format convert exactly.
> 
> Comments and suggestions for improvement are welcome.
> 
> - Jim Thomas
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20190801/b3ed214e/attachment-0001.html 


More information about the Cfp-interest mailing list