#include "pycore_modsupport.h"
PyDoc_STRVAR(float_is_integer__doc__,
"is_integer($self, /)\n"
"--\n"
"\n"
"Return True if the float is an integer.");
#define FLOAT_IS_INTEGER_METHODDEF …
static PyObject *
float_is_integer_impl(PyObject *self);
static PyObject *
float_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(float___trunc____doc__,
"__trunc__($self, /)\n"
"--\n"
"\n"
"Return the Integral closest to x between 0 and x.");
#define FLOAT___TRUNC___METHODDEF …
static PyObject *
float___trunc___impl(PyObject *self);
static PyObject *
float___trunc__(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(float___floor____doc__,
"__floor__($self, /)\n"
"--\n"
"\n"
"Return the floor as an Integral.");
#define FLOAT___FLOOR___METHODDEF …
static PyObject *
float___floor___impl(PyObject *self);
static PyObject *
float___floor__(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(float___ceil____doc__,
"__ceil__($self, /)\n"
"--\n"
"\n"
"Return the ceiling as an Integral.");
#define FLOAT___CEIL___METHODDEF …
static PyObject *
float___ceil___impl(PyObject *self);
static PyObject *
float___ceil__(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(float___round____doc__,
"__round__($self, ndigits=None, /)\n"
"--\n"
"\n"
"Return the Integral closest to x, rounding half toward even.\n"
"\n"
"When an argument is passed, work like built-in round(x, ndigits).");
#define FLOAT___ROUND___METHODDEF …
static PyObject *
float___round___impl(PyObject *self, PyObject *o_ndigits);
static PyObject *
float___round__(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
{ … }
PyDoc_STRVAR(float_conjugate__doc__,
"conjugate($self, /)\n"
"--\n"
"\n"
"Return self, the complex conjugate of any float.");
#define FLOAT_CONJUGATE_METHODDEF …
static PyObject *
float_conjugate_impl(PyObject *self);
static PyObject *
float_conjugate(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(float_hex__doc__,
"hex($self, /)\n"
"--\n"
"\n"
"Return a hexadecimal representation of a floating-point number.\n"
"\n"
">>> (-0.1).hex()\n"
"\'-0x1.999999999999ap-4\'\n"
">>> 3.14159.hex()\n"
"\'0x1.921f9f01b866ep+1\'");
#define FLOAT_HEX_METHODDEF …
static PyObject *
float_hex_impl(PyObject *self);
static PyObject *
float_hex(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(float_fromhex__doc__,
"fromhex($type, string, /)\n"
"--\n"
"\n"
"Create a floating-point number from a hexadecimal string.\n"
"\n"
">>> float.fromhex(\'0x1.ffffp10\')\n"
"2047.984375\n"
">>> float.fromhex(\'-0x1p-1074\')\n"
"-5e-324");
#define FLOAT_FROMHEX_METHODDEF …
PyDoc_STRVAR(float_as_integer_ratio__doc__,
"as_integer_ratio($self, /)\n"
"--\n"
"\n"
"Return a pair of integers, whose ratio is exactly equal to the original float.\n"
"\n"
"The ratio is in lowest terms and has a positive denominator. Raise\n"
"OverflowError on infinities and a ValueError on NaNs.\n"
"\n"
">>> (10.0).as_integer_ratio()\n"
"(10, 1)\n"
">>> (0.0).as_integer_ratio()\n"
"(0, 1)\n"
">>> (-.25).as_integer_ratio()\n"
"(-1, 4)");
#define FLOAT_AS_INTEGER_RATIO_METHODDEF …
static PyObject *
float_as_integer_ratio_impl(PyObject *self);
static PyObject *
float_as_integer_ratio(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(float_new__doc__,
"float(x=0, /)\n"
"--\n"
"\n"
"Convert a string or number to a floating-point number, if possible.");
static PyObject *
float_new_impl(PyTypeObject *type, PyObject *x);
static PyObject *
float_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{ … }
PyDoc_STRVAR(float_from_number__doc__,
"from_number($type, number, /)\n"
"--\n"
"\n"
"Convert real number to a floating-point number.");
#define FLOAT_FROM_NUMBER_METHODDEF …
PyDoc_STRVAR(float___getnewargs____doc__,
"__getnewargs__($self, /)\n"
"--\n"
"\n");
#define FLOAT___GETNEWARGS___METHODDEF …
static PyObject *
float___getnewargs___impl(PyObject *self);
static PyObject *
float___getnewargs__(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
PyDoc_STRVAR(float___getformat____doc__,
"__getformat__($type, typestr, /)\n"
"--\n"
"\n"
"You probably don\'t want to use this function.\n"
"\n"
" typestr\n"
" Must be \'double\' or \'float\'.\n"
"\n"
"It exists mainly to be used in Python\'s test suite.\n"
"\n"
"This function returns whichever of \'unknown\', \'IEEE, big-endian\' or \'IEEE,\n"
"little-endian\' best describes the format of floating-point numbers used by the\n"
"C type named by typestr.");
#define FLOAT___GETFORMAT___METHODDEF …
static PyObject *
float___getformat___impl(PyTypeObject *type, const char *typestr);
static PyObject *
float___getformat__(PyTypeObject *type, PyObject *arg)
{ … }
PyDoc_STRVAR(float___format____doc__,
"__format__($self, format_spec, /)\n"
"--\n"
"\n"
"Formats the float according to format_spec.");
#define FLOAT___FORMAT___METHODDEF …
static PyObject *
float___format___impl(PyObject *self, PyObject *format_spec);
static PyObject *
float___format__(PyObject *self, PyObject *arg)
{ … }