Module decimal :: Class Decimal
[frames | no frames]

Type Decimal

object --+
         |
        Decimal

Known Subclasses:
currency

Floating point class for decimal arithmetic.
Method Summary
  adjusted(self)
Return the adjusted exponent of self
  as_tuple(self)
Represents the number as a triple tuple.
  compare(self, other, context)
Compares one to another.
  max(self, other, context)
Returns the larger value.
  min(self, other, context)
Returns the smaller value.
  normalize(self, context)
Normalize- strip trailing 0s, change anything equal to 0 to 0e0
  quantize(self, exp, rounding, context, watchexp)
Quantize self so its exponent is the same as that of exp.
  remainder_near(self, other, context)
Remainder nearest to 0- abs(remainder-near) <= other/2
  same_quantum(self, other)
Test whether self and other have the same exponent.
  sqrt(self, context)
Return the square root of self.
  to_eng_string(self, context)
Convert to engineering-type string.
  to_integral(self, rounding, context)
Rounds to the nearest integer, without raising inexact, rounded.

Instance Method Details

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.

Generated by Epydoc 2.1 on Mon Oct 9 12:40:55 2006 http://epydoc.sf.net