Extract C double from Python float. The macro version trades safety for speed.
Extract C double from Python float. The macro version trades safety for speed.
Write repr(v) into the char buffer argument, followed by null byte. The buffer must be "big enough"; >= 100 is very safe. PyFloat_AsReprString(buf, x) strives to print enough digits so that Availability: 2.* PyFloat_FromString(buf) then reproduces x exactly.
Write str(v) into the char buffer argument, followed by null byte. The buffer must be "big enough"; >= 100 is very safe. Note that it's unusual to be able to get back the float you started with from PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to Availability: 2.* preserve precision across conversions.
_
_
free list api Availability: >= 2.6
Return Python float from C double.
Availability: 3.*
Return Python float from string PyObject. Second argument ignored on input, and, if non-NULL, NULL is stored into *junk (this tried to serve a Availability: 2.* purpose once but can't be made to work as intended).
Availability: >= 2.6
Availability: >= 2.6
Availability: >= 2.6
Availability: >= 2.7
Used to get the important decimal digits of a double Availability: >= 2.6
Availability: >= 2.6
Availability: 3.*
Format the object based on the format_spec, as defined in PEP 3101 Availability: >= 2.6 (Advanced String Formatting).
_PyFloat_{Pack,Unpack}{4,8}
Availability: 3.*
The unpack routines read 4 or 8 bytes, starting at p. le is a bool argument, true if the string is in little-endian format (exponent last, at p+3 or p+7), false if big-endian (exponent first, at p). Return value: The unpacked double. On error, this is -1.0 and PyErr_Occurred() is true (and an exception is set, most likely OverflowError). Note that on a non-IEEE platform this will refuse to unpack a string that represents a NaN or infinity.
Round a C double x to the closest multiple of 10**-ndigits. Returns a Python float on success, or NULL (with an appropriate exception set) on failure. Used in builtin_round in bltinmodule.c. Availability: >= 2.7
subclass of PyObject
Mirror floatobject.h