diff options
author | Christian Heimes <christian@cheimes.de> | 2007-12-18 23:22:54 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-12-18 23:22:54 (GMT) |
commit | 0a8143f6462b491d3f12bfb899efd6e044e350be (patch) | |
tree | 855410e5c18dace91bbbb310b5660a40fb5f1eb6 /Doc | |
parent | 8777bcae2749099b6ea3ac35f079bfa3df470a78 (diff) | |
download | cpython-0a8143f6462b491d3f12bfb899efd6e044e350be.zip cpython-0a8143f6462b491d3f12bfb899efd6e044e350be.tar.gz cpython-0a8143f6462b491d3f12bfb899efd6e044e350be.tar.bz2 |
Applied patch #1635: Float patch for inf and nan on Windows (and other platforms).
The patch unifies float("inf") and repr(float("inf")) on all platforms.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/utilities.rst | 18 | ||||
-rw-r--r-- | Doc/library/functions.rst | 10 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 9 |
3 files changed, 31 insertions, 6 deletions
diff --git a/Doc/c-api/utilities.rst b/Doc/c-api/utilities.rst index 269f23a..eab33a3 100644 --- a/Doc/c-api/utilities.rst +++ b/Doc/c-api/utilities.rst @@ -1066,7 +1066,7 @@ The following functions provide locale-independent string to number conversions. .. versionadded:: 2.4 - + .. cfunction:: double PyOS_ascii_atof(const char *nptr) Convert a string to a :ctype:`double` in a locale-independent way. @@ -1075,6 +1075,22 @@ The following functions provide locale-independent string to number conversions. See the Unix man page :manpage:`atof(2)` for details. + +.. cfunction:: char * PyOS_stricmp(char *s1, char *s2) + + Case insensitive comparsion of strings. The functions works almost + identical to :cfunc:`strcmp` except that it ignores the case. + + .. versionadded:: 2.6 + + +.. cfunction:: char * PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size) + + Case insensitive comparsion of strings. The functions works almost + identical to :cfunc:`strncmp` except that it ignores the case. + + .. versionadded:: 2.6 + .. _reflection: diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 1e71198..756d722 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -434,7 +434,8 @@ available. They are listed here in alphabetical order. 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. Otherwise, the argument may be a plain or long integer + embedded in whitespace. The argument may also be [+|-]nan or [+|-]inf. + 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. If no argument is given, returns ``0.0``. @@ -446,9 +447,10 @@ available. They are listed here in alphabetical order. single: Infinity When passing in a string, values for NaN and Infinity may be returned, depending - on the underlying C library. The specific set of strings accepted which cause - these values to be returned depends entirely on the C library and is known to - vary. + on the underlying C library. Float accepts the strings nan, inf and -inf for + NaN and positive or negative infinity. The case and a leading + are ignored as + well as a leading - is ignored for NaN. Float always represents NaN and infinity + as nan, inf or -inf. The float type is described in :ref:`typesnumeric`. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index f7363c3..5b341b8 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -298,7 +298,7 @@ numeric operations have a higher priority than comparison operations): +--------------------+---------------------------------+--------+ | ``long(x)`` | *x* converted to long integer | \(2) | +--------------------+---------------------------------+--------+ -| ``float(x)`` | *x* converted to floating point | | +| ``float(x)`` | *x* converted to floating point | \(6) | +--------------------+---------------------------------+--------+ | ``complex(re,im)`` | a complex number with real part | | | | *re*, imaginary part *im*. | | @@ -355,6 +355,13 @@ Notes: Also referred to as integer division. The resultant value is a whole integer, though the result's type is not necessarily int. +(6) + float also accepts the strings "nan" and "inf" with an optional prefix "+" + or "-" for Not a Number (NaN) and positive or negative infinity. + + .. versionadded:: 2.6 + + .. % XXXJH exceptions: overflow (when? what operations?) zerodivision |