| Home | Trees | Index | Help |
|
|---|
| Module decimal :: Class Decimal |
|
object --+
|
Decimal
number| Method Summary | |
|---|---|
Returns the absolute value of self. | |
Returns self + other. | |
__cmp__(self,
other,
context)
| |
__copy__(self)
| |
__deepcopy__(self,
memo)
| |
Return self / other. | |
(self // other, self % other) | |
__eq__(self,
other)
| |
Float representation. | |
self // other | |
x.__hash__() <==> hash(x) | |
Converts self to an int, truncating if necessary. | |
Converts to a long. | |
self % other | |
Return self * other. | |
__ne__(self,
other)
| |
Returns a copy with the sign switched. | |
Create a decimal point instance. (Static method) | |
Is the number non-zero? | |
Returns a copy, unless it is a sNaN. | |
Return self ** n (mod modulo) | |
Returns self + other. | |
Swaps self/other and returns __div__. | |
Swaps self/other and returns __divmod__. | |
__reduce__(self)
| |
Represents the number as an instance of Decimal. | |
Swaps self/other and returns __floordiv__. | |
Swaps self/other and returns __mod__. | |
Return self * other. | |
Swaps self/other and returns __pow__. | |
Return other + (-self) | |
Swaps self/other and returns __div__. | |
Return string representation of the number in scientific notation. | |
Return self + (-other) | |
Return self / other. | |
Return the adjusted exponent of self | |
Represents the number as a triple tuple. | |
Compares one to another. | |
Returns the larger value. | |
Returns the smaller value. | |
Normalize- strip trailing 0s, change anything equal to 0 to 0e0 | |
Quantize self so its exponent is the same as that of exp. | |
Remainder nearest to 0- abs(remainder-near) <= other/2 | |
Test whether self and other have the same exponent. | |
Return the square root of self. | |
Convert to engineering-type string. | |
Rounds to the nearest integer, without raising inexact, rounded. | |
| Inherited from object | |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
| Class Variable Summary | |
|---|---|
tuple |
__slots__ = ('_exp', '_int', '_sign', '_is_special')
|
| Instance Method Details |
|---|
__abs__(self, round=1, context=None)Returns the absolute value of self. If the second argument is 0, do not round. |
__add__(self,
other,
context=None)
|
__div__(self, other, context=None)Return self / other. |
__divmod__(self, other, context=None)(self // other, self % other) |
__float__(self)Float representation. |
__floordiv__(self, other, context=None)self // other |
__hash__(self)
x.__hash__() <==> hash(x)
|
__int__(self)Converts self to an int, truncating if necessary. |
__long__(self)Converts to a long. Equivalent to long(int(self)) |
__mod__(self, other, context=None)self % other |
__mul__(self, other, context=None)Return self * other. (+-) INF * 0 (or its reverse) raise InvalidOperation. |
__neg__(self, context=None)Returns a copy with the sign switched. Rounds, if it has reason. |
__nonzero__(self)
|
__pos__(self, context=None)Returns a copy, unless it is a sNaN. Rounds the number (if more then precision digits) |
__pow__(self, n, modulo=None, context=None)Return self ** n (mod modulo) If modulo is None (default), don't take it mod modulo. |
__radd__(self,
other,
context=None)
|
__rdiv__(self, other, context=None)Swaps self/other and returns __div__. |
__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. (+-) INF * 0 (or its reverse) raise InvalidOperation. |
__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 __div__. |
__str__(self,
eng=0,
context=None)
|
__sub__(self,
other,
context=None)
Return self + (-other)
|
__truediv__(self, other, context=None)Return self / other. |
adjusted(self)Return the adjusted exponent of self |
as_tuple(self)Represents the number as a triple tuple. To show the internals exactly as they are. |
compare(self, 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(self, 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(self, 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(self, context=None)Normalize- strip trailing 0s, change anything equal to 0 to 0e0 |
quantize(self, 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(self, other, context=None)Remainder nearest to 0- abs(remainder-near) <= other/2 |
same_quantum(self, other)Test whether self and other have the same exponent. same as self._exp == other._exp, except NaN == sNaN |
sqrt(self, 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(self, 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(self, rounding=None, context=None)Rounds to the nearest integer, without raising inexact, rounded. |
| Static Method Details |
|---|
__new__(cls, value='0', context=None)Create a decimal point instance.>>> Decimal('3.14') # string input Decimal("3.14") >>> Decimal((0, (3, 1, 4), -2)) # tuple input (sign, digit_tuple, exponent) Decimal("3.14") >>> Decimal(314) # int or long Decimal("314") >>> Decimal(Decimal(314)) # another decimal instance Decimal("314")
|
| Class Variable Details |
|---|
__slots__
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Mon Aug 20 05:38:17 2007 | http://epydoc.sf.net |