Objetos de ponto flutuante

type PyFloatObject

Este subtipo de PyObject representa um objeto de ponto flutuante do Python.

PyTypeObject PyFloat_Type
Part of the Stable ABI.

Esta instância do PyTypeObject representa o tipo de ponto flutuante do Python. Este é o mesmo objeto float na camada do Python.

int PyFloat_Check(PyObject *p)

Retorna true se seu argumento é um PyFloatObject ou um subtipo de PyFloatObject. Esta função sempre tem sucesso.

int PyFloat_CheckExact(PyObject *p)

Retorna true se seu argumento é um PyFloatObject, mas um subtipo de PyFloatObject. Esta função sempre tem sucesso.

PyObject *PyFloat_FromString(PyObject *str)
Retorna valor: Nova referência. Part of the Stable ABI.

Cria um objeto PyFloatObject baseado em uma string de valor “str” ou NULL em falha.

PyObject *PyFloat_FromDouble(double v)
Retorna valor: Nova referência. Part of the Stable ABI.

Cria um objeto PyFloatObject de v ou NULL em falha.

double PyFloat_AsDouble(PyObject *pyfloat)
Part of the Stable ABI.

Return a C double representation of the contents of pyfloat. If pyfloat is not a Python floating point object but has a __float__() method, this method will first be called to convert pyfloat into a float. If __float__() is not defined then it falls back to __index__(). This method returns -1.0 upon failure, so one should call PyErr_Occurred() to check for errors.

Alterado na versão 3.8: Usa __index__(), se disponível.

double PyFloat_AS_DOUBLE(PyObject *pyfloat)

Retorna uma representação C double do conteúdo de pyfloat, mas sem verificação de erro.

PyObject *PyFloat_GetInfo(void)
Retorna valor: Nova referência. Part of the Stable ABI.

Retorna uma instância de structseq que contém informações sobre a precisão, os valores mínimo e máximo de um ponto flutuante. É um invólucro fino em torno do arquivo de cabeçalho float.h.

double PyFloat_GetMax()
Part of the Stable ABI.

Retorna o ponto flutuante finito máximo representável DBL_MAX como double do C.

double PyFloat_GetMin()
Part of the Stable ABI.

Retorna o ponto flutuante positivo mínimo normalizado DBL_MIN como double do C.