Floating point class for decimal arithmetic.
There are no implemented interfaces.
There are no attributes in this class.
adjusted()
Return the adjusted exponent of self
as_tuple()
Represents the number as a triple tuple.
To show the internals exactly as they are.
compare(other, context=None)
Compares one to another.
-1 => a < b 0 => a = b 1 => a > b NaN => one is NaN Like __cmp__, but returns Decimal instances.
max(other, context=None)
Returns the larger value.
like max(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds.
min(other, context=None)
Returns the smaller value.
like min(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds.
normalize(context=None)
Normalize- strip trailing 0s, change anything equal to 0 to 0e0
quantize(exp, rounding=None, context=None, watchexp=1)
Quantize self so its exponent is the same as that of exp.
Similar to self._rescale(exp._exp) but with error checking.
remainder_near(other, context=None)
Remainder nearest to 0- abs(remainder-near) <= other/2
same_quantum(other)
Test whether self and other have the same exponent.
same as self._exp == other._exp, except NaN == sNaN
sqrt(context=None)
Return the square root of self.
Uses a converging algorithm (Xn+1 = 0.5*(Xn + self / Xn)) Should quadratically approach the right answer.
to_eng_string(context=None)
Convert to engineering-type string.
Engineering notation has an exponent which is a multiple of 3, so there are up to 3 digits left of the decimal place.
Same rules for when in exponential and when as a value as in __str__.
to_integral(rounding=None, context=None)
Rounds to the nearest integer, without raising inexact, rounded.
There are no known subclasses.