@ExposedType(name="float",
doc="float(x) -> floating point number\n\nConvert a string or number to a floating point number, if possible.")
public class PyFloat
extends PyObject
| Modifier and Type | Class and Description |
|---|---|
static class |
PyFloat.Format |
PyObject.ConversionException| Modifier and Type | Field and Description |
|---|---|
static PyFloat.Format |
double_format |
static PyFloat.Format |
float_format |
static PyType |
TYPE |
gcMonitorGlobal| Constructor and Description |
|---|
PyFloat(double v) |
PyFloat(float v) |
PyFloat(PyType subtype,
double v) |
| Modifier and Type | Method and Description |
|---|---|
PyObject |
__abs__()
Equivalent to the standard Python __abs__ method.
|
PyObject |
__add__(PyObject right)
Equivalent to the standard Python __add__ method.
|
int |
__cmp__(PyObject other)
Equivalent to the standard Python __cmp__ method.
|
java.lang.Object |
__coerce_ex__(PyObject other)
Implements numeric coercion
|
PyComplex |
__complex__()
Equivalent to the standard Python __complex__ method.
|
PyObject |
__div__(PyObject right)
Equivalent to the standard Python __div__ method
|
PyObject |
__divmod__(PyObject right)
Equivalent to the standard Python __divmod__ method
|
PyObject |
__eq__(PyObject other)
Equivalent to the standard Python __eq__ method.
|
PyFloat |
__float__()
Equivalent to the standard Python __float__ method.
|
PyObject |
__floordiv__(PyObject right)
Equivalent to the standard Python __floordiv__ method
|
PyObject |
__format__(PyObject formatSpec) |
PyObject |
__ge__(PyObject other)
Equivalent to the standard Python __ge__ method.
|
PyTuple |
__getnewargs__() |
PyObject |
__gt__(PyObject other)
Equivalent to the standard Python __gt__ method.
|
PyObject |
__int__()
Equivalent to the standard Python __int__ method.
|
PyObject |
__invert__()
Equivalent to the standard Python __invert__ method.
|
PyObject |
__le__(PyObject other)
Equivalent to the standard Python __le__ method.
|
PyObject |
__long__()
Equivalent to the standard Python __long__ method.
|
PyObject |
__lt__(PyObject other)
Equivalent to the standard Python __lt__ method.
|
PyObject |
__mod__(PyObject right)
Equivalent to the standard Python __mod__ method
|
PyObject |
__mul__(PyObject right)
Equivalent to the standard Python __mul__ method.
|
PyObject |
__ne__(PyObject other)
Equivalent to the standard Python __ne__ method.
|
PyObject |
__neg__()
Equivalent to the standard Python __neg__ method.
|
boolean |
__nonzero__()
Equivalent to the standard Python __nonzero__ method.
|
PyObject |
__pos__()
Equivalent to the standard Python __pos__ method.
|
PyObject |
__pow__(PyObject right,
PyObject modulo)
Implements the three argument power function.
|
PyObject |
__radd__(PyObject left)
Equivalent to the standard Python __radd__ method.
|
PyObject |
__rdiv__(PyObject left)
Equivalent to the standard Python __rdiv__ method
|
PyObject |
__rdivmod__(PyObject left)
Equivalent to the standard Python __rdivmod__ method
|
PyString |
__repr__()
Equivalent to the standard Python
__repr__ method. |
PyObject |
__rfloordiv__(PyObject left)
Equivalent to the standard Python __rfloordiv__ method
|
PyObject |
__rmod__(PyObject left)
Equivalent to the standard Python __rmod__ method
|
PyObject |
__rmul__(PyObject left)
Equivalent to the standard Python __rmul__ method.
|
PyObject |
__rpow__(PyObject left)
Equivalent to the standard Python __rpow__ method
|
PyObject |
__rsub__(PyObject left)
Equivalent to the standard Python __rsub__ method
|
PyObject |
__rtruediv__(PyObject left)
Equivalent to the standard Python __rtruediv__ method
|
PyString |
__str__()
Equivalent to the standard Python __str__ method.
|
PyObject |
__sub__(PyObject right)
Equivalent to the standard Python __sub__ method
|
java.lang.Object |
__tojava__(java.lang.Class<?> c)
Equivalent to the Jython __tojava__ method.
|
PyObject |
__truediv__(PyObject right)
Equivalent to the standard Python __truediv__ method
|
PyObject |
__trunc__()
Equivalent to the standard Python __trunc__ method.
|
PyTuple |
as_integer_ratio() |
double |
asDouble()
Convert this object into a double.
|
PyObject |
conjugate()
Equivalent to the standard Python conjugate method.
|
static java.lang.String |
float___getformat__(PyType type,
java.lang.String typestr) |
static void |
float___setformat__(PyType type,
java.lang.String typestr,
java.lang.String format) |
static PyObject |
float_fromhex(PyType type,
PyObject o) |
PyObject |
float_hex() |
static PyObject |
float_new(PyNewWrapper new_,
boolean init,
PyType subtype,
PyObject[] args,
java.lang.String[] keywords) |
PyObject |
getImag() |
PyObject |
getReal() |
double |
getValue() |
int |
hashCode() |
boolean |
is_integer() |
boolean |
isFinite()
Determine if this float is not infinity, nor NaN.
|
boolean |
isNumberType() |
java.lang.String |
toString() |
__and__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __coerce__, __contains__, __delattr__, __delattr__, __delete__, __delitem__, __delitem__, __delslice__, __delslice__, __dir__, __ensure_finalizer__, __findattr__, __findattr__, __findattr_ex__, __finditem__, __finditem__, __finditem__, __get__, __getattr__, __getattr__, __getitem__, __getitem__, __getslice__, __getslice__, __hash__, __hex__, __iadd__, __iand__, __idiv__, __idivmod__, __ifloordiv__, __ilshift__, __imod__, __imul__, __index__, __ior__, __ipow__, __irshift__, __isub__, __iter__, __iternext__, __itruediv__, __ixor__, __len__, __lshift__, __not__, __oct__, __or__, __pow__, __rand__, __reduce__, __reduce_ex__, __reduce_ex__, __rlshift__, __ror__, __rrshift__, __rshift__, __rxor__, __set__, __setattr__, __setattr__, __setitem__, __setitem__, __setitem__, __setslice__, __setslice__, __unicode__, __xor__, _add, _and, _callextra, _cmp, _div, _divmod, _doget, _doget, _doset, _eq, _floordiv, _ge, _gt, _iadd, _iand, _idiv, _idivmod, _ifloordiv, _ilshift, _imod, _imul, _in, _ior, _ipow, _irshift, _is, _isnot, _isub, _itruediv, _ixor, _jcall, _jcallexc, _jthrow, _le, _lshift, _lt, _mod, _mul, _ne, _notin, _or, _pow, _rshift, _sub, _truediv, _xor, asIndex, asIndex, asInt, asInt, asIterable, asLong, asLong, asName, asName, asString, asString, asStringOrNull, asStringOrNull, bit_length, delDict, delType, dispatch__init__, equals, fastGetClass, fastGetDict, getDict, getType, implementsDescrDelete, implementsDescrGet, implementsDescrSet, invoke, invoke, invoke, invoke, invoke, invoke, isCallable, isDataDescr, isIndex, isInteger, isMappingType, isSequenceType, noAttributeError, object___subclasshook__, readonlyAttributeError, setDict, setTypepublic static final PyType TYPE
public static volatile PyFloat.Format double_format
public static volatile PyFloat.Format float_format
public PyFloat(PyType subtype, double v)
public PyFloat(double v)
public PyFloat(float v)
public double getValue()
@ExposedNew public static PyObject float_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, java.lang.String[] keywords)
@ExposedGet(name="real",
doc="the real part of a complex number")
public PyObject getReal()
@ExposedGet(name="imag",
doc="the imaginary part of a complex number")
public PyObject getImag()
@ExposedClassMethod(doc="float.fromhex(string) -> float\n\nCreate a floating-point number from a hexadecimal string.\n>>> float.fromhex(\'0x1.ffffp10\')\n2047.984375\n>>> float.fromhex(\'-0x1p-1074\')\n-4.9406564584124654e-324") public static PyObject float_fromhex(PyType type, PyObject o)
@ExposedMethod(doc="float.hex() -> string\n\nReturn a hexadecimal representation of a floating-point number.\n>>> (-0.1).hex()\n\'-0x1.999999999999ap-4\'\n>>> 3.14159.hex()\n\'0x1.921f9f01b866ep+1\'") public PyObject float_hex()
public boolean isFinite()
public PyString __str__()
PyObjectPyObject) calls PyObject.__repr__(), making it unnecessary to override
__str__ in sub-classes of PyObject where both forms are the same. A
common choice is to provide the same implementation to __str__ and
toString, for consistency in the printed form of objects between Python and
Java.public PyString __repr__()
PyObject__repr__ method. Each sub-class of
PyObject is likely to re-define this method to provide for its own reproduction.public boolean __nonzero__()
PyObjectPyObject is considered true.__nonzero__ in class PyObjectpublic java.lang.Object __tojava__(java.lang.Class<?> c)
PyObjectPy.NoConversion if this
PyObject can not be converted to the desired Java class.__tojava__ in class PyObjectc - the Class to convert this PyObject to.public PyObject __eq__(PyObject other)
PyObjectpublic PyObject __ne__(PyObject other)
PyObjectpublic PyObject __gt__(PyObject other)
PyObjectpublic PyObject __ge__(PyObject other)
PyObjectpublic PyObject __lt__(PyObject other)
PyObjectpublic PyObject __le__(PyObject other)
PyObjectpublic int __cmp__(PyObject other)
PyObjectpublic java.lang.Object __coerce_ex__(PyObject other)
PyObject__coerce_ex__ in class PyObjectother - the other object involved in the coercionpublic PyObject __add__(PyObject right)
PyObjectpublic PyObject __radd__(PyObject left)
PyObjectpublic PyObject __sub__(PyObject right)
PyObjectpublic PyObject __rsub__(PyObject left)
PyObjectpublic PyObject __mul__(PyObject right)
PyObjectpublic PyObject __rmul__(PyObject left)
PyObjectpublic PyObject __div__(PyObject right)
PyObjectpublic PyObject __rdiv__(PyObject left)
PyObjectpublic PyObject __floordiv__(PyObject right)
PyObject__floordiv__ in class PyObjectright - the object to perform this binary operation with (the right-hand operand).public PyObject __rfloordiv__(PyObject left)
PyObject__rfloordiv__ in class PyObjectleft - the object to perform this binary operation with (the left-hand operand).public PyObject __truediv__(PyObject right)
PyObject__truediv__ in class PyObjectright - the object to perform this binary operation with (the right-hand operand).public PyObject __rtruediv__(PyObject left)
PyObject__rtruediv__ in class PyObjectleft - the object to perform this binary operation with (the left-hand operand).public PyObject __mod__(PyObject right)
PyObjectpublic PyObject __rmod__(PyObject left)
PyObjectpublic PyObject __divmod__(PyObject right)
PyObject__divmod__ in class PyObjectright - the object to perform this binary operation with (the right-hand operand).public PyObject __rdivmod__(PyObject left)
PyObject__rdivmod__ in class PyObjectleft - the object to perform this binary operation with (the left-hand operand).public PyObject __pow__(PyObject right, PyObject modulo)
PyObjectpublic PyObject __rpow__(PyObject left)
PyObjectpublic PyObject __neg__()
PyObjectpublic PyObject __pos__()
PyObjectpublic PyObject __invert__()
PyObject__invert__ in class PyObjectpublic PyObject __abs__()
PyObjectpublic PyObject __int__()
PyObjectpublic PyObject __long__()
PyObjectpublic PyFloat __float__()
PyObjectpublic PyObject __trunc__()
PyObjectpublic PyObject conjugate()
PyObjectpublic boolean is_integer()
public PyComplex __complex__()
PyObject__complex__ in class PyObjectpublic PyTuple __getnewargs__()
__getnewargs__ in class PyObjectpublic PyObject __format__(PyObject formatSpec)
__format__ in class PyObject@ExposedMethod(doc="float.as_integer_ratio() -> (int, int)\n\nReturns a pair of integers, whose ratio is exactly equal to the original\nfloat and with a positive denominator.\nRaises 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)") public PyTuple as_integer_ratio()
public double asDouble()
PyObjectpublic boolean isNumberType()
isNumberType in class PyObject@ExposedClassMethod(doc="float.__getformat__(typestr) -> string\n\nYou probably don\'t want to use this function. It exists mainly to be\nused in Python\'s test suite.\n\ntypestr must be \'double\' or \'float\'. This function returns whichever of\n\'unknown\', \'IEEE, big-endian\' or \'IEEE, little-endian\' best describes the\nformat of floating point numbers used by the C type named by typestr.") public static java.lang.String float___getformat__(PyType type, java.lang.String typestr)
@ExposedClassMethod(doc="float.__setformat__(typestr, fmt) -> None\n\nYou probably don\'t want to use this function. It exists mainly to be\nused in Python\'s test suite.\n\ntypestr must be \'double\' or \'float\'. fmt must be one of \'unknown\',\n\'IEEE, big-endian\' or \'IEEE, little-endian\', and in addition can only be\none of the latter two if it appears to match the underlying C reality.\n\nOverrides the automatic determination of C-level floating point type.\nThis affects how floats are converted to and from binary strings.") public static void float___setformat__(PyType type, java.lang.String typestr, java.lang.String format)