deimos.python.floatobject

Mirror floatobject.h

Members

Functions

PyFloat_AS_DOUBLE
double PyFloat_AS_DOUBLE(PyObject* op)

Extract C double from Python float. The macro version trades safety for speed.

PyFloat_AsDouble
double PyFloat_AsDouble(PyObject* )

Extract C double from Python float. The macro version trades safety for speed.

PyFloat_AsReprString
void PyFloat_AsReprString(char* , PyFloatObject* v)

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.

PyFloat_AsString
void PyFloat_AsString(char* , PyFloatObject* v)

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.

PyFloat_Check
int PyFloat_Check(PyObject* op)

_

PyFloat_CheckExact
int PyFloat_CheckExact(PyObject* op)

_

PyFloat_ClearFreeList
int PyFloat_ClearFreeList()

free list api Availability: >= 2.6

PyFloat_FromDouble
PyObject* PyFloat_FromDouble(double )

Return Python float from C double.

PyFloat_FromString
PyObject* PyFloat_FromString(PyObject* )

Availability: 3.*

PyFloat_FromString
PyObject* PyFloat_FromString(PyObject* , char** junk)

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).

PyFloat_GetInfo
PyObject* PyFloat_GetInfo()

Availability: >= 2.6

PyFloat_GetMax
double PyFloat_GetMax()

Availability: >= 2.6

PyFloat_GetMin
double PyFloat_GetMin()

Availability: >= 2.6

_PyFloat_DebugMallocStats
void _PyFloat_DebugMallocStats(FILE* out_)

Availability: >= 2.7

_PyFloat_Digits
int _PyFloat_Digits(char* buf, double v, int* signum)

Used to get the important decimal digits of a double Availability: >= 2.6

_PyFloat_DigitsInit
void _PyFloat_DigitsInit()

Availability: >= 2.6

_PyFloat_FormatAdvanced
PyObject* _PyFloat_FormatAdvanced(PyObject* obj, Py_UNICODE* format_spec, Py_ssize_t format_spec_len)

Availability: 3.*

_PyFloat_FormatAdvanced
PyObject* _PyFloat_FormatAdvanced(PyObject* obj, char* format_spec, Py_ssize_t format_spec_len)

Format the object based on the format_spec, as defined in PEP 3101 Availability: >= 2.6 (Advanced String Formatting).

_PyFloat_Pack4
int _PyFloat_Pack4(double x, ubyte* p, int le)
_PyFloat_Pack8
int _PyFloat_Pack8(double x, ubyte* p, int le)

_PyFloat_{Pack,Unpack}{4,8}

_PyFloat_Repr
int _PyFloat_Repr(double x, char* p, size_t len)

Availability: 3.*

_PyFloat_Unpack4
double _PyFloat_Unpack4(const(ubyte)* p, int le)
_PyFloat_Unpack8
double _PyFloat_Unpack8(const(ubyte)* p, int le)

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.

_Py_double_round
PyObject* _Py_double_round(double x, int ndigits)

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

Structs

PyFloatObject
struct PyFloatObject

subclass of PyObject

Meta