[Cfp-interest 2666] Re: incorrect example H.12.2p4

Vincent Lefevre vincent at vinc17.net
Tue Jan 31 07:35:52 PST 2023


On 2023-01-31 16:19:09 +0100, Vincent Lefevre wrote:
> The example in H.12.2p4
> 
> #define __STDC_WANT_IEC_60559_TYPES_EXT__
> #include <stdlib.h>
> #define MAXSIZE 41 // > intermediate hex string length
> unsigned char b128[16]; // for input binary128 datum
> _Decimal128 d128; // for result
> char s[MAXSIZE];
> // store input binary128 datum in array b128
> ...
> strfromencf128(s, MAXSIZE, "%a", b128);
> d128 = strtod128(s, NULL);
> ...
> 
> assumes that decimal-point takes only 1 byte. But this might not
> be true in some locales. I don't know whether this has already
> been seen in real locales, but it is known that thousands_sep
> can take several bytes in practice, e.g. with "fr_FR.utf8":
> https://reviews.llvm.org/D27167 says that thousands_sep is U+00A0
> on FreeBSD 11. And on Linux, it is U+202F NARROW NO-BREAK SPACE,
> i.e. the string e2 80 af (3 bytes).

Well, this occurs in practice, with the ps_AF locale:

decimal_point (length 2) = "٫" [ d9 ab ]
thousands_sep (length 2) = "٬" [ d9 ac ]

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Cfp-interest mailing list