]> granicus.if.org Git - python/commitdiff
atof() description: Add information about accepting 'NaN' to produce
authorFred Drake <fdrake@acm.org>
Thu, 18 Feb 1999 03:49:20 +0000 (03:49 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 18 Feb 1999 03:49:20 +0000 (03:49 +0000)
the NaN value.

Doc/lib/libfuncs.tex
Doc/lib/libstring.tex

index 3f241017c7845a6923d3943570eb5749807771fb..316b294b233372382ae7676237bfb73049ac2336 100644 (file)
@@ -231,12 +231,13 @@ removed.
 \begin{funcdesc}{float}{x}
   Convert a string or a number to floating point.  If the argument is a
   string, it must contain a possibly signed decimal or floating point
-  number, possibly embedded in whitespace;
-  this behaves identical to \code{string.atof(\var{x})}.
-  Otherwise, the argument may be a plain or
-  long integer or a floating point number, and a floating point number
-  with the same value (within Python's floating point precision) is
-  returned.
+  number, possibly embedded in whitespace, or be \code{'NaN'} (case
+  insensitive); this behaves identical to
+  \code{string.atof(\var{x})}.  If the string is \code{'NaN'}, the
+  IEEE ``Not a Number'' value is returned.  Otherwise, the argument
+  may be a plain or long integer or a floating point number, and a
+  floating point number with the same value (within Python's floating
+  point precision) is returned.
 \end{funcdesc}
 
 \begin{funcdesc}{getattr}{object, name}
index 442486369b17944633490a388ba8d4673fb72590..56dcf6db61c12b3c1aa183893140fef00c08fde9 100644 (file)
@@ -59,9 +59,11 @@ The functions defined in this module are:
 \begin{funcdesc}{atof}{s}
   Convert a string to a floating point number.  The string must have
   the standard syntax for a floating point literal in Python,
-  optionally preceded by a sign (\samp{+} or \samp{-}).  Note that
-  this behaves identical to the built-in function
-  \function{float()}\bifuncindex{float} when passed a string.
+  optionally preceded by a sign (\samp{+} or \samp{-}), or be
+  \code{'NaN'} (case insensitive) to indicate the IEEE ``Not a
+  Number'' value.  Note that this behaves identical to the built-in
+  function \function{float()}\bifuncindex{float} when passed a
+  string.
 \end{funcdesc}
 
 \begin{funcdesc}{atoi}{s\optional{, base}}