Floating point class for decimal arithmetic.
|
__abs__(self,
round=True,
context=None)
Returns the absolute value of self. |
|
|
|
__add__(self,
other,
context=None)
Returns self + other. |
|
|
|
|
|
|
|
|
|
__div__(self,
other,
context=None)
Return self / other. |
|
|
|
__divmod__(self,
other,
context=None)
Return (self // other, self % other) |
|
|
|
__eq__(self,
other,
context=None) |
|
|
|
__float__(self)
Float representation. |
|
|
|
__floordiv__(self,
other,
context=None)
self // other |
|
|
|
__format__(self,
specifier,
context=None,
_localeconv=None)
Format a Decimal instance according to the given specifier. |
|
|
|
__ge__(self,
other,
context=None) |
|
|
|
__gt__(self,
other,
context=None) |
|
|
|
|
|
__int__(self)
Converts self to an int, truncating if necessary. |
|
|
|
__le__(self,
other,
context=None) |
|
|
|
|
|
__lt__(self,
other,
context=None) |
|
|
|
__mod__(self,
other,
context=None)
self % other |
|
|
|
__mul__(self,
other,
context=None)
Return self * other. |
|
|
|
__ne__(self,
other,
context=None) |
|
|
|
__neg__(self,
context=None)
Returns a copy with the sign switched. |
|
|
|
__nonzero__(self)
Return True if self is nonzero; otherwise return False. |
|
|
|
__pos__(self,
context=None)
Returns a copy, unless it is a sNaN. |
|
|
|
__pow__(self,
other,
modulo=None,
context=None)
Return self ** other [ % modulo]. |
|
|
|
__radd__(self,
other,
context=None)
Returns self + other. |
|
|
|
__rdiv__(self,
other,
context=None)
Swaps self/other and returns __truediv__. |
|
|
|
__rdivmod__(self,
other,
context=None)
Swaps self/other and returns __divmod__. |
|
|
|
|
|
__repr__(self)
Represents the number as an instance of Decimal. |
|
|
|
__rfloordiv__(self,
other,
context=None)
Swaps self/other and returns __floordiv__. |
|
|
|
__rmod__(self,
other,
context=None)
Swaps self/other and returns __mod__. |
|
|
|
__rmul__(self,
other,
context=None)
Return self * other. |
|
|
|
__rpow__(self,
other,
context=None)
Swaps self/other and returns __pow__. |
|
|
|
__rsub__(self,
other,
context=None)
Return other - self |
|
|
|
__rtruediv__(self,
other,
context=None)
Swaps self/other and returns __truediv__. |
|
|
|
__str__(self,
eng=False,
context=None)
Return string representation of the number in scientific notation. |
|
|
|
__sub__(self,
other,
context=None)
Return self - other |
|
|
|
__truediv__(self,
other,
context=None)
Return self / other. |
|
|
|
__trunc__(self)
Converts self to an int, truncating if necessary. |
|
|
|
_check_nans(self,
other=None,
context=None)
Returns whether the number is not actually one. |
|
|
|
_cmp(self,
other)
Compare the two non-NaN decimal instances self and other. |
|
|
|
_compare_check_nans(self,
other,
context)
Version of _check_nans used for the signaling comparisons
compare_signal, __le__, __lt__, __ge__, __gt__. |
|
|
|
_divide(self,
other,
context)
Return (self // other, self % other), to context.prec precision. |
|
|
|
_fill_logical(self,
context,
opa,
opb) |
|
|
|
_fix(self,
context)
Round if it is necessary to keep self within prec precision. |
|
|
|
_fix_nan(self,
context)
Decapitate the payload of a NaN to fit the context |
|
|
|
_iseven(self)
Returns True if self is even. |
|
|
|
_isinfinity(self)
Returns whether the number is infinite |
|
|
|
_isinteger(self)
Returns whether self is an integer |
|
|
|
_islogical(self)
Return True if self is a logical operand. |
|
|
|
_isnan(self)
Returns whether the number is not actually one. |
|
|
|
_ln_exp_bound(self)
Compute a lower bound for the adjusted exponent of self.ln(). |
|
|
|
_log10_exp_bound(self)
Compute a lower bound for the adjusted exponent of self.log10(). |
|
|
|
_power_exact(self,
other,
p)
Attempt to compute self**other exactly. |
|
|
|
_power_modulo(self,
other,
modulo,
context=None)
Three argument version of __pow__ |
|
|
|
_rescale(self,
exp,
rounding)
Rescale self so that the exponent is exp, either by padding with
zeros or by truncating digits, using the given rounding mode. |
|
|
|
_round(self,
places,
rounding)
Round a nonzero, nonspecial Decimal to a fixed number of significant
figures, using the given rounding mode. |
|
|
|
_round_05up(self,
prec)
Round down unless digit prec-1 is 0 or 5. |
|
|
|
_round_ceiling(self,
prec)
Rounds up (not away from 0 if negative.) |
|
|
|
_round_down(self,
prec)
Also known as round-towards-0, truncate. |
|
|
|
_round_floor(self,
prec)
Rounds down (not towards 0 if negative) |
|
|
|
_round_half_down(self,
prec)
Round 5 down |
|
|
|
_round_half_even(self,
prec)
Round 5 to even, rest to nearest. |
|
|
|
_round_half_up(self,
prec)
Rounds 5 up (away from 0) |
|
|
|
_round_up(self,
prec)
Rounds away from 0. |
|
|
|
adjusted(self)
Return the adjusted exponent of self |
|
|
|
as_tuple(self)
Represents the number as a triple tuple. |
|
|
|
canonical(self,
context=None)
Returns the same Decimal object. |
|
|
|
compare(self,
other,
context=None)
Compares one to another. |
|
|
|
compare_signal(self,
other,
context=None)
Compares self to the other operand numerically. |
|
|
|
compare_total(self,
other)
Compares self to other using the abstract representations. |
|
|
|
compare_total_mag(self,
other)
Compares self to other using abstract repr., ignoring sign. |
|
|
|
|
|
copy_abs(self)
Returns a copy with the sign set to 0. |
|
|
|
copy_negate(self)
Returns a copy with the sign inverted. |
|
|
|
copy_sign(self,
other)
Returns self with the sign of other. |
|
|
|
exp(self,
context=None)
Returns e ** self. |
|
|
|
fma(self,
other,
third,
context=None)
Fused multiply-add. |
|
|
|
is_canonical(self)
Return True if self is canonical; otherwise return False. |
|
|
|
is_finite(self)
Return True if self is finite; otherwise return False. |
|
|
|
is_infinite(self)
Return True if self is infinite; otherwise return False. |
|
|
|
is_nan(self)
Return True if self is a qNaN or sNaN; otherwise return False. |
|
|
|
is_normal(self,
context=None)
Return True if self is a normal number; otherwise return False. |
|
|
|
is_qnan(self)
Return True if self is a quiet NaN; otherwise return False. |
|
|
|
is_signed(self)
Return True if self is negative; otherwise return False. |
|
|
|
is_snan(self)
Return True if self is a signaling NaN; otherwise return False. |
|
|
|
is_subnormal(self,
context=None)
Return True if self is subnormal; otherwise return False. |
|
|
|
is_zero(self)
Return True if self is a zero; otherwise return False. |
|
|
|
ln(self,
context=None)
Returns the natural (base e) logarithm of self. |
|
|
|
log10(self,
context=None)
Returns the base 10 logarithm of self. |
|
|
|
logb(self,
context=None)
Returns the exponent of the magnitude of self's MSD. |
|
|
|
logical_and(self,
other,
context=None)
Applies an 'and' operation between self and other's digits. |
|
|
|
logical_invert(self,
context=None)
Invert all its digits. |
|
|
|
logical_or(self,
other,
context=None)
Applies an 'or' operation between self and other's digits. |
|
|
|
logical_xor(self,
other,
context=None)
Applies an 'xor' operation between self and other's digits. |
|
|
|
max(self,
other,
context=None)
Returns the larger value. |
|
|
|
max_mag(self,
other,
context=None)
Compares the values numerically with their sign ignored. |
|
|
|
min(self,
other,
context=None)
Returns the smaller value. |
|
|
|
min_mag(self,
other,
context=None)
Compares the values numerically with their sign ignored. |
|
|
|
next_minus(self,
context=None)
Returns the largest representable number smaller than itself. |
|
|
|
next_plus(self,
context=None)
Returns the smallest representable number larger than itself. |
|
|
|
next_toward(self,
other,
context=None)
Returns the number closest to self, in the direction towards other. |
|
|
|
normalize(self,
context=None)
Normalize- strip trailing 0s, change anything equal to 0 to 0e0 |
|
|
|
number_class(self,
context=None)
Returns an indication of the class of self. |
|
|
|
quantize(self,
exp,
rounding=None,
context=None,
watchexp=True)
Quantize self so its exponent is the same as that of exp. |
|
|
|
radix(self)
Just returns 10, as this is Decimal, :) |
|
|
|
remainder_near(self,
other,
context=None)
Remainder nearest to 0- abs(remainder-near) <= other/2 |
|
|
|
rotate(self,
other,
context=None)
Returns a rotated copy of self, value-of-other times. |
|
|
|
same_quantum(self,
other)
Return True if self and other have the same exponent; otherwise
return False. |
|
|
|
scaleb(self,
other,
context=None)
Returns self operand after adding the second value to its exp. |
|
|
|
shift(self,
other,
context=None)
Returns a shifted copy of self, value-of-other times. |
|
|
|
sqrt(self,
context=None)
Return the square root of self. |
|
|
|
to_eng_string(self,
context=None)
Convert to engineering-type string. |
|
|
|
to_integral(self,
rounding=None,
context=None)
Rounds to the nearest integer, without raising inexact, rounded. |
|
|
|
|
|
to_integral_value(self,
rounding=None,
context=None)
Rounds to the nearest integer, without raising inexact, rounded. |
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__init__ ,
__reduce_ex__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|