On Sat, Mar 21, 2009 at 01:22:57AM +0100, Vincent Lefevre wrote: > The strtod(3) man page is incorrect concerning NAN(...). It says: > > A NAN is "NAN" (disregarding case) optionally followed by '(', a > sequence of characters, followed by ')'. > > but doesn't require anything concerning the sequence of characters > (one may think that any sequence is allowed up to the first closing > parenthesis). However the glibc 2.9-6 package seems to strictly > follow the ISO C99 standard, which says: > > [Section 7.20.1.3] > NAN or NAN(n-char-sequence_opt), ignoring case in the NAN part, > where: > n-char-sequence: > digit > nondigit > n-char-sequence digit > n-char-sequence nondigit > > [Section 6.4.2.1] > nondigit: one of > _ a b c d e f g h i j k l m > n o p q r s t u v w x y z > A B C D E F G H I J K L M > N O P Q R S T U V W X Y Z > digit: one of > 0 1 2 3 4 5 6 7 8 9 > > Also the man page should explicitly say that the sequence can be > empty. So, I propose: > > A NAN is "NAN" (disregarding case) optionally followed by '(', > a possibly empty sequence of characters, followed by ')'. Each > character of the sequence must be either the underscore '_' or > an alphanumeric character in the "C" locale.
The current manpage (5.10-1 as in Debian or 5.13 upstream) instead reads | A NAN is "NAN" (disregarding case) optionally followed by a string, | (n-char-sequence), where n-char-sequence specifies in an | implementation-dependent way the type of NAN (see NOTES). | [...] | In the glibc implementation, the n-char-sequence that optionally follows | "NAN" is interpreted as an integer number (with an optional '0' or '0x' | prefix to select base 8 or 16) that is to be placed in the mantissa | component of the returned value. This elaborates on the sequence of characters, and the "optionally followed by" IMO sufficiently clarifies that the sequence can indeed be empty. As such I'd think this bug here could simply be closed. The corresponding upstream changes seem to first have been part of man-pages-3.71 (first packaged in 3.71-1) where the Changes list | strtod.3 | Michael Kerrisk | Explain NAN(n-char-sequence) Cheers, Flo
signature.asc
Description: PGP signature