Top Description Inners Fields Constructors Methods
org.python.core

public Class PyFloat

extends PyObject
Class Inheritance
Known Direct Subclasses
org.python.core.PyFloatDerived
Annotations
@Untraversable
@ExposedType
name:float
doc:float(x) -> floating point number Convert a string or number to a floating point number, if possible.
Imports
java.io.Serializable, java.math.BigDecimal, org.python.core.stringlib.FloatFormatter, .InternalFormat, .InternalFormat.Formatter, .InternalFormat.Spec, org.python.expose.ExposedClassMethod, .ExposedGet, .ExposedMethod, .ExposedNew, .ExposedType, .MethodType, org.python.modules.math

A builtin python float.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
public static volatile PyFloat.Format
public static volatile PyFloat.Format
private static double
INT_LONG_BOUNDARY

Smallest value that cannot be represented as an int

pack-priv static final PyFloat
NAN

Constant float("nan").

pack-priv static final PyFloat
ONE

Constant float(1).

pack-priv static final InternalFormat.Spec
SPEC_REPR

Format specification used by repr().

pack-priv static final InternalFormat.Spec
SPEC_STR

Format specification used by str().

public static final PyType
private final double
pack-priv static final PyFloat
ZERO

Constant float(0).

Inherited from org.python.core.PyObject:
attributesgcMonitorGlobalobjtype

Constructor Summary

AccessConstructor and Description
public
PyFloat(PyType subtype, double v)

public
PyFloat(double v)

public
PyFloat(float v)

Method Summary

Modifier and TypeMethod and Description
public PyObject
__abs__()

Overrides org.python.core.PyObject.__abs__.

Equivalent to the standard Python __abs__ method.

public PyObject
__add__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__add__.

Equivalent to the standard Python __add__ method.

public int
__cmp__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__cmp__.

Equivalent to the standard Python __cmp__ method.

public Object
__coerce_ex__(PyObject
the other object involved in the coercion
other
)

Overrides org.python.core.PyObject.__coerce_ex__.

Implements numeric coercion

public PyComplex
__complex__()

Overrides org.python.core.PyObject.__complex__.

Equivalent to the standard Python __complex__ method.

public PyObject
__div__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__div__.

Equivalent to the standard Python __div__ method

public PyObject
__divmod__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__divmod__.

Equivalent to the standard Python __divmod__ method

public PyObject
__eq__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__eq__.

Equivalent to the standard Python __eq__ method.

public PyFloat
__float__()

Overrides org.python.core.PyObject.__float__.

Equivalent to the standard Python __float__ method.

public PyObject
__floordiv__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__floordiv__.

Equivalent to the standard Python __floordiv__ method

public PyObject
public PyObject
__ge__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__ge__.

Equivalent to the standard Python __ge__ method.

public PyTuple
public PyObject
__gt__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__gt__.

Equivalent to the standard Python __gt__ method.

public PyObject
__int__()

Overrides org.python.core.PyObject.__int__.

Equivalent to the standard Python __int__ method.

public PyObject
__invert__()

Overrides org.python.core.PyObject.__invert__.

Equivalent to the standard Python __invert__ method.

public PyObject
__le__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__le__.

Equivalent to the standard Python __le__ method.

public PyObject
__long__()

Overrides org.python.core.PyObject.__long__.

Equivalent to the standard Python __long__ method.

public PyObject
__lt__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__lt__.

Equivalent to the standard Python __lt__ method.

public PyObject
__mod__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__mod__.

Equivalent to the standard Python __mod__ method

public PyObject
__mul__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__mul__.

Equivalent to the standard Python __mul__ method.

public PyObject
__ne__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__ne__.

Equivalent to the standard Python __ne__ method.

public PyObject
__neg__()

Overrides org.python.core.PyObject.__neg__.

Equivalent to the standard Python __neg__ method.

public boolean
__nonzero__()

Overrides org.python.core.PyObject.__nonzero__.

Equivalent to the standard Python __nonzero__ method.

public PyObject
__pos__()

Overrides org.python.core.PyObject.__pos__.

Equivalent to the standard Python __pos__ method.

public PyObject
__pow__(PyObject
the power to raise this number to.
right
,
PyObject
the modulus to perform this operation in or null if no modulo is to be used
modulo
)

Overrides org.python.core.PyObject.__pow__.

Implements the three argument power function.

public PyObject
__radd__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__radd__.

Equivalent to the standard Python __radd__ method.

public PyObject
__rdiv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rdiv__.

Equivalent to the standard Python __rdiv__ method

public PyObject
__rdivmod__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rdivmod__.

Equivalent to the standard Python __rdivmod__ method

public PyString
__repr__()

Overrides org.python.core.PyObject.__repr__.

