<font size=2 face="sans-serif">Re the last point, I prefer adding the
words as well for clarity.</font>
<br>
<br><font size=2 face="sans-serif">Regards,<br>
<br>
Rajan Bhakta<br>
z/OS XL C/C++ Compiler Technical Architect<br>
ISO C Standards Representative for Canada<br>
C Compiler Development<br>
Contact: rbhakta@ca.ibm.com, Rajan Bhakta/Toronto/IBM<br>
Telephone: (905) 413-3995</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">From:</font>
<td><font size=1 face="sans-serif">Jim Thomas &lt;jaswthomas@sbcglobal.net&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">&quot;Fred J. Tydeman&quot; &lt;tydeman@tybor.com&gt;</font>
<tr>
<td valign=top><font size=1 color=#5f5f5f face="sans-serif">Cc:</font>
<td><font size=1 face="sans-serif">CFP &lt;cfp-interest@ucbtest.org&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">08/27/2012 07:16 PM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">Re: [Cfp-interest] strtodN subject sequence
with minus sign</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Sent by:</font>
<td><font size=1 face="sans-serif">cfp-interest-bounces@oakapple.net</font></table>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2><br>
On Aug 26, 2012, at 9:36 PM, Fred J. Tydeman wrote:<br>
<br>
&gt; On Tue, 21 Aug 2012 11:36:20 -0700 Jim Thomas wrote:<br>
&gt;&gt; <br>
&gt;&gt;&gt;&gt; <br>
&gt;&gt;&gt;&gt; 11.6 strtod32, strtod64, and strtod128 functions &lt;stdlib.h&gt;<br>
&gt;&gt;&gt;&gt; PDF page 31, item [4]:<br>
&gt;&gt;&gt;&gt; Add at the end of: <br>
&gt;&gt;&gt;&gt; &quot;If the subject sequence begins with a minus sign,
the sequence is<br>
&gt;&gt;&gt;&gt; &nbsp;interpreted as negated.&quot;<br>
&gt;&gt;&gt;&gt; (before rounding).<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; It says the sequence is interpreted as negated, not that the
result of <br>
&gt;&gt; rounding the unnegated sequence is negated. So no change needed<br>
&gt; <br>
&gt; C11 has a footnote on negated. &nbsp;That footnote is:<br>
&gt; <br>
&gt; 292) It is unspecified whether a minus-signed sequence is converted
<br>
&gt; to a negative number directly or by negating the value resulting from
<br>
&gt; converting the corresponding unsigned sequence (see F.5); the two<br>
&gt; methods may yield different results if rounding is toward positive
or <br>
&gt; negative infinity. In either case, the functions honor the sign of
<br>
&gt; zero if floating-point arithmetic supports signed zeros.<br>
&gt; <br>
&gt; That makes it clear the &quot;interpreted as negated&quot; phrase
has two meanings.<br>
<br>
I believe the words give an implementation license to mis-round in this
particular way. This doesn't really seem necessary since C11 without Annex
F doesn't require correct rounding for strtod functions anyway. See below.<br>
<br>
&gt; <br>
&gt;&gt; In the Aug teleconference, David asked would &quot;interpreted
as negative&quot; be <br>
&gt;&gt; better? I think it might be a little clearer. However, the current
words ( <br>
&gt;&gt; negated) match what's in C11 for the generic strtod family. I'm
inclined <br>
&gt;&gt; against making strtodN differ from strtod on this point. Does
anyone think a <br>
&gt;&gt; C11 defect report is in order?<br>
&gt; <br>
&gt; C11 F.5 has:<br>
&gt; <br>
&gt; Functions such as strtod that convert character sequences to floating
<br>
&gt; types honor the rounding direction. Hence, if the rounding direction
<br>
&gt; might be upward or downward, the implementation cannot convert a <br>
&gt; minus-signed sequence by negating the converted unsigned sequence.<br>
<br>
This says that honoring the directed rounding modes requires negating before
rounding. And we require the decimal strto functions to round correctly.<br>
<br>
&gt; <br>
&gt; Since strtod32/64/128 are for IEEE-754 DFP types, F.5 is in effect
and<br>
&gt; I believe we could differ some from strtof/d/ld.<br>
&gt; <br>
&gt; I see no defect in C11.<br>
&gt; <br>
&gt; I prefer adding &quot;(before rounding)&quot;.<br>
<br>
I still don't think it's strictly necessary, but wouldn't object to adding
it.<br>
<br>
-Jim<br>
<br>
&gt; <br>
&gt; ---<br>
&gt; Fred J. Tydeman &nbsp; &nbsp; &nbsp; &nbsp;Tydeman Consulting<br>
&gt; tydeman@tybor.com &nbsp; &nbsp; &nbsp;Testing, numerics, programming<br>
&gt; +1 (775) 287-5904 &nbsp; &nbsp; &nbsp;Vice-chair of PL22.11 (ANSI
&quot;C&quot;)<br>
&gt; Sample C99+FPCE tests: </font></tt><a href=http://www.tybor.com/><tt><font size=2>http://www.tybor.com</font></tt></a><tt><font size=2><br>
&gt; Savers sleep well, investors eat well, spenders work forever.<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; Cfp-interest mailing list<br>
&gt; Cfp-interest@oakapple.net<br>
&gt; </font></tt><a href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest"><tt><font size=2>http://mailman.oakapple.net/mailman/listinfo/cfp-interest</font></tt></a><tt><font size=2><br>
<br>
<br>
_______________________________________________<br>
Cfp-interest mailing list<br>
Cfp-interest@oakapple.net<br>
</font></tt><a href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest"><tt><font size=2>http://mailman.oakapple.net/mailman/listinfo/cfp-interest</font></tt></a><tt><font size=2><br>
<br>
</font></tt>
<br>
<br>