# 浮點數（Floating Point）物件

`PyFloatObject`

  This subtype of `PyObject` represents a Python floating point object.

PyTypeObject `PyFloat_Type`

  This instance of `PyTypeObject` represents the Python floating point type. This is the same object as `float` in the Python layer.

int `PyFloat_Check`(PyObject *p)

  Return true if its argument is a `PyFloatObject` or a subtype of `PyFloatObject`.

int `PyFloat_CheckExact`(PyObject *p)

  Return true if its argument is a `PyFloatObject`, but not a subtype of `PyFloatObject`.

PyObject* `PyFloat_FromString`(PyObject *str)
  Return value: New reference.

  Create a `PyFloatObject` object based on the string value in str, or NULL on failure.

PyObject* `PyFloat_FromDouble`(double v)
  Return value: New reference.

  Create a `PyFloatObject` object from v, or NULL on failure.

double `PyFloat_AsDouble`(PyObject *pyfloat)

  返回一个 C `double` 代表 pyfloat 的内容。 如果 pyfloat 不是一个 Python 浮点数对象但是具有 `__float__()` 方法，此方法将首先被调用，将 pyfloat 转换成一个数点数。 如果 `__float__()` 未定义则将回退至 `__index__()`。 如果失败，此方法将返回 `-1.0`，因此开发者应当调用 `PyErr_Occurred()` 来检查错误。

  3.8 版更變: 如果可用将使用 `__index__()`。

double `PyFloat_AS_DOUBLE`(PyObject *pyfloat)

  Return a C `double` representation of the contents of pyfloat, but without error checking.

PyObject* `PyFloat_GetInfo`(void)
  Return value: New reference.

  Return a structseq instance which contains information about the precision, minimum and maximum values of a float. It's a thin wrapper around the header file `float.h`.

double `PyFloat_GetMax`()

  Return the maximum representable finite float DBL_MAX as C `double`.

double `PyFloat_GetMin`()

  Return the minimum normalized positive float DBL_MIN as C `double`.

int `PyFloat_ClearFreeList`()

  Clear the float free list. Return the number of items that could not be freed.