Equivalent to the standard Python __repr__ method.

public PyObject
__rfloordiv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rfloordiv__.

Equivalent to the standard Python __rfloordiv__ method

public PyObject
__rmod__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rmod__.

Equivalent to the standard Python __rmod__ method

public PyObject
__rmul__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rmul__.

Equivalent to the standard Python __rmul__ method.

public PyObject
__rpow__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rpow__.

Equivalent to the standard Python __rpow__ method

public PyObject
__rsub__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rsub__.

Equivalent to the standard Python __rsub__ method

public PyObject
__rtruediv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rtruediv__.

Equivalent to the standard Python __rtruediv__ method

public PyString
__str__()

Overrides org.python.core.PyObject.__str__.

Equivalent to the standard Python __str__ method.

public PyObject
__sub__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__sub__.

Equivalent to the standard Python __sub__ method

public Object
__tojava__(Class<?>
the Class to convert this PyObject to.
c
)

Overrides org.python.core.PyObject.__tojava__.

Equivalent to the Jython __tojava__ method.

public PyObject
__truediv__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__truediv__.

Equivalent to the standard Python __truediv__ method

public PyObject
__trunc__()

Overrides org.python.core.PyObject.__trunc__.

Equivalent to the standard Python __trunc__ method.

private static PyFloat
_pow(double v, double w)

public PyTuple
public double
asDouble()

Overrides org.python.core.PyObject.asDouble.

Convert this object into a double.

private static boolean
private static double
public PyObject
conjugate()

Overrides org.python.core.PyObject.conjugate.

Equivalent to the standard Python conjugate method.

pack-priv final PyObject
pack-priv final PyObject
pack-priv final int
pack-priv final PyObject
pack-priv final Object
float___coerce_ex__(PyObject other)

Coercion logic for float.

pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyFloat
pack-priv final PyObject
pack-priv final PyObject
public static String
pack-priv final PyTuple
pack-priv final int
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final boolean
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyString
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
public static void
float___setformat__(PyType type, String typestr, String format)

pack-priv final PyString
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
public static PyObject
public PyObject
pack-priv final boolean
public static PyObject
float_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)

private String

Returns:

formatted value
formatDouble
(InternalFormat.Spec
parsed format specification string
spec
)

Format this float according to the specification passed in. Supports __str__ and __repr__.

public PyObject
public PyObject
public double
public int
hashCode()

Overrides org.python.core.PyObject.hashCode.

Returns a hash code value for this object.

public boolean
public boolean
isFinite()

Determine if this float is not infinity, nor NaN.

public boolean
private static double

Returns:

x % y
modulo
(double
dividend
x
,
double
divisor
y
)

Python % operator: y = n*x + z.

pack-priv static FloatFormatter

Returns:

a formatter ready to use, or null if the type is not a floating point format type.
prepareFormatter
(InternalFormat.Spec
a parsed PEP-3101 format specification.
spec
)

Common code for PyFloat, PyInteger and PyLong to prepare a FloatFormatter from a parsed specification.

private String
public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

Inherited from org.python.core.PyObject:
__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____rawdir____reduce____reduce_ex____reduce_ex____rlshift____ror____rrshift____rshift____rxor____set____setattr____setattr____setitem____setitem____setitem____setslice____setslice____unicode____xor___add_and_basic_add_basic_and_basic_div_basic_divmod_basic_floordiv_basic_iadd_basic_iand_basic_idiv_basic_idivmod_basic_ifloordiv_basic_ilshift_basic_imod_basic_imul_basic_ior_basic_ipow_basic_irshift_basic_isub_basic_itruediv_basic_ixor_basic_lshift_basic_mod_basic_mul_basic_or_basic_pow_basic_rshift_basic_sub_basic_truediv_basic_xor_callextra_cmp_coerce_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_unsupportedop_xoradaptToCoerceTupleasIndexasIndexasIntasIntasIterableasLongasLongasNameasNameasStringasStringasStringOrNullasStringOrNullbit_lengthdelDictdelTypedispatch__init__equalsfastGetClassfastGetDictfinalizegetDictgetJavaProxygetTypeimpAttrimplementsDescrDeleteimplementsDescrGetimplementsDescrSetinvokeinvokeinvokeinvokeinvokeinvokeisCallableisDataDescrisIndexisIntegerisMappingTypeisSequenceTypejdontdelmergeClassDictmergeDictAttrmergeListAttrnoAttributeErrorobject___contains__object___delattr__object___delattr__object___findattr__object___format__object___getattribute__object___hash__object___init__object___new__object___reduce__object___reduce_ex__object___setattr__object___setattr__object___subclasshook__object_toStringproxyInitreadonlyAttributeErrorrunsupportedopMessagesetDictsetTypeunsupportedopMessage