<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><font face="Arial" style="font-size: 14px;">The thread</font><div><font face="Arial" style="font-size: 14px;"><br></font></div><div><ul style="font-variant-ligatures: normal; orphans: 2; widows: 2;"><li><font face="Arial" style="font-size: 14px;"><a href="http://mailman.oakapple.net/pipermail/cfp-interest/2023-January/002679.html">[Cfp-interest 2665] incorrect example H.12.2p4 </a><a name="2679"> </a> <i>Vincent Lefevre</i></font></li><ul><li><font face="Arial" style="font-size: 14px;"><a href="http://mailman.oakapple.net/pipermail/cfp-interest/2023-January/002680.html">[Cfp-interest 2666] Re: incorrect example H.12.2p4 </a><a name="2680"> </a> <i>Vincent Lefevre</i></font></li></ul></ul></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><i><br></i></span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">points out that the example in H.12.2p4 has a locale dependency that is not mentioned. In particular, determination of the value of MAXSIZE assumes the decimal-point is just one byte. Per discussion at the 20230131 CFP meeting, this might be fixed with the following changes:</span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">change</span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">#define MAXSIZE 41 // > intermediate hex string length</span></font></div></blockquote><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">to</span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">#define MAXSIZE 41 // > intermediate hex string length for “C” locale</span></font></div></blockquote><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">and change</span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">The array s for the output of strfromencf128 need have no greater size than 41, ...</span></font></div></blockquote><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">to</span></font></div><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="orphans: 2; widows: 2;"><font face="Arial"><span style="font-size: 14px;">Assuming a one byte decimal-point character as in the “C” locale, the array s for the output of strfromencf128 need have no greater size than 41, ...</span></font></div></blockquote><div style="orphans: 2; widows: 2;"><div><font face="Arial"><span style="font-size: 14px;"><br></span></font></div><div><font face="Arial"><span style="font-size: 14px;">- Jim Thomas</span></font></div></div><div><br><blockquote type="cite"><div>On Jan 31, 2023, at 7:19 AM, Vincent Lefevre <vincent@vinc17.net> wrote:</div><br class="Apple-interchange-newline"><div><div>The example in H.12.2p4<br><br>#define __STDC_WANT_IEC_60559_TYPES_EXT__<br>#include <stdlib.h><br>#define MAXSIZE 41 // > intermediate hex string length<br>unsigned char b128[16]; // for input binary128 datum<br>_Decimal128 d128; // for result<br>char s[MAXSIZE];<br>// store input binary128 datum in array b128<br>...<br>strfromencf128(s, MAXSIZE, "%a", b128);<br>d128 = strtod128(s, NULL);<br>...<br><br>assumes that decimal-point takes only 1 byte. But this might not<br>be true in some locales. I don't know whether this has already<br>been seen in real locales, but it is known that thousands_sep<br>can take several bytes in practice, e.g. with "fr_FR.utf8":<br>https://reviews.llvm.org/D27167 says that thousands_sep is U+00A0<br>on FreeBSD 11. And on Linux, it is U+202F NARROW NO-BREAK SPACE,<br>i.e. the string e2 80 af (3 bytes).<br><br>-- <br>Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/><br>100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/><br>Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)<br>_______________________________________________<br>Cfp-interest mailing list<br>Cfp-interest@oakapple.net<br>http://mailman.oakapple.net/mailman/listinfo/cfp-interest<br></div></div></blockquote></div><br></body></html>