{
    "mode": "pydoc",
    "parameter": "_pydecimal",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/_pydecimal/json",
    "generated": "2026-06-02T15:05:56Z",
    "sections": {
        "NAME": {
            "content": "decimal\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/decimal.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This is an implementation of decimal floating point arithmetic based on\nthe General Decimal Arithmetic Specification:\n\nhttp://speleotrove.com/decimal/decarith.html\n\nand IEEE standard 854-1987:\n\nhttp://en.wikipedia.org/wiki/IEEE854-1987\n\nDecimal floating point has finite precision with arbitrarily large bounds.\n\nThe purpose of this module is to support arithmetic using familiar\n\"schoolhouse\" rules and to avoid some of the tricky representation\nissues associated with binary floating point.  The package is especially\nuseful for financial applications or for contexts where users have\nexpectations that are at odds with binary floating point (for instance,\nin binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead\nof 0.0; Decimal('1.00') % Decimal('0.1') returns the expected\nDecimal('0.00')).\n\nHere are some examples of using the decimal module:\n\n>>> from decimal import *\n>>> setcontext(ExtendedContext)\n>>> Decimal(0)\nDecimal('0')\n>>> Decimal('1')\nDecimal('1')\n>>> Decimal('-.0123')\nDecimal('-0.0123')\n>>> Decimal(123456)\nDecimal('123456')\n>>> Decimal('123.45e12345678')\nDecimal('1.2345E+12345680')\n>>> Decimal('1.33') + Decimal('1.27')\nDecimal('2.60')\n>>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41')\nDecimal('-2.20')\n>>> dig = Decimal(1)\n>>> print(dig / Decimal(3))\n0.333333333\n>>> getcontext().prec = 18\n>>> print(dig / Decimal(3))\n0.333333333333333333\n>>> print(dig.sqrt())\n1\n>>> print(Decimal(3).sqrt())\n1.73205080756887729\n>>> print(Decimal(3)  123)\n4.85192780976896427E+58\n>>> inf = Decimal(1) / Decimal(0)\n>>> print(inf)\nInfinity\n>>> neginf = Decimal(-1) / Decimal(0)\n>>> print(neginf)",
            "subsections": [
                {
                    "name": "-Infinity",
                    "content": ">>> print(neginf + inf)\nNaN\n>>> print(neginf * inf)"
                },
                {
                    "name": "-Infinity",
                    "content": ">>> print(dig / 0)\nInfinity\n>>> getcontext().traps[DivisionByZero] = 1\n>>> print(dig / 0)\nTraceback (most recent call last):\n...\n...\n...\ndecimal.DivisionByZero: x / 0\n>>> c = Context()\n>>> c.traps[InvalidOperation] = 0\n>>> print(c.flags[InvalidOperation])\n0\n>>> c.divide(Decimal(0), Decimal(0))\nDecimal('NaN')\n>>> c.traps[InvalidOperation] = 1\n>>> print(c.flags[InvalidOperation])\n1\n>>> c.flags[InvalidOperation] = 0\n>>> print(c.flags[InvalidOperation])\n0\n>>> print(c.divide(Decimal(0), Decimal(0)))\nTraceback (most recent call last):\n...\n...\n...\ndecimal.InvalidOperation: 0 / 0\n>>> print(c.flags[InvalidOperation])\n1\n>>> c.flags[InvalidOperation] = 0\n>>> c.traps[InvalidOperation] = 0\n>>> print(c.divide(Decimal(0), Decimal(0)))\nNaN\n>>> print(c.flags[InvalidOperation])\n1\n>>>\n"
                }
            ]
        },
        "CLASSES": {
            "content": "builtins.ArithmeticError(builtins.Exception)\nDecimalException\nClamped\nDivisionByZero(DecimalException, builtins.ZeroDivisionError)\nFloatOperation(DecimalException, builtins.TypeError)\nInexact\nOverflow(Inexact, Rounded)\nUnderflow(Inexact, Rounded, Subnormal)\nInvalidOperation\nConversionSyntax\nDivisionImpossible\nDivisionUndefined(InvalidOperation, builtins.ZeroDivisionError)\nInvalidContext\nRounded\nSubnormal\nbuiltins.object\nContext\nDecimal\nbuiltins.tuple(builtins.object)\nDecimalTuple\n",
            "subsections": [
                {
                    "name": "class Clamped",
                    "content": "|  Exponent of a 0 changed to fit bounds.\n|\n|  This occurs and signals clamped if the exponent of a result has been\n|  altered in order to fit the constraints of a specific concrete\n|  representation.  This may occur when the exponent of a zero result would\n|  be outside the bounds of a representation, or when a large normal\n|  number would have an encoded exponent that cannot be represented.  In\n|  this latter case, the exponent is reduced to fit and the corresponding\n|  number of zero digits are appended to the coefficient (\"fold-down\").\n|\n|  Method resolution order:\n|      Clamped\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from DecimalException:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Context",
                    "content": "|  Context(prec=None, rounding=None, Emin=None, Emax=None, capitals=None, clamp=None, flags=None, traps=None, ignoredflags=None)\n|\n|  Contains the context for a Decimal instance.\n|\n|  Contains:\n|  prec - precision (for use in rounding, division, square roots..)\n|  rounding - rounding type (how you round)\n|  traps - If traps[exception] = 1, then the exception is\n|                  raised when it is caused.  Otherwise, a value is\n|                  substituted in.\n|  flags  - When an exception is caused, flags[exception] is set.\n|           (Whether or not the trapenabler is set)\n|           Should be reset by user of Decimal instance.\n|  Emin -   Minimum exponent\n|  Emax -   Maximum exponent\n|  capitals -      If 1, 1*10^1 is printed as 1E+1.\n|                  If 0, printed as 1e1\n|  clamp -  If 1, change exponents if too high (Default 0)\n|\n|  Methods defined here:\n|\n|  Etiny(self)\n|      Returns Etiny (= Emin - prec + 1)\n|\n|  Etop(self)\n|      Returns maximum exponent (= Emax - prec + 1)\n|\n|  copy = copy(self)\n|\n|  delattr(self, name)\n|\n|  init(self, prec=None, rounding=None, Emin=None, Emax=None, capitals=None, clamp=None, flags=None, traps=None, ignoredflags=None)\n|\n|  reduce(self)\n|      # Support for pickling, copy, and deepcopy\n|\n|  repr(self)\n|      Show the current context.\n|\n|  setattr(self, name, value)\n|\n|  abs(self, a)\n|      Returns the absolute value of the operand.\n|\n|      If the operand is negative, the result is the same as using the minus\n|      operation on the operand.  Otherwise, the result is the same as using\n|      the plus operation on the operand.\n|\n|      >>> ExtendedContext.abs(Decimal('2.1'))\n|      Decimal('2.1')\n|      >>> ExtendedContext.abs(Decimal('-100'))\n|      Decimal('100')\n|      >>> ExtendedContext.abs(Decimal('101.5'))\n|      Decimal('101.5')\n|      >>> ExtendedContext.abs(Decimal('-101.5'))\n|      Decimal('101.5')\n|      >>> ExtendedContext.abs(-1)\n|      Decimal('1')\n|\n|  add(self, a, b)\n|      Return the sum of the two operands.\n|\n|      >>> ExtendedContext.add(Decimal('12'), Decimal('7.00'))\n|      Decimal('19.00')\n|      >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4'))\n|      Decimal('1.02E+4')\n|      >>> ExtendedContext.add(1, Decimal(2))\n|      Decimal('3')\n|      >>> ExtendedContext.add(Decimal(8), 5)\n|      Decimal('13')\n|      >>> ExtendedContext.add(5, 5)\n|      Decimal('10')\n|\n|  canonical(self, a)\n|      Returns the same Decimal object.\n|\n|      As we do not have different encodings for the same number, the\n|      received object already is in its canonical form.\n|\n|      >>> ExtendedContext.canonical(Decimal('2.50'))\n|      Decimal('2.50')\n|\n|  clearflags(self)\n|      Reset all flags to zero\n|\n|  cleartraps(self)\n|      Reset all traps to zero\n|\n|  compare(self, a, b)\n|      Compares values numerically.\n|\n|      If the signs of the operands differ, a value representing each operand\n|      ('-1' if the operand is less than zero, '0' if the operand is zero or\n|      negative zero, or '1' if the operand is greater than zero) is used in\n|      place of that operand for the comparison instead of the actual\n|      operand.\n|\n|      The comparison is then effected by subtracting the second operand from\n|      the first and then returning a value according to the result of the\n|      subtraction: '-1' if the result is less than zero, '0' if the result is\n|      zero or negative zero, or '1' if the result is greater than zero.\n|\n|      >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3'))\n|      Decimal('-1')\n|      >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1'))\n|      Decimal('0')\n|      >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10'))\n|      Decimal('0')\n|      >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1'))\n|      Decimal('1')\n|      >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3'))\n|      Decimal('1')\n|      >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1'))\n|      Decimal('-1')\n|      >>> ExtendedContext.compare(1, 2)\n|      Decimal('-1')\n|      >>> ExtendedContext.compare(Decimal(1), 2)\n|      Decimal('-1')\n|      >>> ExtendedContext.compare(1, Decimal(2))\n|      Decimal('-1')\n|\n|  comparesignal(self, a, b)\n|      Compares the values of the two operands numerically.\n|\n|      It's pretty much like compare(), but all NaNs signal, with signaling\n|      NaNs taking precedence over quiet NaNs.\n|\n|      >>> c = ExtendedContext\n|      >>> c.comparesignal(Decimal('2.1'), Decimal('3'))\n|      Decimal('-1')\n|      >>> c.comparesignal(Decimal('2.1'), Decimal('2.1'))\n|      Decimal('0')\n|      >>> c.flags[InvalidOperation] = 0\n|      >>> print(c.flags[InvalidOperation])\n|      0\n|      >>> c.comparesignal(Decimal('NaN'), Decimal('2.1'))\n|      Decimal('NaN')\n|      >>> print(c.flags[InvalidOperation])\n|      1\n|      >>> c.flags[InvalidOperation] = 0\n|      >>> print(c.flags[InvalidOperation])\n|      0\n|      >>> c.comparesignal(Decimal('sNaN'), Decimal('2.1'))\n|      Decimal('NaN')\n|      >>> print(c.flags[InvalidOperation])\n|      1\n|      >>> c.comparesignal(-1, 2)\n|      Decimal('-1')\n|      >>> c.comparesignal(Decimal(-1), 2)\n|      Decimal('-1')\n|      >>> c.comparesignal(-1, Decimal(2))\n|      Decimal('-1')\n|\n|  comparetotal(self, a, b)\n|      Compares two operands using their abstract representation.\n|\n|      This is not like the standard compare, which use their numerical\n|      value. Note that a total ordering is defined for all possible abstract\n|      representations.\n|\n|      >>> ExtendedContext.comparetotal(Decimal('12.73'), Decimal('127.9'))\n|      Decimal('-1')\n|      >>> ExtendedContext.comparetotal(Decimal('-127'),  Decimal('12'))\n|      Decimal('-1')\n|      >>> ExtendedContext.comparetotal(Decimal('12.30'), Decimal('12.3'))\n|      Decimal('-1')\n|      >>> ExtendedContext.comparetotal(Decimal('12.30'), Decimal('12.30'))\n|      Decimal('0')\n|      >>> ExtendedContext.comparetotal(Decimal('12.3'),  Decimal('12.300'))\n|      Decimal('1')\n|      >>> ExtendedContext.comparetotal(Decimal('12.3'),  Decimal('NaN'))\n|      Decimal('-1')\n|      >>> ExtendedContext.comparetotal(1, 2)\n|      Decimal('-1')\n|      >>> ExtendedContext.comparetotal(Decimal(1), 2)\n|      Decimal('-1')\n|      >>> ExtendedContext.comparetotal(1, Decimal(2))\n|      Decimal('-1')\n|\n|  comparetotalmag(self, a, b)\n|      Compares two operands using their abstract representation ignoring sign.\n|\n|      Like comparetotal, but with operand's sign ignored and assumed to be 0.\n|\n|  copy(self)\n|      Returns a deep copy from self.\n|\n|  copyabs(self, a)\n|      Returns a copy of the operand with the sign set to 0.\n|\n|      >>> ExtendedContext.copyabs(Decimal('2.1'))\n|      Decimal('2.1')\n|      >>> ExtendedContext.copyabs(Decimal('-100'))\n|      Decimal('100')\n|      >>> ExtendedContext.copyabs(-1)\n|      Decimal('1')\n|\n|  copydecimal(self, a)\n|      Returns a copy of the decimal object.\n|\n|      >>> ExtendedContext.copydecimal(Decimal('2.1'))\n|      Decimal('2.1')\n|      >>> ExtendedContext.copydecimal(Decimal('-1.00'))\n|      Decimal('-1.00')\n|      >>> ExtendedContext.copydecimal(1)\n|      Decimal('1')\n|\n|  copynegate(self, a)\n|      Returns a copy of the operand with the sign inverted.\n|\n|      >>> ExtendedContext.copynegate(Decimal('101.5'))\n|      Decimal('-101.5')\n|      >>> ExtendedContext.copynegate(Decimal('-101.5'))\n|      Decimal('101.5')\n|      >>> ExtendedContext.copynegate(1)\n|      Decimal('-1')\n|\n|  copysign(self, a, b)\n|      Copies the second operand's sign to the first one.\n|\n|      In detail, it returns a copy of the first operand with the sign\n|      equal to the sign of the second operand.\n|\n|      >>> ExtendedContext.copysign(Decimal( '1.50'), Decimal('7.33'))\n|      Decimal('1.50')\n|      >>> ExtendedContext.copysign(Decimal('-1.50'), Decimal('7.33'))\n|      Decimal('1.50')\n|      >>> ExtendedContext.copysign(Decimal( '1.50'), Decimal('-7.33'))\n|      Decimal('-1.50')\n|      >>> ExtendedContext.copysign(Decimal('-1.50'), Decimal('-7.33'))\n|      Decimal('-1.50')\n|      >>> ExtendedContext.copysign(1, -2)\n|      Decimal('-1')\n|      >>> ExtendedContext.copysign(Decimal(1), -2)\n|      Decimal('-1')\n|      >>> ExtendedContext.copysign(1, Decimal(-2))\n|      Decimal('-1')\n|\n|  createdecimal(self, num='0')\n|      Creates a new Decimal instance but using self as context.\n|\n|      This method implements the to-number operation of the\n|      IBM Decimal specification.\n|\n|  createdecimalfromfloat(self, f)\n|      Creates a new Decimal instance from a float but rounding using self\n|      as the context.\n|\n|      >>> context = Context(prec=5, rounding=ROUNDDOWN)\n|      >>> context.createdecimalfromfloat(3.1415926535897932)\n|      Decimal('3.1415')\n|      >>> context = Context(prec=5, traps=[Inexact])\n|      >>> context.createdecimalfromfloat(3.1415926535897932)\n|      Traceback (most recent call last):\n|          ...\n|      decimal.Inexact: None\n|\n|  divide(self, a, b)\n|      Decimal division in a specified context.\n|\n|      >>> ExtendedContext.divide(Decimal('1'), Decimal('3'))\n|      Decimal('0.333333333')\n|      >>> ExtendedContext.divide(Decimal('2'), Decimal('3'))\n|      Decimal('0.666666667')\n|      >>> ExtendedContext.divide(Decimal('5'), Decimal('2'))\n|      Decimal('2.5')\n|      >>> ExtendedContext.divide(Decimal('1'), Decimal('10'))\n|      Decimal('0.1')\n|      >>> ExtendedContext.divide(Decimal('12'), Decimal('12'))\n|      Decimal('1')\n|      >>> ExtendedContext.divide(Decimal('8.00'), Decimal('2'))\n|      Decimal('4.00')\n|      >>> ExtendedContext.divide(Decimal('2.400'), Decimal('2.0'))\n|      Decimal('1.20')\n|      >>> ExtendedContext.divide(Decimal('1000'), Decimal('100'))\n|      Decimal('10')\n|      >>> ExtendedContext.divide(Decimal('1000'), Decimal('1'))\n|      Decimal('1000')\n|      >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2'))\n|      Decimal('1.20E+6')\n|      >>> ExtendedContext.divide(5, 5)\n|      Decimal('1')\n|      >>> ExtendedContext.divide(Decimal(5), 5)\n|      Decimal('1')\n|      >>> ExtendedContext.divide(5, Decimal(5))\n|      Decimal('1')\n|\n|  divideint(self, a, b)\n|      Divides two numbers and returns the integer part of the result.\n|\n|      >>> ExtendedContext.divideint(Decimal('2'), Decimal('3'))\n|      Decimal('0')\n|      >>> ExtendedContext.divideint(Decimal('10'), Decimal('3'))\n|      Decimal('3')\n|      >>> ExtendedContext.divideint(Decimal('1'), Decimal('0.3'))\n|      Decimal('3')\n|      >>> ExtendedContext.divideint(10, 3)\n|      Decimal('3')\n|      >>> ExtendedContext.divideint(Decimal(10), 3)\n|      Decimal('3')\n|      >>> ExtendedContext.divideint(10, Decimal(3))\n|      Decimal('3')\n|\n|  divmod(self, a, b)\n|      Return (a // b, a % b).\n|\n|      >>> ExtendedContext.divmod(Decimal(8), Decimal(3))\n|      (Decimal('2'), Decimal('2'))\n|      >>> ExtendedContext.divmod(Decimal(8), Decimal(4))\n|      (Decimal('2'), Decimal('0'))\n|      >>> ExtendedContext.divmod(8, 4)\n|      (Decimal('2'), Decimal('0'))\n|      >>> ExtendedContext.divmod(Decimal(8), 4)\n|      (Decimal('2'), Decimal('0'))\n|      >>> ExtendedContext.divmod(8, Decimal(4))\n|      (Decimal('2'), Decimal('0'))\n|\n|  exp(self, a)\n|      Returns e  a.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> c.exp(Decimal('-Infinity'))\n|      Decimal('0')\n|      >>> c.exp(Decimal('-1'))\n|      Decimal('0.367879441')\n|      >>> c.exp(Decimal('0'))\n|      Decimal('1')\n|      >>> c.exp(Decimal('1'))\n|      Decimal('2.71828183')\n|      >>> c.exp(Decimal('0.693147181'))\n|      Decimal('2.00000000')\n|      >>> c.exp(Decimal('+Infinity'))\n|      Decimal('Infinity')\n|      >>> c.exp(10)\n|      Decimal('22026.4658')\n|\n|  fma(self, a, b, c)\n|      Returns a multiplied by b, plus c.\n|\n|      The first two operands are multiplied together, using multiply,\n|      the third operand is then added to the result of that\n|      multiplication, using add, all with only one final rounding.\n|\n|      >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7'))\n|      Decimal('22')\n|      >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7'))\n|      Decimal('-8')\n|      >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578'))\n|      Decimal('1.38435736E+12')\n|      >>> ExtendedContext.fma(1, 3, 4)\n|      Decimal('7')\n|      >>> ExtendedContext.fma(1, Decimal(3), 4)\n|      Decimal('7')\n|      >>> ExtendedContext.fma(1, 3, Decimal(4))\n|      Decimal('7')\n|\n|  iscanonical(self, a)\n|      Return True if the operand is canonical; otherwise return False.\n|\n|      Currently, the encoding of a Decimal instance is always\n|      canonical, so this method returns True for any Decimal.\n|\n|      >>> ExtendedContext.iscanonical(Decimal('2.50'))\n|      True\n|\n|  isfinite(self, a)\n|      Return True if the operand is finite; otherwise return False.\n|\n|      A Decimal instance is considered finite if it is neither\n|      infinite nor a NaN.\n|\n|      >>> ExtendedContext.isfinite(Decimal('2.50'))\n|      True\n|      >>> ExtendedContext.isfinite(Decimal('-0.3'))\n|      True\n|      >>> ExtendedContext.isfinite(Decimal('0'))\n|      True\n|      >>> ExtendedContext.isfinite(Decimal('Inf'))\n|      False\n|      >>> ExtendedContext.isfinite(Decimal('NaN'))\n|      False\n|      >>> ExtendedContext.isfinite(1)\n|      True\n|\n|  isinfinite(self, a)\n|      Return True if the operand is infinite; otherwise return False.\n|\n|      >>> ExtendedContext.isinfinite(Decimal('2.50'))\n|      False\n|      >>> ExtendedContext.isinfinite(Decimal('-Inf'))\n|      True\n|      >>> ExtendedContext.isinfinite(Decimal('NaN'))\n|      False\n|      >>> ExtendedContext.isinfinite(1)\n|      False\n|\n|  isnan(self, a)\n|      Return True if the operand is a qNaN or sNaN;\n|      otherwise return False.\n|\n|      >>> ExtendedContext.isnan(Decimal('2.50'))\n|      False\n|      >>> ExtendedContext.isnan(Decimal('NaN'))\n|      True\n|      >>> ExtendedContext.isnan(Decimal('-sNaN'))\n|      True\n|      >>> ExtendedContext.isnan(1)\n|      False\n|\n|  isnormal(self, a)\n|      Return True if the operand is a normal number;\n|      otherwise return False.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> c.isnormal(Decimal('2.50'))\n|      True\n|      >>> c.isnormal(Decimal('0.1E-999'))\n|      False\n|      >>> c.isnormal(Decimal('0.00'))\n|      False\n|      >>> c.isnormal(Decimal('-Inf'))\n|      False\n|      >>> c.isnormal(Decimal('NaN'))\n|      False\n|      >>> c.isnormal(1)\n|      True\n|\n|  isqnan(self, a)\n|      Return True if the operand is a quiet NaN; otherwise return False.\n|\n|      >>> ExtendedContext.isqnan(Decimal('2.50'))\n|      False\n|      >>> ExtendedContext.isqnan(Decimal('NaN'))\n|      True\n|      >>> ExtendedContext.isqnan(Decimal('sNaN'))\n|      False\n|      >>> ExtendedContext.isqnan(1)\n|      False\n|\n|  issigned(self, a)\n|      Return True if the operand is negative; otherwise return False.\n|\n|      >>> ExtendedContext.issigned(Decimal('2.50'))\n|      False\n|      >>> ExtendedContext.issigned(Decimal('-12'))\n|      True\n|      >>> ExtendedContext.issigned(Decimal('-0'))\n|      True\n|      >>> ExtendedContext.issigned(8)\n|      False\n|      >>> ExtendedContext.issigned(-8)\n|      True\n|\n|  issnan(self, a)\n|      Return True if the operand is a signaling NaN;\n|      otherwise return False.\n|\n|      >>> ExtendedContext.issnan(Decimal('2.50'))\n|      False\n|      >>> ExtendedContext.issnan(Decimal('NaN'))\n|      False\n|      >>> ExtendedContext.issnan(Decimal('sNaN'))\n|      True\n|      >>> ExtendedContext.issnan(1)\n|      False\n|\n|  issubnormal(self, a)\n|      Return True if the operand is subnormal; otherwise return False.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> c.issubnormal(Decimal('2.50'))\n|      False\n|      >>> c.issubnormal(Decimal('0.1E-999'))\n|      True\n|      >>> c.issubnormal(Decimal('0.00'))\n|      False\n|      >>> c.issubnormal(Decimal('-Inf'))\n|      False\n|      >>> c.issubnormal(Decimal('NaN'))\n|      False\n|      >>> c.issubnormal(1)\n|      False\n|\n|  iszero(self, a)\n|      Return True if the operand is a zero; otherwise return False.\n|\n|      >>> ExtendedContext.iszero(Decimal('0'))\n|      True\n|      >>> ExtendedContext.iszero(Decimal('2.50'))\n|      False\n|      >>> ExtendedContext.iszero(Decimal('-0E+2'))\n|      True\n|      >>> ExtendedContext.iszero(1)\n|      False\n|      >>> ExtendedContext.iszero(0)\n|      True\n|\n|  ln(self, a)\n|      Returns the natural (base e) logarithm of the operand.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> c.ln(Decimal('0'))\n|      Decimal('-Infinity')\n|      >>> c.ln(Decimal('1.000'))\n|      Decimal('0')\n|      >>> c.ln(Decimal('2.71828183'))\n|      Decimal('1.00000000')\n|      >>> c.ln(Decimal('10'))\n|      Decimal('2.30258509')\n|      >>> c.ln(Decimal('+Infinity'))\n|      Decimal('Infinity')\n|      >>> c.ln(1)\n|      Decimal('0')\n|\n|  log10(self, a)\n|      Returns the base 10 logarithm of the operand.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> c.log10(Decimal('0'))\n|      Decimal('-Infinity')\n|      >>> c.log10(Decimal('0.001'))\n|      Decimal('-3')\n|      >>> c.log10(Decimal('1.000'))\n|      Decimal('0')\n|      >>> c.log10(Decimal('2'))\n|      Decimal('0.301029996')\n|      >>> c.log10(Decimal('10'))\n|      Decimal('1')\n|      >>> c.log10(Decimal('70'))\n|      Decimal('1.84509804')\n|      >>> c.log10(Decimal('+Infinity'))\n|      Decimal('Infinity')\n|      >>> c.log10(0)\n|      Decimal('-Infinity')\n|      >>> c.log10(1)\n|      Decimal('0')\n|\n|  logb(self, a)\n|      Returns the exponent of the magnitude of the operand's MSD.\n|\n|      The result is the integer which is the exponent of the magnitude\n|      of the most significant digit of the operand (as though the\n|      operand were truncated to a single digit while maintaining the\n|      value of that digit and without limiting the resulting exponent).\n|\n|      >>> ExtendedContext.logb(Decimal('250'))\n|      Decimal('2')\n|      >>> ExtendedContext.logb(Decimal('2.50'))\n|      Decimal('0')\n|      >>> ExtendedContext.logb(Decimal('0.03'))\n|      Decimal('-2')\n|      >>> ExtendedContext.logb(Decimal('0'))\n|      Decimal('-Infinity')\n|      >>> ExtendedContext.logb(1)\n|      Decimal('0')\n|      >>> ExtendedContext.logb(10)\n|      Decimal('1')\n|      >>> ExtendedContext.logb(100)\n|      Decimal('2')\n|\n|  logicaland(self, a, b)\n|      Applies the logical operation 'and' between each operand's digits.\n|\n|      The operands must be both logical numbers.\n|\n|      >>> ExtendedContext.logicaland(Decimal('0'), Decimal('0'))\n|      Decimal('0')\n|      >>> ExtendedContext.logicaland(Decimal('0'), Decimal('1'))\n|      Decimal('0')\n|      >>> ExtendedContext.logicaland(Decimal('1'), Decimal('0'))\n|      Decimal('0')\n|      >>> ExtendedContext.logicaland(Decimal('1'), Decimal('1'))\n|      Decimal('1')\n|      >>> ExtendedContext.logicaland(Decimal('1100'), Decimal('1010'))\n|      Decimal('1000')\n|      >>> ExtendedContext.logicaland(Decimal('1111'), Decimal('10'))\n|      Decimal('10')\n|      >>> ExtendedContext.logicaland(110, 1101)\n|      Decimal('100')\n|      >>> ExtendedContext.logicaland(Decimal(110), 1101)\n|      Decimal('100')\n|      >>> ExtendedContext.logicaland(110, Decimal(1101))\n|      Decimal('100')\n|\n|  logicalinvert(self, a)\n|      Invert all the digits in the operand.\n|\n|      The operand must be a logical number.\n|\n|      >>> ExtendedContext.logicalinvert(Decimal('0'))\n|      Decimal('111111111')\n|      >>> ExtendedContext.logicalinvert(Decimal('1'))\n|      Decimal('111111110')\n|      >>> ExtendedContext.logicalinvert(Decimal('111111111'))\n|      Decimal('0')\n|      >>> ExtendedContext.logicalinvert(Decimal('101010101'))\n|      Decimal('10101010')\n|      >>> ExtendedContext.logicalinvert(1101)\n|      Decimal('111110010')\n|\n|  logicalor(self, a, b)\n|      Applies the logical operation 'or' between each operand's digits.\n|\n|      The operands must be both logical numbers.\n|\n|      >>> ExtendedContext.logicalor(Decimal('0'), Decimal('0'))\n|      Decimal('0')\n|      >>> ExtendedContext.logicalor(Decimal('0'), Decimal('1'))\n|      Decimal('1')\n|      >>> ExtendedContext.logicalor(Decimal('1'), Decimal('0'))\n|      Decimal('1')\n|      >>> ExtendedContext.logicalor(Decimal('1'), Decimal('1'))\n|      Decimal('1')\n|      >>> ExtendedContext.logicalor(Decimal('1100'), Decimal('1010'))\n|      Decimal('1110')\n|      >>> ExtendedContext.logicalor(Decimal('1110'), Decimal('10'))\n|      Decimal('1110')\n|      >>> ExtendedContext.logicalor(110, 1101)\n|      Decimal('1111')\n|      >>> ExtendedContext.logicalor(Decimal(110), 1101)\n|      Decimal('1111')\n|      >>> ExtendedContext.logicalor(110, Decimal(1101))\n|      Decimal('1111')\n|\n|  logicalxor(self, a, b)\n|      Applies the logical operation 'xor' between each operand's digits.\n|\n|      The operands must be both logical numbers.\n|\n|      >>> ExtendedContext.logicalxor(Decimal('0'), Decimal('0'))\n|      Decimal('0')\n|      >>> ExtendedContext.logicalxor(Decimal('0'), Decimal('1'))\n|      Decimal('1')\n|      >>> ExtendedContext.logicalxor(Decimal('1'), Decimal('0'))\n|      Decimal('1')\n|      >>> ExtendedContext.logicalxor(Decimal('1'), Decimal('1'))\n|      Decimal('0')\n|      >>> ExtendedContext.logicalxor(Decimal('1100'), Decimal('1010'))\n|      Decimal('110')\n|      >>> ExtendedContext.logicalxor(Decimal('1111'), Decimal('10'))\n|      Decimal('1101')\n|      >>> ExtendedContext.logicalxor(110, 1101)\n|      Decimal('1011')\n|      >>> ExtendedContext.logicalxor(Decimal(110), 1101)\n|      Decimal('1011')\n|      >>> ExtendedContext.logicalxor(110, Decimal(1101))\n|      Decimal('1011')\n|\n|  max(self, a, b)\n|      max compares two values numerically and returns the maximum.\n|\n|      If either operand is a NaN then the general rules apply.\n|      Otherwise, the operands are compared as though by the compare\n|      operation.  If they are numerically equal then the left-hand operand\n|      is chosen as the result.  Otherwise the maximum (closer to positive\n|      infinity) of the two operands is chosen as the result.\n|\n|      >>> ExtendedContext.max(Decimal('3'), Decimal('2'))\n|      Decimal('3')\n|      >>> ExtendedContext.max(Decimal('-10'), Decimal('3'))\n|      Decimal('3')\n|      >>> ExtendedContext.max(Decimal('1.0'), Decimal('1'))\n|      Decimal('1')\n|      >>> ExtendedContext.max(Decimal('7'), Decimal('NaN'))\n|      Decimal('7')\n|      >>> ExtendedContext.max(1, 2)\n|      Decimal('2')\n|      >>> ExtendedContext.max(Decimal(1), 2)\n|      Decimal('2')\n|      >>> ExtendedContext.max(1, Decimal(2))\n|      Decimal('2')\n|\n|  maxmag(self, a, b)\n|      Compares the values numerically with their sign ignored.\n|\n|      >>> ExtendedContext.maxmag(Decimal('7'), Decimal('NaN'))\n|      Decimal('7')\n|      >>> ExtendedContext.maxmag(Decimal('7'), Decimal('-10'))\n|      Decimal('-10')\n|      >>> ExtendedContext.maxmag(1, -2)\n|      Decimal('-2')\n|      >>> ExtendedContext.maxmag(Decimal(1), -2)\n|      Decimal('-2')\n|      >>> ExtendedContext.maxmag(1, Decimal(-2))\n|      Decimal('-2')\n|\n|  min(self, a, b)\n|      min compares two values numerically and returns the minimum.\n|\n|      If either operand is a NaN then the general rules apply.\n|      Otherwise, the operands are compared as though by the compare\n|      operation.  If they are numerically equal then the left-hand operand\n|      is chosen as the result.  Otherwise the minimum (closer to negative\n|      infinity) of the two operands is chosen as the result.\n|\n|      >>> ExtendedContext.min(Decimal('3'), Decimal('2'))\n|      Decimal('2')\n|      >>> ExtendedContext.min(Decimal('-10'), Decimal('3'))\n|      Decimal('-10')\n|      >>> ExtendedContext.min(Decimal('1.0'), Decimal('1'))\n|      Decimal('1.0')\n|      >>> ExtendedContext.min(Decimal('7'), Decimal('NaN'))\n|      Decimal('7')\n|      >>> ExtendedContext.min(1, 2)\n|      Decimal('1')\n|      >>> ExtendedContext.min(Decimal(1), 2)\n|      Decimal('1')\n|      >>> ExtendedContext.min(1, Decimal(29))\n|      Decimal('1')\n|\n|  minmag(self, a, b)\n|      Compares the values numerically with their sign ignored.\n|\n|      >>> ExtendedContext.minmag(Decimal('3'), Decimal('-2'))\n|      Decimal('-2')\n|      >>> ExtendedContext.minmag(Decimal('-3'), Decimal('NaN'))\n|      Decimal('-3')\n|      >>> ExtendedContext.minmag(1, -2)\n|      Decimal('1')\n|      >>> ExtendedContext.minmag(Decimal(1), -2)\n|      Decimal('1')\n|      >>> ExtendedContext.minmag(1, Decimal(-2))\n|      Decimal('1')\n|\n|  minus(self, a)\n|      Minus corresponds to unary prefix minus in Python.\n|\n|      The operation is evaluated using the same rules as subtract; the\n|      operation minus(a) is calculated as subtract('0', a) where the '0'\n|      has the same exponent as the operand.\n|\n|      >>> ExtendedContext.minus(Decimal('1.3'))\n|      Decimal('-1.3')\n|      >>> ExtendedContext.minus(Decimal('-1.3'))\n|      Decimal('1.3')\n|      >>> ExtendedContext.minus(1)\n|      Decimal('-1')\n|\n|  multiply(self, a, b)\n|      multiply multiplies two operands.\n|\n|      If either operand is a special value then the general rules apply.\n|      Otherwise, the operands are multiplied together\n|      ('long multiplication'), resulting in a number which may be as long as\n|      the sum of the lengths of the two operands.\n|\n|      >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3'))\n|      Decimal('3.60')\n|      >>> ExtendedContext.multiply(Decimal('7'), Decimal('3'))\n|      Decimal('21')\n|      >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8'))\n|      Decimal('0.72')\n|      >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0'))\n|      Decimal('-0.0')\n|      >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321'))\n|      Decimal('4.28135971E+11')\n|      >>> ExtendedContext.multiply(7, 7)\n|      Decimal('49')\n|      >>> ExtendedContext.multiply(Decimal(7), 7)\n|      Decimal('49')\n|      >>> ExtendedContext.multiply(7, Decimal(7))\n|      Decimal('49')\n|\n|  nextminus(self, a)\n|      Returns the largest representable number smaller than a.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> ExtendedContext.nextminus(Decimal('1'))\n|      Decimal('0.999999999')\n|      >>> c.nextminus(Decimal('1E-1007'))\n|      Decimal('0E-1007')\n|      >>> ExtendedContext.nextminus(Decimal('-1.00000003'))\n|      Decimal('-1.00000004')\n|      >>> c.nextminus(Decimal('Infinity'))\n|      Decimal('9.99999999E+999')\n|      >>> c.nextminus(1)\n|      Decimal('0.999999999')\n|\n|  nextplus(self, a)\n|      Returns the smallest representable number larger than a.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> ExtendedContext.nextplus(Decimal('1'))\n|      Decimal('1.00000001')\n|      >>> c.nextplus(Decimal('-1E-1007'))\n|      Decimal('-0E-1007')\n|      >>> ExtendedContext.nextplus(Decimal('-1.00000003'))\n|      Decimal('-1.00000002')\n|      >>> c.nextplus(Decimal('-Infinity'))\n|      Decimal('-9.99999999E+999')\n|      >>> c.nextplus(1)\n|      Decimal('1.00000001')\n|\n|  nexttoward(self, a, b)\n|      Returns the number closest to a, in direction towards b.\n|\n|      The result is the closest representable number from the first\n|      operand (but not the first operand) that is in the direction\n|      towards the second operand, unless the operands have the same\n|      value.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> c.nexttoward(Decimal('1'), Decimal('2'))\n|      Decimal('1.00000001')\n|      >>> c.nexttoward(Decimal('-1E-1007'), Decimal('1'))\n|      Decimal('-0E-1007')\n|      >>> c.nexttoward(Decimal('-1.00000003'), Decimal('0'))\n|      Decimal('-1.00000002')\n|      >>> c.nexttoward(Decimal('1'), Decimal('0'))\n|      Decimal('0.999999999')\n|      >>> c.nexttoward(Decimal('1E-1007'), Decimal('-100'))\n|      Decimal('0E-1007')\n|      >>> c.nexttoward(Decimal('-1.00000003'), Decimal('-10'))\n|      Decimal('-1.00000004')\n|      >>> c.nexttoward(Decimal('0.00'), Decimal('-0.0000'))\n|      Decimal('-0.00')\n|      >>> c.nexttoward(0, 1)\n|      Decimal('1E-1007')\n|      >>> c.nexttoward(Decimal(0), 1)\n|      Decimal('1E-1007')\n|      >>> c.nexttoward(0, Decimal(1))\n|      Decimal('1E-1007')\n|\n|  normalize(self, a)\n|      normalize reduces an operand to its simplest form.\n|\n|      Essentially a plus operation with all trailing zeros removed from the\n|      result.\n|\n|      >>> ExtendedContext.normalize(Decimal('2.1'))\n|      Decimal('2.1')\n|      >>> ExtendedContext.normalize(Decimal('-2.0'))\n|      Decimal('-2')\n|      >>> ExtendedContext.normalize(Decimal('1.200'))\n|      Decimal('1.2')\n|      >>> ExtendedContext.normalize(Decimal('-120'))\n|      Decimal('-1.2E+2')\n|      >>> ExtendedContext.normalize(Decimal('120.00'))\n|      Decimal('1.2E+2')\n|      >>> ExtendedContext.normalize(Decimal('0.00'))\n|      Decimal('0')\n|      >>> ExtendedContext.normalize(6)\n|      Decimal('6')\n|\n|  numberclass(self, a)\n|      Returns an indication of the class of the operand.\n|\n|      The class is one of the following strings:\n|        -sNaN\n|        -NaN\n|        -Infinity\n|        -Normal\n|        -Subnormal\n|        -Zero\n|        +Zero\n|        +Subnormal\n|        +Normal\n|        +Infinity\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> c.numberclass(Decimal('Infinity'))\n|      '+Infinity'\n|      >>> c.numberclass(Decimal('1E-10'))\n|      '+Normal'\n|      >>> c.numberclass(Decimal('2.50'))\n|      '+Normal'\n|      >>> c.numberclass(Decimal('0.1E-999'))\n|      '+Subnormal'\n|      >>> c.numberclass(Decimal('0'))\n|      '+Zero'\n|      >>> c.numberclass(Decimal('-0'))\n|      '-Zero'\n|      >>> c.numberclass(Decimal('-0.1E-999'))\n|      '-Subnormal'\n|      >>> c.numberclass(Decimal('-1E-10'))\n|      '-Normal'\n|      >>> c.numberclass(Decimal('-2.50'))\n|      '-Normal'\n|      >>> c.numberclass(Decimal('-Infinity'))\n|      '-Infinity'\n|      >>> c.numberclass(Decimal('NaN'))\n|      'NaN'\n|      >>> c.numberclass(Decimal('-NaN'))\n|      'NaN'\n|      >>> c.numberclass(Decimal('sNaN'))\n|      'sNaN'\n|      >>> c.numberclass(123)\n|      '+Normal'\n|\n|  plus(self, a)\n|      Plus corresponds to unary prefix plus in Python.\n|\n|      The operation is evaluated using the same rules as add; the\n|      operation plus(a) is calculated as add('0', a) where the '0'\n|      has the same exponent as the operand.\n|\n|      >>> ExtendedContext.plus(Decimal('1.3'))\n|      Decimal('1.3')\n|      >>> ExtendedContext.plus(Decimal('-1.3'))\n|      Decimal('-1.3')\n|      >>> ExtendedContext.plus(-1)\n|      Decimal('-1')\n|\n|  power(self, a, b, modulo=None)\n|      Raises a to the power of b, to modulo if given.\n|\n|      With two arguments, compute ab.  If a is negative then b\n|      must be integral.  The result will be inexact unless b is\n|      integral and the result is finite and can be expressed exactly\n|      in 'precision' digits.\n|\n|      With three arguments, compute (ab) % modulo.  For the\n|      three argument form, the following restrictions on the\n|      arguments hold:\n|\n|       - all three arguments must be integral\n|       - b must be nonnegative\n|       - at least one of a or b must be nonzero\n|       - modulo must be nonzero and have at most 'precision' digits\n|\n|      The result of pow(a, b, modulo) is identical to the result\n|      that would be obtained by computing (ab) % modulo with\n|      unbounded precision, but is computed more efficiently.  It is\n|      always exact.\n|\n|      >>> c = ExtendedContext.copy()\n|      >>> c.Emin = -999\n|      >>> c.Emax = 999\n|      >>> c.power(Decimal('2'), Decimal('3'))\n|      Decimal('8')\n|      >>> c.power(Decimal('-2'), Decimal('3'))\n|      Decimal('-8')\n|      >>> c.power(Decimal('2'), Decimal('-3'))\n|      Decimal('0.125')\n|      >>> c.power(Decimal('1.7'), Decimal('8'))\n|      Decimal('69.7575744')\n|      >>> c.power(Decimal('10'), Decimal('0.301029996'))\n|      Decimal('2.00000000')\n|      >>> c.power(Decimal('Infinity'), Decimal('-1'))\n|      Decimal('0')\n|      >>> c.power(Decimal('Infinity'), Decimal('0'))\n|      Decimal('1')\n|      >>> c.power(Decimal('Infinity'), Decimal('1'))\n|      Decimal('Infinity')\n|      >>> c.power(Decimal('-Infinity'), Decimal('-1'))\n|      Decimal('-0')\n|      >>> c.power(Decimal('-Infinity'), Decimal('0'))\n|      Decimal('1')\n|      >>> c.power(Decimal('-Infinity'), Decimal('1'))\n|      Decimal('-Infinity')\n|      >>> c.power(Decimal('-Infinity'), Decimal('2'))\n|      Decimal('Infinity')\n|      >>> c.power(Decimal('0'), Decimal('0'))\n|      Decimal('NaN')\n|\n|      >>> c.power(Decimal('3'), Decimal('7'), Decimal('16'))\n|      Decimal('11')\n|      >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16'))\n|      Decimal('-11')\n|      >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16'))\n|      Decimal('1')\n|      >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16'))\n|      Decimal('11')\n|      >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789'))\n|      Decimal('11729830')\n|      >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729'))\n|      Decimal('-0')\n|      >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537'))\n|      Decimal('1')\n|      >>> ExtendedContext.power(7, 7)\n|      Decimal('823543')\n|      >>> ExtendedContext.power(Decimal(7), 7)\n|      Decimal('823543')\n|      >>> ExtendedContext.power(7, Decimal(7), 2)\n|      Decimal('1')\n|\n|  quantize(self, a, b)\n|      Returns a value equal to 'a' (rounded), having the exponent of 'b'.\n|\n|      The coefficient of the result is derived from that of the left-hand\n|      operand.  It may be rounded using the current rounding setting (if the\n|      exponent is being increased), multiplied by a positive power of ten (if\n|      the exponent is being decreased), or is unchanged (if the exponent is\n|      already equal to that of the right-hand operand).\n|\n|      Unlike other operations, if the length of the coefficient after the\n|      quantize operation would be greater than precision then an Invalid\n|      operation condition is raised.  This guarantees that, unless there is\n|      an error condition, the exponent of the result of a quantize is always\n|      equal to that of the right-hand operand.\n|\n|      Also unlike other operations, quantize will never raise Underflow, even\n|      if the result is subnormal and inexact.\n|\n|      >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.001'))\n|      Decimal('2.170')\n|      >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.01'))\n|      Decimal('2.17')\n|      >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.1'))\n|      Decimal('2.2')\n|      >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+0'))\n|      Decimal('2')\n|      >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+1'))\n|      Decimal('0E+1')\n|      >>> ExtendedContext.quantize(Decimal('-Inf'), Decimal('Infinity'))\n|      Decimal('-Infinity')\n|      >>> ExtendedContext.quantize(Decimal('2'), Decimal('Infinity'))\n|      Decimal('NaN')\n|      >>> ExtendedContext.quantize(Decimal('-0.1'), Decimal('1'))\n|      Decimal('-0')\n|      >>> ExtendedContext.quantize(Decimal('-0'), Decimal('1e+5'))\n|      Decimal('-0E+5')\n|      >>> ExtendedContext.quantize(Decimal('+35236450.6'), Decimal('1e-2'))\n|      Decimal('NaN')\n|      >>> ExtendedContext.quantize(Decimal('-35236450.6'), Decimal('1e-2'))\n|      Decimal('NaN')\n|      >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-1'))\n|      Decimal('217.0')\n|      >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-0'))\n|      Decimal('217')\n|      >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+1'))\n|      Decimal('2.2E+2')\n|      >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+2'))\n|      Decimal('2E+2')\n|      >>> ExtendedContext.quantize(1, 2)\n|      Decimal('1')\n|      >>> ExtendedContext.quantize(Decimal(1), 2)\n|      Decimal('1')\n|      >>> ExtendedContext.quantize(1, Decimal(2))\n|      Decimal('1')\n|\n|  radix(self)\n|      Just returns 10, as this is Decimal, :)\n|\n|      >>> ExtendedContext.radix()\n|      Decimal('10')\n|\n|  remainder(self, a, b)\n|      Returns the remainder from integer division.\n|\n|      The result is the residue of the dividend after the operation of\n|      calculating integer division as described for divide-integer, rounded\n|      to precision digits if necessary.  The sign of the result, if\n|      non-zero, is the same as that of the original dividend.\n|\n|      This operation will fail under the same conditions as integer division\n|      (that is, if integer division on the same two operands would fail, the\n|      remainder cannot be calculated).\n|\n|      >>> ExtendedContext.remainder(Decimal('2.1'), Decimal('3'))\n|      Decimal('2.1')\n|      >>> ExtendedContext.remainder(Decimal('10'), Decimal('3'))\n|      Decimal('1')\n|      >>> ExtendedContext.remainder(Decimal('-10'), Decimal('3'))\n|      Decimal('-1')\n|      >>> ExtendedContext.remainder(Decimal('10.2'), Decimal('1'))\n|      Decimal('0.2')\n|      >>> ExtendedContext.remainder(Decimal('10'), Decimal('0.3'))\n|      Decimal('0.1')\n|      >>> ExtendedContext.remainder(Decimal('3.6'), Decimal('1.3'))\n|      Decimal('1.0')\n|      >>> ExtendedContext.remainder(22, 6)\n|      Decimal('4')\n|      >>> ExtendedContext.remainder(Decimal(22), 6)\n|      Decimal('4')\n|      >>> ExtendedContext.remainder(22, Decimal(6))\n|      Decimal('4')\n|\n|  remaindernear(self, a, b)\n|      Returns to be \"a - b * n\", where n is the integer nearest the exact\n|      value of \"x / b\" (if two integers are equally near then the even one\n|      is chosen).  If the result is equal to 0 then its sign will be the\n|      sign of a.\n|\n|      This operation will fail under the same conditions as integer division\n|      (that is, if integer division on the same two operands would fail, the\n|      remainder cannot be calculated).\n|\n|      >>> ExtendedContext.remaindernear(Decimal('2.1'), Decimal('3'))\n|      Decimal('-0.9')\n|      >>> ExtendedContext.remaindernear(Decimal('10'), Decimal('6'))\n|      Decimal('-2')\n|      >>> ExtendedContext.remaindernear(Decimal('10'), Decimal('3'))\n|      Decimal('1')\n|      >>> ExtendedContext.remaindernear(Decimal('-10'), Decimal('3'))\n|      Decimal('-1')\n|      >>> ExtendedContext.remaindernear(Decimal('10.2'), Decimal('1'))\n|      Decimal('0.2')\n|      >>> ExtendedContext.remaindernear(Decimal('10'), Decimal('0.3'))\n|      Decimal('0.1')\n|      >>> ExtendedContext.remaindernear(Decimal('3.6'), Decimal('1.3'))\n|      Decimal('-0.3')\n|      >>> ExtendedContext.remaindernear(3, 11)\n|      Decimal('3')\n|      >>> ExtendedContext.remaindernear(Decimal(3), 11)\n|      Decimal('3')\n|      >>> ExtendedContext.remaindernear(3, Decimal(11))\n|      Decimal('3')\n|\n|  rotate(self, a, b)\n|      Returns a rotated copy of a, b times.\n|\n|      The coefficient of the result is a rotated copy of the digits in\n|      the coefficient of the first operand.  The number of places of\n|      rotation is taken from the absolute value of the second operand,\n|      with the rotation being to the left if the second operand is\n|      positive or to the right otherwise.\n|\n|      >>> ExtendedContext.rotate(Decimal('34'), Decimal('8'))\n|      Decimal('400000003')\n|      >>> ExtendedContext.rotate(Decimal('12'), Decimal('9'))\n|      Decimal('12')\n|      >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2'))\n|      Decimal('891234567')\n|      >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0'))\n|      Decimal('123456789')\n|      >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2'))\n|      Decimal('345678912')\n|      >>> ExtendedContext.rotate(1333333, 1)\n|      Decimal('13333330')\n|      >>> ExtendedContext.rotate(Decimal(1333333), 1)\n|      Decimal('13333330')\n|      >>> ExtendedContext.rotate(1333333, Decimal(1))\n|      Decimal('13333330')\n|\n|  samequantum(self, a, b)\n|      Returns True if the two operands have the same exponent.\n|\n|      The result is never affected by either the sign or the coefficient of\n|      either operand.\n|\n|      >>> ExtendedContext.samequantum(Decimal('2.17'), Decimal('0.001'))\n|      False\n|      >>> ExtendedContext.samequantum(Decimal('2.17'), Decimal('0.01'))\n|      True\n|      >>> ExtendedContext.samequantum(Decimal('2.17'), Decimal('1'))\n|      False\n|      >>> ExtendedContext.samequantum(Decimal('Inf'), Decimal('-Inf'))\n|      True\n|      >>> ExtendedContext.samequantum(10000, -1)\n|      True\n|      >>> ExtendedContext.samequantum(Decimal(10000), -1)\n|      True\n|      >>> ExtendedContext.samequantum(10000, Decimal(-1))\n|      True\n|\n|  scaleb(self, a, b)\n|      Returns the first operand after adding the second value its exp.\n|\n|      >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2'))\n|      Decimal('0.0750')\n|      >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0'))\n|      Decimal('7.50')\n|      >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3'))\n|      Decimal('7.50E+3')\n|      >>> ExtendedContext.scaleb(1, 4)\n|      Decimal('1E+4')\n|      >>> ExtendedContext.scaleb(Decimal(1), 4)\n|      Decimal('1E+4')\n|      >>> ExtendedContext.scaleb(1, Decimal(4))\n|      Decimal('1E+4')\n|\n|  shift(self, a, b)\n|      Returns a shifted copy of a, b times.\n|\n|      The coefficient of the result is a shifted copy of the digits\n|      in the coefficient of the first operand.  The number of places\n|      to shift is taken from the absolute value of the second operand,\n|      with the shift being to the left if the second operand is\n|      positive or to the right otherwise.  Digits shifted into the\n|      coefficient are zeros.\n|\n|      >>> ExtendedContext.shift(Decimal('34'), Decimal('8'))\n|      Decimal('400000000')\n|      >>> ExtendedContext.shift(Decimal('12'), Decimal('9'))\n|      Decimal('0')\n|      >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2'))\n|      Decimal('1234567')\n|      >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0'))\n|      Decimal('123456789')\n|      >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2'))\n|      Decimal('345678900')\n|      >>> ExtendedContext.shift(88888888, 2)\n|      Decimal('888888800')\n|      >>> ExtendedContext.shift(Decimal(88888888), 2)\n|      Decimal('888888800')\n|      >>> ExtendedContext.shift(88888888, Decimal(2))\n|      Decimal('888888800')\n|\n|  sqrt(self, a)\n|      Square root of a non-negative number to context precision.\n|\n|      If the result must be inexact, it is rounded using the round-half-even\n|      algorithm.\n|\n|      >>> ExtendedContext.sqrt(Decimal('0'))\n|      Decimal('0')\n|      >>> ExtendedContext.sqrt(Decimal('-0'))\n|      Decimal('-0')\n|      >>> ExtendedContext.sqrt(Decimal('0.39'))\n|      Decimal('0.624499800')\n|      >>> ExtendedContext.sqrt(Decimal('100'))\n|      Decimal('10')\n|      >>> ExtendedContext.sqrt(Decimal('1'))\n|      Decimal('1')\n|      >>> ExtendedContext.sqrt(Decimal('1.0'))\n|      Decimal('1.0')\n|      >>> ExtendedContext.sqrt(Decimal('1.00'))\n|      Decimal('1.0')\n|      >>> ExtendedContext.sqrt(Decimal('7'))\n|      Decimal('2.64575131')\n|      >>> ExtendedContext.sqrt(Decimal('10'))\n|      Decimal('3.16227766')\n|      >>> ExtendedContext.sqrt(2)\n|      Decimal('1.41421356')\n|      >>> ExtendedContext.prec\n|      9\n|\n|  subtract(self, a, b)\n|      Return the difference between the two operands.\n|\n|      >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.07'))\n|      Decimal('0.23')\n|      >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.30'))\n|      Decimal('0.00')\n|      >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('2.07'))\n|      Decimal('-0.77')\n|      >>> ExtendedContext.subtract(8, 5)\n|      Decimal('3')\n|      >>> ExtendedContext.subtract(Decimal(8), 5)\n|      Decimal('3')\n|      >>> ExtendedContext.subtract(8, Decimal(5))\n|      Decimal('3')\n|\n|  toengstring(self, a)\n|      Convert to a string, using engineering notation if an exponent is needed.\n|\n|      Engineering notation has an exponent which is a multiple of 3.  This\n|      can leave up to 3 digits to the left of the decimal place and may\n|      require the addition of either one or two trailing zeros.\n|\n|      The operation is not affected by the context.\n|\n|      >>> ExtendedContext.toengstring(Decimal('123E+1'))\n|      '1.23E+3'\n|      >>> ExtendedContext.toengstring(Decimal('123E+3'))\n|      '123E+3'\n|      >>> ExtendedContext.toengstring(Decimal('123E-10'))\n|      '12.3E-9'\n|      >>> ExtendedContext.toengstring(Decimal('-123E-12'))\n|      '-123E-12'\n|      >>> ExtendedContext.toengstring(Decimal('7E-7'))\n|      '700E-9'\n|      >>> ExtendedContext.toengstring(Decimal('7E+1'))\n|      '70'\n|      >>> ExtendedContext.toengstring(Decimal('0E+1'))\n|      '0.00E+3'\n|\n|  tointegral = tointegralvalue(self, a)\n|\n|  tointegralexact(self, a)\n|      Rounds to an integer.\n|\n|      When the operand has a negative exponent, the result is the same\n|      as using the quantize() operation using the given operand as the\n|      left-hand-operand, 1E+0 as the right-hand-operand, and the precision\n|      of the operand as the precision setting; Inexact and Rounded flags\n|      are allowed in this operation.  The rounding mode is taken from the\n|      context.\n|\n|      >>> ExtendedContext.tointegralexact(Decimal('2.1'))\n|      Decimal('2')\n|      >>> ExtendedContext.tointegralexact(Decimal('100'))\n|      Decimal('100')\n|      >>> ExtendedContext.tointegralexact(Decimal('100.0'))\n|      Decimal('100')\n|      >>> ExtendedContext.tointegralexact(Decimal('101.5'))\n|      Decimal('102')\n|      >>> ExtendedContext.tointegralexact(Decimal('-101.5'))\n|      Decimal('-102')\n|      >>> ExtendedContext.tointegralexact(Decimal('10E+5'))\n|      Decimal('1.0E+6')\n|      >>> ExtendedContext.tointegralexact(Decimal('7.89E+77'))\n|      Decimal('7.89E+77')\n|      >>> ExtendedContext.tointegralexact(Decimal('-Inf'))\n|      Decimal('-Infinity')\n|\n|  tointegralvalue(self, a)\n|      Rounds to an integer.\n|\n|      When the operand has a negative exponent, the result is the same\n|      as using the quantize() operation using the given operand as the\n|      left-hand-operand, 1E+0 as the right-hand-operand, and the precision\n|      of the operand as the precision setting, except that no flags will\n|      be set.  The rounding mode is taken from the context.\n|\n|      >>> ExtendedContext.tointegralvalue(Decimal('2.1'))\n|      Decimal('2')\n|      >>> ExtendedContext.tointegralvalue(Decimal('100'))\n|      Decimal('100')\n|      >>> ExtendedContext.tointegralvalue(Decimal('100.0'))\n|      Decimal('100')\n|      >>> ExtendedContext.tointegralvalue(Decimal('101.5'))\n|      Decimal('102')\n|      >>> ExtendedContext.tointegralvalue(Decimal('-101.5'))\n|      Decimal('-102')\n|      >>> ExtendedContext.tointegralvalue(Decimal('10E+5'))\n|      Decimal('1.0E+6')\n|      >>> ExtendedContext.tointegralvalue(Decimal('7.89E+77'))\n|      Decimal('7.89E+77')\n|      >>> ExtendedContext.tointegralvalue(Decimal('-Inf'))\n|      Decimal('-Infinity')\n|\n|  toscistring(self, a)\n|      Converts a number to a string, using scientific notation.\n|\n|      The operation is not affected by the context.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  hash = None\n"
                },
                {
                    "name": "class ConversionSyntax",
                    "content": "|  Trying to convert badly formed string.\n|\n|  This occurs and signals invalid-operation if a string is being\n|  converted to a number and it does not conform to the numeric string\n|  syntax.  The result is [0,qNaN].\n|\n|  Method resolution order:\n|      ConversionSyntax\n|      InvalidOperation\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Decimal",
                    "content": "|  Decimal(value='0', context=None)\n|\n|  Floating point class for decimal arithmetic.\n|\n|  Methods defined here:\n|\n|  abs(self, round=True, context=None)\n|      Returns the absolute value of self.\n|\n|      If the keyword argument 'round' is false, do not round.  The\n|      expression self.abs(round=False) is equivalent to\n|      self.copyabs().\n|\n|  add(self, other, context=None)\n|      Returns self + other.\n|\n|      -INF + INF (or the reverse) cause InvalidOperation errors.\n|\n|  bool(self)\n|      Return True if self is nonzero; otherwise return False.\n|\n|      NaNs and infinities are considered nonzero.\n|\n|  ceil(self)\n|      Return the ceiling of self, as an integer.\n|\n|      For a finite Decimal instance self, return the least integer n\n|      such that n >= self.  If self is infinite or a NaN then a\n|      Python exception is raised.\n|\n|  complex(self)\n|\n|  copy(self)\n|\n|  deepcopy(self, memo)\n|\n|  divmod(self, other, context=None)\n|      Return (self // other, self % other)\n|\n|  eq(self, other, context=None)\n|\n|  float(self)\n|      Float representation.\n|\n|  floor(self)\n|      Return the floor of self, as an integer.\n|\n|      For a finite Decimal instance self, return the greatest\n|      integer n such that n <= self.  If self is infinite or a NaN\n|      then a Python exception is raised.\n|\n|  floordiv(self, other, context=None)\n|      self // other\n|\n|  format(self, specifier, context=None, localeconv=None)\n|      Format a Decimal instance according to the given specifier.\n|\n|      The specifier should be a standard format specifier, with the\n|      form described in PEP 3101.  Formatting types 'e', 'E', 'f',\n|      'F', 'g', 'G', 'n' and '%' are supported.  If the formatting\n|      type is omitted it defaults to 'g' or 'G', depending on the\n|      value of context.capitals.\n|\n|  ge(self, other, context=None)\n|\n|  gt(self, other, context=None)\n|\n|  hash(self)\n|      x.hash() <==> hash(x)\n|\n|  int(self)\n|      Converts self to an int, truncating if necessary.\n|\n|  le(self, other, context=None)\n|\n|  lt(self, other, context=None)\n|\n|  mod(self, other, context=None)\n|      self % other\n|\n|  mul(self, other, context=None)\n|      Return self * other.\n|\n|      (+-) INF * 0 (or its reverse) raise InvalidOperation.\n|\n|  neg(self, context=None)\n|      Returns a copy with the sign switched.\n|\n|      Rounds, if it has reason.\n|\n|  pos(self, context=None)\n|      Returns a copy, unless it is a sNaN.\n|\n|      Rounds the number (if more than precision digits)\n|\n|  pow(self, other, modulo=None, context=None)\n|      Return self  other [ % modulo].\n|\n|      With two arguments, compute selfother.\n|\n|      With three arguments, compute (selfother) % modulo.  For the\n|      three argument form, the following restrictions on the\n|      arguments hold:\n|\n|       - all three arguments must be integral\n|       - other must be nonnegative\n|       - either self or other (or both) must be nonzero\n|       - modulo must be nonzero and must have at most p digits,\n|         where p is the context precision.\n|\n|      If any of these restrictions is violated the InvalidOperation\n|      flag is raised.\n|\n|      The result of pow(self, other, modulo) is identical to the\n|      result that would be obtained by computing (selfother) %\n|      modulo with unbounded precision, but is computed more\n|      efficiently.  It is always exact.\n|\n|  radd = add(self, other, context=None)\n|\n|  rdivmod(self, other, context=None)\n|      Swaps self/other and returns divmod.\n|\n|  reduce(self)\n|      # Support for pickling, copy, and deepcopy\n|\n|  repr(self)\n|      Represents the number as an instance of Decimal.\n|\n|  rfloordiv(self, other, context=None)\n|      Swaps self/other and returns floordiv.\n|\n|  rmod(self, other, context=None)\n|      Swaps self/other and returns mod.\n|\n|  rmul = mul(self, other, context=None)\n|\n|  round(self, n=None)\n|      Round self to the nearest integer, or to a given precision.\n|\n|      If only one argument is supplied, round a finite Decimal\n|      instance self to the nearest integer.  If self is infinite or\n|      a NaN then a Python exception is raised.  If self is finite\n|      and lies exactly halfway between two integers then it is\n|      rounded to the integer with even last digit.\n|\n|      >>> round(Decimal('123.456'))\n|      123\n|      >>> round(Decimal('-456.789'))\n|      -457\n|      >>> round(Decimal('-3.0'))\n|      -3\n|      >>> round(Decimal('2.5'))\n|      2\n|      >>> round(Decimal('3.5'))\n|      4\n|      >>> round(Decimal('Inf'))\n|      Traceback (most recent call last):\n|        ...\n|      OverflowError: cannot round an infinity\n|      >>> round(Decimal('NaN'))\n|      Traceback (most recent call last):\n|        ...\n|      ValueError: cannot round a NaN\n|\n|      If a second argument n is supplied, self is rounded to n\n|      decimal places using the rounding mode for the current\n|      context.\n|\n|      For an integer n, round(self, -n) is exactly equivalent to\n|      self.quantize(Decimal('1En')).\n|\n|      >>> round(Decimal('123.456'), 0)\n|      Decimal('123')\n|      >>> round(Decimal('123.456'), 2)\n|      Decimal('123.46')\n|      >>> round(Decimal('123.456'), -2)\n|      Decimal('1E+2')\n|      >>> round(Decimal('-Infinity'), 37)\n|      Decimal('NaN')\n|      >>> round(Decimal('sNaN123'), 0)\n|      Decimal('NaN123')\n|\n|  rpow(self, other, context=None)\n|      Swaps self/other and returns pow.\n|\n|  rsub(self, other, context=None)\n|      Return other - self\n|\n|  rtruediv(self, other, context=None)\n|      Swaps self/other and returns truediv.\n|\n|  str(self, eng=False, context=None)\n|      Return string representation of the number in scientific notation.\n|\n|      Captures all of the information in the underlying representation.\n|\n|  sub(self, other, context=None)\n|      Return self - other\n|\n|  truediv(self, other, context=None)\n|      Return self / other.\n|\n|  trunc = int(self)\n|\n|  adjusted(self)\n|      Return the adjusted exponent of self\n|\n|  asintegerratio(self)\n|      Express a finite Decimal instance in the form n / d.\n|\n|      Returns a pair (n, d) of integers.  When called on an infinity\n|      or NaN, raises OverflowError or ValueError respectively.\n|\n|      >>> Decimal('3.14').asintegerratio()\n|      (157, 50)\n|      >>> Decimal('-123e5').asintegerratio()\n|      (-12300000, 1)\n|      >>> Decimal('0.00').asintegerratio()\n|      (0, 1)\n|\n|  astuple(self)\n|      Represents the number as a triple tuple.\n|\n|      To show the internals exactly as they are.\n|\n|  canonical(self)\n|      Returns the same Decimal object.\n|\n|      As we do not have different encodings for the same number, the\n|      received object already is in its canonical form.\n|\n|  compare(self, other, context=None)\n|      Compare self to other.  Return a decimal value:\n|\n|      a or b is a NaN ==> Decimal('NaN')\n|      a < b           ==> Decimal('-1')\n|      a == b          ==> Decimal('0')\n|      a > b           ==> Decimal('1')\n|\n|  comparesignal(self, other, context=None)\n|      Compares self to the other operand numerically.\n|\n|      It's pretty much like compare(), but all NaNs signal, with signaling\n|      NaNs taking precedence over quiet NaNs.\n|\n|  comparetotal(self, other, context=None)\n|      Compares self to other using the abstract representations.\n|\n|      This is not like the standard compare, which use their numerical\n|      value. Note that a total ordering is defined for all possible abstract\n|      representations.\n|\n|  comparetotalmag(self, other, context=None)\n|      Compares self to other using abstract repr., ignoring sign.\n|\n|      Like comparetotal, but with operand's sign ignored and assumed to be 0.\n|\n|  conjugate(self)\n|\n|  copyabs(self)\n|      Returns a copy with the sign set to 0.\n|\n|  copynegate(self)\n|      Returns a copy with the sign inverted.\n|\n|  copysign(self, other, context=None)\n|      Returns self with the sign of other.\n|\n|  exp(self, context=None)\n|      Returns e  self.\n|\n|  fma(self, other, third, context=None)\n|      Fused multiply-add.\n|\n|      Returns self*other+third with no rounding of the intermediate\n|      product self*other.\n|\n|      self and other are multiplied together, with no rounding of\n|      the result.  The third operand is then added to the result,\n|      and a single final rounding is performed.\n|\n|  iscanonical(self)\n|      Return True if self is canonical; otherwise return False.\n|\n|      Currently, the encoding of a Decimal instance is always\n|      canonical, so this method returns True for any Decimal.\n|\n|  isfinite(self)\n|      Return True if self is finite; otherwise return False.\n|\n|      A Decimal instance is considered finite if it is neither\n|      infinite nor a NaN.\n|\n|  isinfinite(self)\n|      Return True if self is infinite; otherwise return False.\n|\n|  isnan(self)\n|      Return True if self is a qNaN or sNaN; otherwise return False.\n|\n|  isnormal(self, context=None)\n|      Return True if self is a normal number; otherwise return False.\n|\n|  isqnan(self)\n|      Return True if self is a quiet NaN; otherwise return False.\n|\n|  issigned(self)\n|      Return True if self is negative; otherwise return False.\n|\n|  issnan(self)\n|      Return True if self is a signaling NaN; otherwise return False.\n|\n|  issubnormal(self, context=None)\n|      Return True if self is subnormal; otherwise return False.\n|\n|  iszero(self)\n|      Return True if self is a zero; otherwise return False.\n|\n|  ln(self, context=None)\n|      Returns the natural (base e) logarithm of self.\n|\n|  log10(self, context=None)\n|      Returns the base 10 logarithm of self.\n|\n|  logb(self, context=None)\n|      Returns the exponent of the magnitude of self's MSD.\n|\n|      The result is the integer which is the exponent of the magnitude\n|      of the most significant digit of self (as though it were truncated\n|      to a single digit while maintaining the value of that digit and\n|      without limiting the resulting exponent).\n|\n|  logicaland(self, other, context=None)\n|      Applies an 'and' operation between self and other's digits.\n|\n|  logicalinvert(self, context=None)\n|      Invert all its digits.\n|\n|  logicalor(self, other, context=None)\n|      Applies an 'or' operation between self and other's digits.\n|\n|  logicalxor(self, other, context=None)\n|      Applies an 'xor' operation between self and other's digits.\n|\n|  max(self, other, context=None)\n|      Returns the larger value.\n|\n|      Like max(self, other) except if one is not a number, returns\n|      NaN (and signals if one is sNaN).  Also rounds.\n|\n|  maxmag(self, other, context=None)\n|      Compares the values numerically with their sign ignored.\n|\n|  min(self, other, context=None)\n|      Returns the smaller value.\n|\n|      Like min(self, other) except if one is not a number, returns\n|      NaN (and signals if one is sNaN).  Also rounds.\n|\n|  minmag(self, other, context=None)\n|      Compares the values numerically with their sign ignored.\n|\n|  nextminus(self, context=None)\n|      Returns the largest representable number smaller than itself.\n|\n|  nextplus(self, context=None)\n|      Returns the smallest representable number larger than itself.\n|\n|  nexttoward(self, other, context=None)\n|      Returns the number closest to self, in the direction towards other.\n|\n|      The result is the closest representable number to self\n|      (excluding self) that is in the direction towards other,\n|      unless both have the same value.  If the two operands are\n|      numerically equal, then the result is a copy of self with the\n|      sign set to be the same as the sign of other.\n|\n|  normalize(self, context=None)\n|      Normalize- strip trailing 0s, change anything equal to 0 to 0e0\n|\n|  numberclass(self, context=None)\n|      Returns an indication of the class of self.\n|\n|      The class is one of the following strings:\n|        sNaN\n|        NaN\n|        -Infinity\n|        -Normal\n|        -Subnormal\n|        -Zero\n|        +Zero\n|        +Subnormal\n|        +Normal\n|        +Infinity\n|\n|  quantize(self, exp, rounding=None, context=None)\n|      Quantize self so its exponent is the same as that of exp.\n|\n|      Similar to self.rescale(exp.exp) but with error checking.\n|\n|  radix(self)\n|      Just returns 10, as this is Decimal, :)\n|\n|  remaindernear(self, other, context=None)\n|      Remainder nearest to 0-  abs(remainder-near) <= other/2\n|\n|  rotate(self, other, context=None)\n|      Returns a rotated copy of self, value-of-other times.\n|\n|  samequantum(self, other, context=None)\n|      Return True if self and other have the same exponent; otherwise\n|      return False.\n|\n|      If either operand is a special value, the following rules are used:\n|         * return True if both operands are infinities\n|         * return True if both operands are NaNs\n|         * otherwise, return False.\n|\n|  scaleb(self, other, context=None)\n|      Returns self operand after adding the second value to its exp.\n|\n|  shift(self, other, context=None)\n|      Returns a shifted copy of self, value-of-other times.\n|\n|  sqrt(self, context=None)\n|      Return the square root of self.\n|\n|  toengstring(self, context=None)\n|      Convert to a string, using engineering notation if an exponent is needed.\n|\n|      Engineering notation has an exponent which is a multiple of 3.  This\n|      can leave up to 3 digits to the left of the decimal place and may\n|      require the addition of either one or two trailing zeros.\n|\n|  tointegral = tointegralvalue(self, rounding=None, context=None)\n|\n|  tointegralexact(self, rounding=None, context=None)\n|      Rounds to a nearby integer.\n|\n|      If no rounding mode is specified, take the rounding mode from\n|      the context.  This method raises the Rounded and Inexact flags\n|      when appropriate.\n|\n|      See also: tointegralvalue, which does exactly the same as\n|      this method except that it doesn't raise Inexact or Rounded.\n|\n|  tointegralvalue(self, rounding=None, context=None)\n|      Rounds to the nearest integer, without raising inexact, rounded.\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  fromfloat(f) from builtins.type\n|      Converts a float to a decimal number, exactly.\n|\n|      Note that Decimal.fromfloat(0.1) is not the same as Decimal('0.1').\n|      Since 0.1 is not exactly representable in binary floating point, the\n|      value is stored as the nearest representable value which is\n|      0x1.999999999999ap-4.  The exact equivalent of the value in decimal\n|      is 0.1000000000000000055511151231257827021181583404541015625.\n|\n|      >>> Decimal.fromfloat(0.1)\n|      Decimal('0.1000000000000000055511151231257827021181583404541015625')\n|      >>> Decimal.fromfloat(float('nan'))\n|      Decimal('NaN')\n|      >>> Decimal.fromfloat(float('inf'))\n|      Decimal('Infinity')\n|      >>> Decimal.fromfloat(-float('inf'))\n|      Decimal('-Infinity')\n|      >>> Decimal.fromfloat(-0.0)\n|      Decimal('-0')\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(cls, value='0', context=None)\n|      Create a decimal point instance.\n|\n|      >>> Decimal('3.14')              # string input\n|      Decimal('3.14')\n|      >>> Decimal((0, (3, 1, 4), -2))  # tuple (sign, digittuple, exponent)\n|      Decimal('3.14')\n|      >>> Decimal(314)                 # int\n|      Decimal('314')\n|      >>> Decimal(Decimal(314))        # another decimal instance\n|      Decimal('314')\n|      >>> Decimal('  3.14  \\n')        # leading and trailing whitespace okay\n|      Decimal('3.14')\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  imag\n|\n|  real\n"
                },
                {
                    "name": "class DecimalException",
                    "content": "|  Base exception class.\n|\n|  Used exceptions derive from this.\n|  If an exception derives from another exception besides this (such as\n|  Underflow (Inexact, Rounded, Subnormal) that indicates that it is only\n|  called if the others are present.  This isn't actually used for\n|  anything, though.\n|\n|  handle  -- Called when context.raiseerror is called and the\n|             trapenabler is not set.  First argument is self, second is the\n|             context.  More arguments can be given, those being after\n|             the explanation in raiseerror (For example,\n|             context.raiseerror(NewError, '(-x)!', self.sign) would\n|             call NewError().handle(context, self.sign).)\n|\n|  To define a new exception, it should be sufficient to have it derive\n|  from DecimalException.\n|\n|  Method resolution order:\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class DecimalTuple",
                    "content": "|  DecimalTuple(sign, digits, exponent)\n|\n|  DecimalTuple(sign, digits, exponent)\n|\n|  Method resolution order:\n|      DecimalTuple\n|      builtins.tuple\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  getnewargs(self)\n|      Return self as a plain tuple.  Used by copy and pickle.\n|\n|  repr(self)\n|      Return a nicely formatted representation string\n|\n|  asdict(self)\n|      Return a new dict which maps field names to their values.\n|\n|  replace(self, /, kwds)\n|      Return a new DecimalTuple object replacing specified fields with new values\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  make(iterable) from builtins.type\n|      Make a new DecimalTuple object from a sequence or iterable\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(cls, sign, digits, exponent)\n|      Create new instance of DecimalTuple(sign, digits, exponent)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  sign\n|      Alias for field number 0\n|\n|  digits\n|      Alias for field number 1\n|\n|  exponent\n|      Alias for field number 2\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  matchargs = ('sign', 'digits', 'exponent')\n|\n|  fielddefaults = {}\n|\n|  fields = ('sign', 'digits', 'exponent')\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.tuple:\n|\n|  add(self, value, /)\n|      Return self+value.\n|\n|  contains(self, key, /)\n|      Return key in self.\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getitem(self, key, /)\n|      Return self[key].\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  hash(self, /)\n|      Return hash(self).\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  mul(self, value, /)\n|      Return self*value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  rmul(self, value, /)\n|      Return value*self.\n|\n|  count(self, value, /)\n|      Return number of occurrences of value.\n|\n|  index(self, value, start=0, stop=9223372036854775807, /)\n|      Return first index of value.\n|\n|      Raises ValueError if the value is not present.\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from builtins.tuple:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n"
                },
                {
                    "name": "class DivisionByZero",
                    "content": "|  Division by 0.\n|\n|  This occurs and signals division-by-zero if division of a finite number\n|  by zero was attempted (during a divide-integer or divide operation, or a\n|  power operation with negative right-hand operand), and the dividend was\n|  not zero.\n|\n|  The result of the operation is [sign,inf], where sign is the exclusive\n|  or of the signs of the operands for divide, or is 1 for an odd power of\n|  -0, for power.\n|\n|  Method resolution order:\n|      DivisionByZero\n|      DecimalException\n|      builtins.ZeroDivisionError\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  handle(self, context, sign, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ZeroDivisionError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ZeroDivisionError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class DivisionImpossible",
                    "content": "|  Cannot perform the division adequately.\n|\n|  This occurs and signals invalid-operation if the integer result of a\n|  divide-integer or remainder operation had too many digits (would be\n|  longer than precision).  The result is [0,qNaN].\n|\n|  Method resolution order:\n|      DivisionImpossible\n|      InvalidOperation\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class DivisionUndefined",
                    "content": "|  Undefined result of division.\n|\n|  This occurs and signals invalid-operation if division by zero was\n|  attempted (during a divide-integer, divide, or remainder operation), and\n|  the dividend is also zero.  The result is [0,qNaN].\n|\n|  Method resolution order:\n|      DivisionUndefined\n|      InvalidOperation\n|      DecimalException\n|      builtins.ZeroDivisionError\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ZeroDivisionError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ZeroDivisionError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class FloatOperation",
                    "content": "|  Enable stricter semantics for mixing floats and Decimals.\n|\n|  If the signal is not trapped (default), mixing floats and Decimals is\n|  permitted in the Decimal() constructor, context.createdecimal() and\n|  all comparison operators. Both conversion and comparisons are exact.\n|  Any occurrence of a mixed operation is silently recorded by setting\n|  FloatOperation in the context flags.  Explicit conversions with\n|  Decimal.fromfloat() or context.createdecimalfromfloat() do not\n|  set the flag.\n|\n|  Otherwise (the signal is trapped), only equality comparisons and explicit\n|  conversions are silent. All other mixed operations raise FloatOperation.\n|\n|  Method resolution order:\n|      FloatOperation\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.TypeError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from DecimalException:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Inexact",
                    "content": "|  Had to round, losing information.\n|\n|  This occurs and signals inexact whenever the result of an operation is\n|  not exact (that is, it needed to be rounded and any discarded digits\n|  were non-zero), or if an overflow or underflow condition occurs.  The\n|  result in all cases is unchanged.\n|\n|  The inexact signal may be tested (or trapped) to determine if a given\n|  operation (or sequence of operations) was inexact.\n|\n|  Method resolution order:\n|      Inexact\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from DecimalException:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class InvalidContext",
                    "content": "|  Invalid context.  Unknown rounding, for example.\n|\n|  This occurs and signals invalid-operation if an invalid context was\n|  detected during an operation.  This can occur if contexts are not checked\n|  on creation and either the precision exceeds the capability of the\n|  underlying concrete representation or an unknown or unsupported rounding\n|  was specified.  These aspects of the context need only be checked when\n|  the values are required to be used.  The result is [0,qNaN].\n|\n|  Method resolution order:\n|      InvalidContext\n|      InvalidOperation\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class InvalidOperation",
                    "content": "|  An invalid operation was performed.\n|\n|  Various bad things cause this:\n|\n|  Something creates a signaling NaN\n|  -INF + INF\n|  0 * (+-)INF\n|  (+-)INF / (+-)INF\n|  x % 0\n|  (+-)INF % x\n|  x.rescale( non-integer )\n|  sqrt(-x) , x > 0\n|  0  0\n|  x  (non-integer)\n|  x  (+-)INF\n|  An operand is invalid\n|\n|  The result of the operation after these is a quiet positive NaN,\n|  except when the cause is a signaling NaN, in which case the result is\n|  also a quiet NaN, but with the original sign, and an optional\n|  diagnostic information.\n|\n|  Method resolution order:\n|      InvalidOperation\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Overflow",
                    "content": "|  Numerical overflow.\n|\n|  This occurs and signals overflow if the adjusted exponent of a result\n|  (from a conversion or from an operation that is not an attempt to divide\n|  by zero), after rounding, would be greater than the largest value that\n|  can be handled by the implementation (the value Emax).\n|\n|  The result depends on the rounding mode:\n|\n|  For round-half-up and round-half-even (and for round-half-down and\n|  round-up, if implemented), the result of the operation is [sign,inf],\n|  where sign is the sign of the intermediate result.  For round-down, the\n|  result is the largest finite number that can be represented in the\n|  current precision, with the sign of the intermediate result.  For\n|  round-ceiling, the result is the same as for round-down if the sign of\n|  the intermediate result is 1, or is [0,inf] otherwise.  For round-floor,\n|  the result is the same as for round-down if the sign of the intermediate\n|  result is 0, or is [1,inf] otherwise.  In all cases, Inexact and Rounded\n|  will also be raised.\n|\n|  Method resolution order:\n|      Overflow\n|      Inexact\n|      Rounded\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  handle(self, context, sign, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Rounded",
                    "content": "|  Number got rounded (not  necessarily changed during rounding).\n|\n|  This occurs and signals rounded whenever the result of an operation is\n|  rounded (that is, some zero or non-zero digits were discarded from the\n|  coefficient), or if an overflow or underflow condition occurs.  The\n|  result in all cases is unchanged.\n|\n|  The rounded signal may be tested (or trapped) to determine if a given\n|  operation (or sequence of operations) caused a loss of precision.\n|\n|  Method resolution order:\n|      Rounded\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from DecimalException:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Subnormal",
                    "content": "|  Exponent < Emin before rounding.\n|\n|  This occurs and signals subnormal whenever the result of a conversion or\n|  operation is subnormal (that is, its adjusted exponent is less than\n|  Emin, before any rounding).  The result in all cases is unchanged.\n|\n|  The subnormal signal may be tested (or trapped) to determine if a given\n|  or operation (or sequence of operations) yielded a subnormal result.\n|\n|  Method resolution order:\n|      Subnormal\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from DecimalException:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Underflow",
                    "content": "|  Numerical underflow with result rounded to 0.\n|\n|  This occurs and signals underflow if a result is inexact and the\n|  adjusted exponent of the result would be smaller (more negative) than\n|  the smallest value that can be handled by the implementation (the value\n|  Emin).  That is, the result is both inexact and subnormal.\n|\n|  The result after an underflow will be a subnormal number rounded, if\n|  necessary, so that its exponent is not less than Etiny.  This may result\n|  in 0 with the sign of the intermediate result and an exponent of Etiny.\n|\n|  In all cases, Inexact, Rounded, and Subnormal will also be raised.\n|\n|  Method resolution order:\n|      Underflow\n|      Inexact\n|      Rounded\n|      Subnormal\n|      DecimalException\n|      builtins.ArithmeticError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from DecimalException:\n|\n|  handle(self, context, *args)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from DecimalException:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.ArithmeticError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ArithmeticError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "getcontext",
                    "content": "Returns this thread's context.\n\nIf this thread does not yet have a context, returns\na new context and sets this thread's context.\nNew contexts are copies of DefaultContext.\n"
                },
                {
                    "name": "localcontext",
                    "content": "Return a context manager for a copy of the supplied context\n\nUses a copy of the current context if no context is specified\nThe returned context manager creates a local decimal context\nin a with statement:\ndef sin(x):\nwith localcontext() as ctx:\nctx.prec += 2\n# Rest of sin calculation algorithm\n# uses a precision 2 greater than normal\nreturn +s  # Convert result to normal precision\n\ndef sin(x):\nwith localcontext(ExtendedContext):\n# Rest of sin calculation algorithm\n# uses the Extended Context from the\n# General Decimal Arithmetic Specification\nreturn +s  # Convert result to normal context\n\n>>> setcontext(DefaultContext)\n>>> print(getcontext().prec)\n28\n>>> with localcontext():\n...     ctx = getcontext()\n...     ctx.prec += 2\n...     print(ctx.prec)\n...\n30\n>>> with localcontext(ExtendedContext):\n...     print(getcontext().prec)\n...\n9\n>>> print(getcontext().prec)\n28\n"
                },
                {
                    "name": "setcontext",
                    "content": "Set this thread's context to context.\n"
                }
            ]
        },
        "DATA": {
            "content": "BasicContext = Context(prec=9, rounding=ROUNDHALFUP, Emin=-99...onBy...\nDefaultContext = Context(prec=28, rounding=ROUNDHALFEVEN, Emin=...ap...\nExtendedContext = Context(prec=9, rounding=ROUNDHALFEVEN, Emin=-...=...\nHAVECONTEXTVAR = True\nHAVETHREADS = True\nMAXEMAX = 999999999999999999\nMAXPREC = 999999999999999999\nMINEMIN = -999999999999999999\nMINETINY = -1999999999999999997\nROUND05UP = 'ROUND05UP'\nROUNDCEILING = 'ROUNDCEILING'\nROUNDDOWN = 'ROUNDDOWN'\nROUNDFLOOR = 'ROUNDFLOOR'\nROUNDHALFDOWN = 'ROUNDHALFDOWN'\nROUNDHALFEVEN = 'ROUNDHALFEVEN'\nROUNDHALFUP = 'ROUNDHALFUP'\nROUNDUP = 'ROUNDUP'\nall = ['Decimal', 'Context', 'DecimalTuple', 'DefaultContext', 'Ba...\nlibmpdecversion = '2.4.2'\nxname = 'pydecimal'\n",
            "subsections": []
        },
        "VERSION": {
            "content": "1.70\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/pydecimal.py\n\n",
            "subsections": []
        }
    },
    "summary": "decimal",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ">>> print(neginf + inf) NaN >>> print(neginf * inf)"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ">>> print(dig / 0) Infinity >>> getcontext().traps[DivisionByZero] = 1 >>> print(dig / 0) Traceback (most recent call last): ... ... ... decimal.DivisionByZero: x / 0 >>> c = Context() >>> c.traps[InvalidOperation] = 0 >>> print(c.flags[InvalidOperation]) 0 >>> c.divide(Decimal(0), Decimal(0)) Decimal('NaN') >>> c.traps[InvalidOperation] = 1 >>> print(c.flags[InvalidOperation]) 1 >>> c.flags[InvalidOperation] = 0 >>> print(c.flags[InvalidOperation]) 0 >>> print(c.divide(Decimal(0), Decimal(0))) Traceback (most recent call last): ... ... ... decimal.InvalidOperation: 0 / 0 >>> print(c.flags[InvalidOperation]) 1 >>> c.flags[InvalidOperation] = 0 >>> c.traps[InvalidOperation] = 0 >>> print(c.divide(Decimal(0), Decimal(0))) NaN >>> print(c.flags[InvalidOperation]) 1 >>>"
        }
    ],
    "examples": [],
    "see_also": []
}