decimal.Decimal.compare_total()

compare_total(other, context=None) Compare two operands using their abstract representation rather than their numerical value. Similar to the compare() method, but the result gives a total ordering on Decimal instances. Two Decimal instances with the same numeric value but different representations compare unequal in this ordering: >>> Decimal('12.0').compare_total(Decimal('12')) Decimal('-1') Quiet and signaling NaNs are also included in the total ordering. The result of this func

decimal.Decimal.compare_total_mag()

compare_total_mag(other, context=None) Compare two operands using their abstract representation rather than their value as in compare_total(), but ignoring the sign of each operand. x.compare_total_mag(y) is equivalent to x.copy_abs().compare_total(y.copy_abs()). This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed. As an exception, the C version may raise InvalidOperation if the second operand cannot be converted exactly.

decimal.Decimal.compare()

compare(other, context=None) Compare the values of two Decimal instances. compare() returns a Decimal instance, and if either operand is a NaN then the result is a NaN: a or b is a NaN ==> Decimal('NaN') a < b ==> Decimal('-1') a == b ==> Decimal('0') a > b ==> Decimal('1')

decimal.Decimal.canonical()

canonical() Return the canonical encoding of the argument. Currently, the encoding of a Decimal instance is always canonical, so this operation returns its argument unchanged.

decimal.Decimal.as_tuple()

as_tuple() Return a named tuple representation of the number: DecimalTuple(sign, digits, exponent).

decimal.Decimal

class decimal.Decimal(value="0", context=None) Construct a new Decimal object based from value. value can be an integer, string, tuple, float, or another Decimal object. If no value is given, returns Decimal('0'). If value is a string, it should conform to the decimal numeric string syntax after leading and trailing whitespace characters are removed: sign ::= '+' | '-' digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' indicator ::= 'e' | 'E' digit

decimal.Decimal.adjusted()

adjusted() Return the adjusted exponent after shifting out the coefficient’s rightmost digits until only the lead digit remains: Decimal('321e+5').adjusted() returns seven. Used for determining the position of the most significant digit with respect to the decimal point.

decimal.Context.to_integral_exact()

to_integral_exact(x) Rounds to an integer.

decimal.Context.to_sci_string()

to_sci_string(x) Converts a number to a string using scientific notation.

decimal.Context.shift()

shift(x, y) Returns a shifted copy of x, y times.