mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Fix decimal repr which should have used single quotes like other reprs.
This commit is contained in:
		
							parent
							
								
									ddb164a651
								
							
						
					
					
						commit
						abe3237187
					
				
					 3 changed files with 334 additions and 334 deletions
				
			
		
							
								
								
									
										484
									
								
								Lib/decimal.py
									
										
									
									
									
								
							
							
						
						
									
										484
									
								
								Lib/decimal.py
									
										
									
									
									
								
							|  | @ -35,26 +35,26 @@ | |||
| useful for financial applications or for contexts where users have | ||||
| expectations that are at odds with binary floating point (for instance, | ||||
| in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead | ||||
| of the expected Decimal("0.00") returned by decimal floating point). | ||||
| of the expected Decimal('0.00') returned by decimal floating point). | ||||
| 
 | ||||
| Here are some examples of using the decimal module: | ||||
| 
 | ||||
| >>> from decimal import * | ||||
| >>> setcontext(ExtendedContext) | ||||
| >>> Decimal(0) | ||||
| Decimal("0") | ||||
| >>> Decimal("1") | ||||
| Decimal("1") | ||||
| >>> Decimal("-.0123") | ||||
| Decimal("-0.0123") | ||||
| Decimal('0') | ||||
| >>> Decimal('1') | ||||
| Decimal('1') | ||||
| >>> Decimal('-.0123') | ||||
| Decimal('-0.0123') | ||||
| >>> Decimal(123456) | ||||
| Decimal("123456") | ||||
| >>> Decimal("123.45e12345678901234567890") | ||||
| Decimal("1.2345E+12345678901234567892") | ||||
| >>> Decimal("1.33") + Decimal("1.27") | ||||
| Decimal("2.60") | ||||
| >>> Decimal("12.34") + Decimal("3.87") - Decimal("18.41") | ||||
| Decimal("-2.20") | ||||
| Decimal('123456') | ||||
| >>> Decimal('123.45e12345678901234567890') | ||||
| Decimal('1.2345E+12345678901234567892') | ||||
| >>> Decimal('1.33') + Decimal('1.27') | ||||
| Decimal('2.60') | ||||
| >>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41') | ||||
| Decimal('-2.20') | ||||
| >>> dig = Decimal(1) | ||||
| >>> print dig / Decimal(3) | ||||
| 0.333333333 | ||||
|  | @ -91,7 +91,7 @@ | |||
| >>> print c.flags[InvalidOperation] | ||||
| 0 | ||||
| >>> c.divide(Decimal(0), Decimal(0)) | ||||
| Decimal("NaN") | ||||
| Decimal('NaN') | ||||
| >>> c.traps[InvalidOperation] = 1 | ||||
| >>> print c.flags[InvalidOperation] | ||||
| 1 | ||||
|  | @ -516,15 +516,15 @@ def __new__(cls, value="0", context=None): | |||
|         """Create a decimal point instance. | ||||
| 
 | ||||
|         >>> Decimal('3.14')              # string input | ||||
|         Decimal("3.14") | ||||
|         Decimal('3.14') | ||||
|         >>> Decimal((0, (3, 1, 4), -2))  # tuple (sign, digit_tuple, exponent) | ||||
|         Decimal("3.14") | ||||
|         Decimal('3.14') | ||||
|         >>> Decimal(314)                 # int or long | ||||
|         Decimal("314") | ||||
|         Decimal('314') | ||||
|         >>> Decimal(Decimal(314))        # another decimal instance | ||||
|         Decimal("314") | ||||
|         Decimal('314') | ||||
|         >>> Decimal('  3.14  \\n')        # leading and trailing whitespace okay | ||||
|         Decimal("3.14") | ||||
|         Decimal('3.14') | ||||
|         """ | ||||
| 
 | ||||
|         # Note that the coefficient, self._int, is actually stored as | ||||
|  | @ -883,7 +883,7 @@ def __hash__(self): | |||
|         # | ||||
|         # The hash of a nonspecial noninteger Decimal must depend only | ||||
|         # on the value of that Decimal, and not on its representation. | ||||
|         # For example: hash(Decimal("100E-1")) == hash(Decimal("10")). | ||||
|         # For example: hash(Decimal('100E-1')) == hash(Decimal('10')). | ||||
|         if self._is_special: | ||||
|             if self._isnan(): | ||||
|                 raise TypeError('Cannot hash a NaN value.') | ||||
|  | @ -917,7 +917,7 @@ def as_tuple(self): | |||
|     def __repr__(self): | ||||
|         """Represents the number as an instance of Decimal.""" | ||||
|         # Invariant:  eval(repr(d)) == d | ||||
|         return 'Decimal("%s")' % str(self) | ||||
|         return "Decimal('%s')" % str(self) | ||||
| 
 | ||||
|     def __str__(self, eng=False, context=None): | ||||
|         """Return string representation of the number in scientific notation. | ||||
|  | @ -3647,13 +3647,13 @@ def abs(self, a): | |||
|         the plus operation on the operand. | ||||
| 
 | ||||
|         >>> ExtendedContext.abs(Decimal('2.1')) | ||||
|         Decimal("2.1") | ||||
|         Decimal('2.1') | ||||
|         >>> ExtendedContext.abs(Decimal('-100')) | ||||
|         Decimal("100") | ||||
|         Decimal('100') | ||||
|         >>> ExtendedContext.abs(Decimal('101.5')) | ||||
|         Decimal("101.5") | ||||
|         Decimal('101.5') | ||||
|         >>> ExtendedContext.abs(Decimal('-101.5')) | ||||
|         Decimal("101.5") | ||||
|         Decimal('101.5') | ||||
|         """ | ||||
|         return a.__abs__(context=self) | ||||
| 
 | ||||
|  | @ -3661,9 +3661,9 @@ def add(self, a, b): | |||
|         """Return the sum of the two operands. | ||||
| 
 | ||||
|         >>> ExtendedContext.add(Decimal('12'), Decimal('7.00')) | ||||
|         Decimal("19.00") | ||||
|         Decimal('19.00') | ||||
|         >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4')) | ||||
|         Decimal("1.02E+4") | ||||
|         Decimal('1.02E+4') | ||||
|         """ | ||||
|         return a.__add__(b, context=self) | ||||
| 
 | ||||
|  | @ -3677,7 +3677,7 @@ def canonical(self, a): | |||
|         received object already is in its canonical form. | ||||
| 
 | ||||
|         >>> ExtendedContext.canonical(Decimal('2.50')) | ||||
|         Decimal("2.50") | ||||
|         Decimal('2.50') | ||||
|         """ | ||||
|         return a.canonical(context=self) | ||||
| 
 | ||||
|  | @ -3696,17 +3696,17 @@ def compare(self, a, b): | |||
|         zero or negative zero, or '1' if the result is greater than zero. | ||||
| 
 | ||||
|         >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         """ | ||||
|         return a.compare(b, context=self) | ||||
| 
 | ||||
|  | @ -3718,21 +3718,21 @@ def compare_signal(self, a, b): | |||
| 
 | ||||
|         >>> c = ExtendedContext | ||||
|         >>> c.compare_signal(Decimal('2.1'), Decimal('3')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         >>> c.compare_signal(Decimal('2.1'), Decimal('2.1')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> c.flags[InvalidOperation] = 0 | ||||
|         >>> print c.flags[InvalidOperation] | ||||
|         0 | ||||
|         >>> c.compare_signal(Decimal('NaN'), Decimal('2.1')) | ||||
|         Decimal("NaN") | ||||
|         Decimal('NaN') | ||||
|         >>> print c.flags[InvalidOperation] | ||||
|         1 | ||||
|         >>> c.flags[InvalidOperation] = 0 | ||||
|         >>> print c.flags[InvalidOperation] | ||||
|         0 | ||||
|         >>> c.compare_signal(Decimal('sNaN'), Decimal('2.1')) | ||||
|         Decimal("NaN") | ||||
|         Decimal('NaN') | ||||
|         >>> print c.flags[InvalidOperation] | ||||
|         1 | ||||
|         """ | ||||
|  | @ -3746,17 +3746,17 @@ def compare_total(self, a, b): | |||
|         representations. | ||||
| 
 | ||||
|         >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         >>> ExtendedContext.compare_total(Decimal('-127'),  Decimal('12')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('12.300')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('NaN')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         """ | ||||
|         return a.compare_total(b) | ||||
| 
 | ||||
|  | @ -3771,9 +3771,9 @@ def copy_abs(self, a): | |||
|         """Returns a copy of the operand with the sign set to 0. | ||||
| 
 | ||||
|         >>> ExtendedContext.copy_abs(Decimal('2.1')) | ||||
|         Decimal("2.1") | ||||
|         Decimal('2.1') | ||||
|         >>> ExtendedContext.copy_abs(Decimal('-100')) | ||||
|         Decimal("100") | ||||
|         Decimal('100') | ||||
|         """ | ||||
|         return a.copy_abs() | ||||
| 
 | ||||
|  | @ -3781,9 +3781,9 @@ def copy_decimal(self, a): | |||
|         """Returns a copy of the decimal objet. | ||||
| 
 | ||||
|         >>> ExtendedContext.copy_decimal(Decimal('2.1')) | ||||
|         Decimal("2.1") | ||||
|         Decimal('2.1') | ||||
|         >>> ExtendedContext.copy_decimal(Decimal('-1.00')) | ||||
|         Decimal("-1.00") | ||||
|         Decimal('-1.00') | ||||
|         """ | ||||
|         return Decimal(a) | ||||
| 
 | ||||
|  | @ -3791,9 +3791,9 @@ def copy_negate(self, a): | |||
|         """Returns a copy of the operand with the sign inverted. | ||||
| 
 | ||||
|         >>> ExtendedContext.copy_negate(Decimal('101.5')) | ||||
|         Decimal("-101.5") | ||||
|         Decimal('-101.5') | ||||
|         >>> ExtendedContext.copy_negate(Decimal('-101.5')) | ||||
|         Decimal("101.5") | ||||
|         Decimal('101.5') | ||||
|         """ | ||||
|         return a.copy_negate() | ||||
| 
 | ||||
|  | @ -3804,13 +3804,13 @@ def copy_sign(self, a, b): | |||
|         equal to the sign of the second operand. | ||||
| 
 | ||||
|         >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33')) | ||||
|         Decimal("1.50") | ||||
|         Decimal('1.50') | ||||
|         >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33')) | ||||
|         Decimal("1.50") | ||||
|         Decimal('1.50') | ||||
|         >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33')) | ||||
|         Decimal("-1.50") | ||||
|         Decimal('-1.50') | ||||
|         >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33')) | ||||
|         Decimal("-1.50") | ||||
|         Decimal('-1.50') | ||||
|         """ | ||||
|         return a.copy_sign(b) | ||||
| 
 | ||||
|  | @ -3818,25 +3818,25 @@ def divide(self, a, b): | |||
|         """Decimal division in a specified context. | ||||
| 
 | ||||
|         >>> ExtendedContext.divide(Decimal('1'), Decimal('3')) | ||||
|         Decimal("0.333333333") | ||||
|         Decimal('0.333333333') | ||||
|         >>> ExtendedContext.divide(Decimal('2'), Decimal('3')) | ||||
|         Decimal("0.666666667") | ||||
|         Decimal('0.666666667') | ||||
|         >>> ExtendedContext.divide(Decimal('5'), Decimal('2')) | ||||
|         Decimal("2.5") | ||||
|         Decimal('2.5') | ||||
|         >>> ExtendedContext.divide(Decimal('1'), Decimal('10')) | ||||
|         Decimal("0.1") | ||||
|         Decimal('0.1') | ||||
|         >>> ExtendedContext.divide(Decimal('12'), Decimal('12')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.divide(Decimal('8.00'), Decimal('2')) | ||||
|         Decimal("4.00") | ||||
|         Decimal('4.00') | ||||
|         >>> ExtendedContext.divide(Decimal('2.400'), Decimal('2.0')) | ||||
|         Decimal("1.20") | ||||
|         Decimal('1.20') | ||||
|         >>> ExtendedContext.divide(Decimal('1000'), Decimal('100')) | ||||
|         Decimal("10") | ||||
|         Decimal('10') | ||||
|         >>> ExtendedContext.divide(Decimal('1000'), Decimal('1')) | ||||
|         Decimal("1000") | ||||
|         Decimal('1000') | ||||
|         >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2')) | ||||
|         Decimal("1.20E+6") | ||||
|         Decimal('1.20E+6') | ||||
|         """ | ||||
|         return a.__div__(b, context=self) | ||||
| 
 | ||||
|  | @ -3844,11 +3844,11 @@ def divide_int(self, a, b): | |||
|         """Divides two numbers and returns the integer part of the result. | ||||
| 
 | ||||
|         >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3')) | ||||
|         Decimal("3") | ||||
|         Decimal('3') | ||||
|         >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3')) | ||||
|         Decimal("3") | ||||
|         Decimal('3') | ||||
|         """ | ||||
|         return a.__floordiv__(b, context=self) | ||||
| 
 | ||||
|  | @ -3862,17 +3862,17 @@ def exp(self, a): | |||
|         >>> c.Emin = -999 | ||||
|         >>> c.Emax = 999 | ||||
|         >>> c.exp(Decimal('-Infinity')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> c.exp(Decimal('-1')) | ||||
|         Decimal("0.367879441") | ||||
|         Decimal('0.367879441') | ||||
|         >>> c.exp(Decimal('0')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> c.exp(Decimal('1')) | ||||
|         Decimal("2.71828183") | ||||
|         Decimal('2.71828183') | ||||
|         >>> c.exp(Decimal('0.693147181')) | ||||
|         Decimal("2.00000000") | ||||
|         Decimal('2.00000000') | ||||
|         >>> c.exp(Decimal('+Infinity')) | ||||
|         Decimal("Infinity") | ||||
|         Decimal('Infinity') | ||||
|         """ | ||||
|         return a.exp(context=self) | ||||
| 
 | ||||
|  | @ -3884,11 +3884,11 @@ def fma(self, a, b, c): | |||
|         multiplication, using add, all with only one final rounding. | ||||
| 
 | ||||
|         >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7')) | ||||
|         Decimal("22") | ||||
|         Decimal('22') | ||||
|         >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7')) | ||||
|         Decimal("-8") | ||||
|         Decimal('-8') | ||||
|         >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578')) | ||||
|         Decimal("1.38435736E+12") | ||||
|         Decimal('1.38435736E+12') | ||||
|         """ | ||||
|         return a.fma(b, c, context=self) | ||||
| 
 | ||||
|  | @ -4042,15 +4042,15 @@ def ln(self, a): | |||
|         >>> c.Emin = -999 | ||||
|         >>> c.Emax = 999 | ||||
|         >>> c.ln(Decimal('0')) | ||||
|         Decimal("-Infinity") | ||||
|         Decimal('-Infinity') | ||||
|         >>> c.ln(Decimal('1.000')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> c.ln(Decimal('2.71828183')) | ||||
|         Decimal("1.00000000") | ||||
|         Decimal('1.00000000') | ||||
|         >>> c.ln(Decimal('10')) | ||||
|         Decimal("2.30258509") | ||||
|         Decimal('2.30258509') | ||||
|         >>> c.ln(Decimal('+Infinity')) | ||||
|         Decimal("Infinity") | ||||
|         Decimal('Infinity') | ||||
|         """ | ||||
|         return a.ln(context=self) | ||||
| 
 | ||||
|  | @ -4061,19 +4061,19 @@ def log10(self, a): | |||
|         >>> c.Emin = -999 | ||||
|         >>> c.Emax = 999 | ||||
|         >>> c.log10(Decimal('0')) | ||||
|         Decimal("-Infinity") | ||||
|         Decimal('-Infinity') | ||||
|         >>> c.log10(Decimal('0.001')) | ||||
|         Decimal("-3") | ||||
|         Decimal('-3') | ||||
|         >>> c.log10(Decimal('1.000')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> c.log10(Decimal('2')) | ||||
|         Decimal("0.301029996") | ||||
|         Decimal('0.301029996') | ||||
|         >>> c.log10(Decimal('10')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> c.log10(Decimal('70')) | ||||
|         Decimal("1.84509804") | ||||
|         Decimal('1.84509804') | ||||
|         >>> c.log10(Decimal('+Infinity')) | ||||
|         Decimal("Infinity") | ||||
|         Decimal('Infinity') | ||||
|         """ | ||||
|         return a.log10(context=self) | ||||
| 
 | ||||
|  | @ -4086,13 +4086,13 @@ def logb(self, a): | |||
|         value of that digit and without limiting the resulting exponent). | ||||
| 
 | ||||
|         >>> ExtendedContext.logb(Decimal('250')) | ||||
|         Decimal("2") | ||||
|         Decimal('2') | ||||
|         >>> ExtendedContext.logb(Decimal('2.50')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.logb(Decimal('0.03')) | ||||
|         Decimal("-2") | ||||
|         Decimal('-2') | ||||
|         >>> ExtendedContext.logb(Decimal('0')) | ||||
|         Decimal("-Infinity") | ||||
|         Decimal('-Infinity') | ||||
|         """ | ||||
|         return a.logb(context=self) | ||||
| 
 | ||||
|  | @ -4102,17 +4102,17 @@ def logical_and(self, a, b): | |||
|         The operands must be both logical numbers. | ||||
| 
 | ||||
|         >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010')) | ||||
|         Decimal("1000") | ||||
|         Decimal('1000') | ||||
|         >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10')) | ||||
|         Decimal("10") | ||||
|         Decimal('10') | ||||
|         """ | ||||
|         return a.logical_and(b, context=self) | ||||
| 
 | ||||
|  | @ -4122,13 +4122,13 @@ def logical_invert(self, a): | |||
|         The operand must be a logical number. | ||||
| 
 | ||||
|         >>> ExtendedContext.logical_invert(Decimal('0')) | ||||
|         Decimal("111111111") | ||||
|         Decimal('111111111') | ||||
|         >>> ExtendedContext.logical_invert(Decimal('1')) | ||||
|         Decimal("111111110") | ||||
|         Decimal('111111110') | ||||
|         >>> ExtendedContext.logical_invert(Decimal('111111111')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.logical_invert(Decimal('101010101')) | ||||
|         Decimal("10101010") | ||||
|         Decimal('10101010') | ||||
|         """ | ||||
|         return a.logical_invert(context=self) | ||||
| 
 | ||||
|  | @ -4138,17 +4138,17 @@ def logical_or(self, a, b): | |||
|         The operands must be both logical numbers. | ||||
| 
 | ||||
|         >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010')) | ||||
|         Decimal("1110") | ||||
|         Decimal('1110') | ||||
|         >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10')) | ||||
|         Decimal("1110") | ||||
|         Decimal('1110') | ||||
|         """ | ||||
|         return a.logical_or(b, context=self) | ||||
| 
 | ||||
|  | @ -4158,17 +4158,17 @@ def logical_xor(self, a, b): | |||
|         The operands must be both logical numbers. | ||||
| 
 | ||||
|         >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010')) | ||||
|         Decimal("110") | ||||
|         Decimal('110') | ||||
|         >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10')) | ||||
|         Decimal("1101") | ||||
|         Decimal('1101') | ||||
|         """ | ||||
|         return a.logical_xor(b, context=self) | ||||
| 
 | ||||
|  | @ -4182,13 +4182,13 @@ def max(self, a,b): | |||
|         infinity) of the two operands is chosen as the result. | ||||
| 
 | ||||
|         >>> ExtendedContext.max(Decimal('3'), Decimal('2')) | ||||
|         Decimal("3") | ||||
|         Decimal('3') | ||||
|         >>> ExtendedContext.max(Decimal('-10'), Decimal('3')) | ||||
|         Decimal("3") | ||||
|         Decimal('3') | ||||
|         >>> ExtendedContext.max(Decimal('1.0'), Decimal('1')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.max(Decimal('7'), Decimal('NaN')) | ||||
|         Decimal("7") | ||||
|         Decimal('7') | ||||
|         """ | ||||
|         return a.max(b, context=self) | ||||
| 
 | ||||
|  | @ -4206,13 +4206,13 @@ def min(self, a,b): | |||
|         infinity) of the two operands is chosen as the result. | ||||
| 
 | ||||
|         >>> ExtendedContext.min(Decimal('3'), Decimal('2')) | ||||
|         Decimal("2") | ||||
|         Decimal('2') | ||||
|         >>> ExtendedContext.min(Decimal('-10'), Decimal('3')) | ||||
|         Decimal("-10") | ||||
|         Decimal('-10') | ||||
|         >>> ExtendedContext.min(Decimal('1.0'), Decimal('1')) | ||||
|         Decimal("1.0") | ||||
|         Decimal('1.0') | ||||
|         >>> ExtendedContext.min(Decimal('7'), Decimal('NaN')) | ||||
|         Decimal("7") | ||||
|         Decimal('7') | ||||
|         """ | ||||
|         return a.min(b, context=self) | ||||
| 
 | ||||
|  | @ -4228,9 +4228,9 @@ def minus(self, a): | |||
|         has the same exponent as the operand. | ||||
| 
 | ||||
|         >>> ExtendedContext.minus(Decimal('1.3')) | ||||
|         Decimal("-1.3") | ||||
|         Decimal('-1.3') | ||||
|         >>> ExtendedContext.minus(Decimal('-1.3')) | ||||
|         Decimal("1.3") | ||||
|         Decimal('1.3') | ||||
|         """ | ||||
|         return a.__neg__(context=self) | ||||
| 
 | ||||
|  | @ -4243,15 +4243,15 @@ def multiply(self, a, b): | |||
|         of the two operands. | ||||
| 
 | ||||
|         >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3')) | ||||
|         Decimal("3.60") | ||||
|         Decimal('3.60') | ||||
|         >>> ExtendedContext.multiply(Decimal('7'), Decimal('3')) | ||||
|         Decimal("21") | ||||
|         Decimal('21') | ||||
|         >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8')) | ||||
|         Decimal("0.72") | ||||
|         Decimal('0.72') | ||||
|         >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0')) | ||||
|         Decimal("-0.0") | ||||
|         Decimal('-0.0') | ||||
|         >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321')) | ||||
|         Decimal("4.28135971E+11") | ||||
|         Decimal('4.28135971E+11') | ||||
|         """ | ||||
|         return a.__mul__(b, context=self) | ||||
| 
 | ||||
|  | @ -4262,13 +4262,13 @@ def next_minus(self, a): | |||
|         >>> c.Emin = -999 | ||||
|         >>> c.Emax = 999 | ||||
|         >>> ExtendedContext.next_minus(Decimal('1')) | ||||
|         Decimal("0.999999999") | ||||
|         Decimal('0.999999999') | ||||
|         >>> c.next_minus(Decimal('1E-1007')) | ||||
|         Decimal("0E-1007") | ||||
|         Decimal('0E-1007') | ||||
|         >>> ExtendedContext.next_minus(Decimal('-1.00000003')) | ||||
|         Decimal("-1.00000004") | ||||
|         Decimal('-1.00000004') | ||||
|         >>> c.next_minus(Decimal('Infinity')) | ||||
|         Decimal("9.99999999E+999") | ||||
|         Decimal('9.99999999E+999') | ||||
|         """ | ||||
|         return a.next_minus(context=self) | ||||
| 
 | ||||
|  | @ -4279,13 +4279,13 @@ def next_plus(self, a): | |||
|         >>> c.Emin = -999 | ||||
|         >>> c.Emax = 999 | ||||
|         >>> ExtendedContext.next_plus(Decimal('1')) | ||||
|         Decimal("1.00000001") | ||||
|         Decimal('1.00000001') | ||||
|         >>> c.next_plus(Decimal('-1E-1007')) | ||||
|         Decimal("-0E-1007") | ||||
|         Decimal('-0E-1007') | ||||
|         >>> ExtendedContext.next_plus(Decimal('-1.00000003')) | ||||
|         Decimal("-1.00000002") | ||||
|         Decimal('-1.00000002') | ||||
|         >>> c.next_plus(Decimal('-Infinity')) | ||||
|         Decimal("-9.99999999E+999") | ||||
|         Decimal('-9.99999999E+999') | ||||
|         """ | ||||
|         return a.next_plus(context=self) | ||||
| 
 | ||||
|  | @ -4301,19 +4301,19 @@ def next_toward(self, a, b): | |||
|         >>> c.Emin = -999 | ||||
|         >>> c.Emax = 999 | ||||
|         >>> c.next_toward(Decimal('1'), Decimal('2')) | ||||
|         Decimal("1.00000001") | ||||
|         Decimal('1.00000001') | ||||
|         >>> c.next_toward(Decimal('-1E-1007'), Decimal('1')) | ||||
|         Decimal("-0E-1007") | ||||
|         Decimal('-0E-1007') | ||||
|         >>> c.next_toward(Decimal('-1.00000003'), Decimal('0')) | ||||
|         Decimal("-1.00000002") | ||||
|         Decimal('-1.00000002') | ||||
|         >>> c.next_toward(Decimal('1'), Decimal('0')) | ||||
|         Decimal("0.999999999") | ||||
|         Decimal('0.999999999') | ||||
|         >>> c.next_toward(Decimal('1E-1007'), Decimal('-100')) | ||||
|         Decimal("0E-1007") | ||||
|         Decimal('0E-1007') | ||||
|         >>> c.next_toward(Decimal('-1.00000003'), Decimal('-10')) | ||||
|         Decimal("-1.00000004") | ||||
|         Decimal('-1.00000004') | ||||
|         >>> c.next_toward(Decimal('0.00'), Decimal('-0.0000')) | ||||
|         Decimal("-0.00") | ||||
|         Decimal('-0.00') | ||||
|         """ | ||||
|         return a.next_toward(b, context=self) | ||||
| 
 | ||||
|  | @ -4324,17 +4324,17 @@ def normalize(self, a): | |||
|         result. | ||||
| 
 | ||||
|         >>> ExtendedContext.normalize(Decimal('2.1')) | ||||
|         Decimal("2.1") | ||||
|         Decimal('2.1') | ||||
|         >>> ExtendedContext.normalize(Decimal('-2.0')) | ||||
|         Decimal("-2") | ||||
|         Decimal('-2') | ||||
|         >>> ExtendedContext.normalize(Decimal('1.200')) | ||||
|         Decimal("1.2") | ||||
|         Decimal('1.2') | ||||
|         >>> ExtendedContext.normalize(Decimal('-120')) | ||||
|         Decimal("-1.2E+2") | ||||
|         Decimal('-1.2E+2') | ||||
|         >>> ExtendedContext.normalize(Decimal('120.00')) | ||||
|         Decimal("1.2E+2") | ||||
|         Decimal('1.2E+2') | ||||
|         >>> ExtendedContext.normalize(Decimal('0.00')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         """ | ||||
|         return a.normalize(context=self) | ||||
| 
 | ||||
|  | @ -4393,9 +4393,9 @@ def plus(self, a): | |||
|         has the same exponent as the operand. | ||||
| 
 | ||||
|         >>> ExtendedContext.plus(Decimal('1.3')) | ||||
|         Decimal("1.3") | ||||
|         Decimal('1.3') | ||||
|         >>> ExtendedContext.plus(Decimal('-1.3')) | ||||
|         Decimal("-1.3") | ||||
|         Decimal('-1.3') | ||||
|         """ | ||||
|         return a.__pos__(context=self) | ||||
| 
 | ||||
|  | @ -4425,46 +4425,46 @@ def power(self, a, b, modulo=None): | |||
|         >>> c.Emin = -999 | ||||
|         >>> c.Emax = 999 | ||||
|         >>> c.power(Decimal('2'), Decimal('3')) | ||||
|         Decimal("8") | ||||
|         Decimal('8') | ||||
|         >>> c.power(Decimal('-2'), Decimal('3')) | ||||
|         Decimal("-8") | ||||
|         Decimal('-8') | ||||
|         >>> c.power(Decimal('2'), Decimal('-3')) | ||||
|         Decimal("0.125") | ||||
|         Decimal('0.125') | ||||
|         >>> c.power(Decimal('1.7'), Decimal('8')) | ||||
|         Decimal("69.7575744") | ||||
|         Decimal('69.7575744') | ||||
|         >>> c.power(Decimal('10'), Decimal('0.301029996')) | ||||
|         Decimal("2.00000000") | ||||
|         Decimal('2.00000000') | ||||
|         >>> c.power(Decimal('Infinity'), Decimal('-1')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> c.power(Decimal('Infinity'), Decimal('0')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> c.power(Decimal('Infinity'), Decimal('1')) | ||||
|         Decimal("Infinity") | ||||
|         Decimal('Infinity') | ||||
|         >>> c.power(Decimal('-Infinity'), Decimal('-1')) | ||||
|         Decimal("-0") | ||||
|         Decimal('-0') | ||||
|         >>> c.power(Decimal('-Infinity'), Decimal('0')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> c.power(Decimal('-Infinity'), Decimal('1')) | ||||
|         Decimal("-Infinity") | ||||
|         Decimal('-Infinity') | ||||
|         >>> c.power(Decimal('-Infinity'), Decimal('2')) | ||||
|         Decimal("Infinity") | ||||
|         Decimal('Infinity') | ||||
|         >>> c.power(Decimal('0'), Decimal('0')) | ||||
|         Decimal("NaN") | ||||
|         Decimal('NaN') | ||||
| 
 | ||||
|         >>> c.power(Decimal('3'), Decimal('7'), Decimal('16')) | ||||
|         Decimal("11") | ||||
|         Decimal('11') | ||||
|         >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16')) | ||||
|         Decimal("-11") | ||||
|         Decimal('-11') | ||||
|         >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16')) | ||||
|         Decimal("11") | ||||
|         Decimal('11') | ||||
|         >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789')) | ||||
|         Decimal("11729830") | ||||
|         Decimal('11729830') | ||||
|         >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729')) | ||||
|         Decimal("-0") | ||||
|         Decimal('-0') | ||||
|         >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         """ | ||||
|         return a.__pow__(b, modulo, context=self) | ||||
| 
 | ||||
|  | @ -4487,35 +4487,35 @@ def quantize(self, a, b): | |||
|         if the result is subnormal and inexact. | ||||
| 
 | ||||
|         >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.001')) | ||||
|         Decimal("2.170") | ||||
|         Decimal('2.170') | ||||
|         >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.01')) | ||||
|         Decimal("2.17") | ||||
|         Decimal('2.17') | ||||
|         >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.1')) | ||||
|         Decimal("2.2") | ||||
|         Decimal('2.2') | ||||
|         >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+0')) | ||||
|         Decimal("2") | ||||
|         Decimal('2') | ||||
|         >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+1')) | ||||
|         Decimal("0E+1") | ||||
|         Decimal('0E+1') | ||||
|         >>> ExtendedContext.quantize(Decimal('-Inf'), Decimal('Infinity')) | ||||
|         Decimal("-Infinity") | ||||
|         Decimal('-Infinity') | ||||
|         >>> ExtendedContext.quantize(Decimal('2'), Decimal('Infinity')) | ||||
|         Decimal("NaN") | ||||
|         Decimal('NaN') | ||||
|         >>> ExtendedContext.quantize(Decimal('-0.1'), Decimal('1')) | ||||
|         Decimal("-0") | ||||
|         Decimal('-0') | ||||
|         >>> ExtendedContext.quantize(Decimal('-0'), Decimal('1e+5')) | ||||
|         Decimal("-0E+5") | ||||
|         Decimal('-0E+5') | ||||
|         >>> ExtendedContext.quantize(Decimal('+35236450.6'), Decimal('1e-2')) | ||||
|         Decimal("NaN") | ||||
|         Decimal('NaN') | ||||
|         >>> ExtendedContext.quantize(Decimal('-35236450.6'), Decimal('1e-2')) | ||||
|         Decimal("NaN") | ||||
|         Decimal('NaN') | ||||
|         >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-1')) | ||||
|         Decimal("217.0") | ||||
|         Decimal('217.0') | ||||
|         >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-0')) | ||||
|         Decimal("217") | ||||
|         Decimal('217') | ||||
|         >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+1')) | ||||
|         Decimal("2.2E+2") | ||||
|         Decimal('2.2E+2') | ||||
|         >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+2')) | ||||
|         Decimal("2E+2") | ||||
|         Decimal('2E+2') | ||||
|         """ | ||||
|         return a.quantize(b, context=self) | ||||
| 
 | ||||
|  | @ -4523,7 +4523,7 @@ def radix(self): | |||
|         """Just returns 10, as this is Decimal, :) | ||||
| 
 | ||||
|         >>> ExtendedContext.radix() | ||||
|         Decimal("10") | ||||
|         Decimal('10') | ||||
|         """ | ||||
|         return Decimal(10) | ||||
| 
 | ||||
|  | @ -4540,17 +4540,17 @@ def remainder(self, a, b): | |||
|         remainder cannot be calculated). | ||||
| 
 | ||||
|         >>> ExtendedContext.remainder(Decimal('2.1'), Decimal('3')) | ||||
|         Decimal("2.1") | ||||
|         Decimal('2.1') | ||||
|         >>> ExtendedContext.remainder(Decimal('10'), Decimal('3')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.remainder(Decimal('-10'), Decimal('3')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         >>> ExtendedContext.remainder(Decimal('10.2'), Decimal('1')) | ||||
|         Decimal("0.2") | ||||
|         Decimal('0.2') | ||||
|         >>> ExtendedContext.remainder(Decimal('10'), Decimal('0.3')) | ||||
|         Decimal("0.1") | ||||
|         Decimal('0.1') | ||||
|         >>> ExtendedContext.remainder(Decimal('3.6'), Decimal('1.3')) | ||||
|         Decimal("1.0") | ||||
|         Decimal('1.0') | ||||
|         """ | ||||
|         return a.__mod__(b, context=self) | ||||
| 
 | ||||
|  | @ -4565,19 +4565,19 @@ def remainder_near(self, a, b): | |||
|         remainder cannot be calculated). | ||||
| 
 | ||||
|         >>> ExtendedContext.remainder_near(Decimal('2.1'), Decimal('3')) | ||||
|         Decimal("-0.9") | ||||
|         Decimal('-0.9') | ||||
|         >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('6')) | ||||
|         Decimal("-2") | ||||
|         Decimal('-2') | ||||
|         >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('3')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.remainder_near(Decimal('-10'), Decimal('3')) | ||||
|         Decimal("-1") | ||||
|         Decimal('-1') | ||||
|         >>> ExtendedContext.remainder_near(Decimal('10.2'), Decimal('1')) | ||||
|         Decimal("0.2") | ||||
|         Decimal('0.2') | ||||
|         >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('0.3')) | ||||
|         Decimal("0.1") | ||||
|         Decimal('0.1') | ||||
|         >>> ExtendedContext.remainder_near(Decimal('3.6'), Decimal('1.3')) | ||||
|         Decimal("-0.3") | ||||
|         Decimal('-0.3') | ||||
|         """ | ||||
|         return a.remainder_near(b, context=self) | ||||
| 
 | ||||
|  | @ -4591,15 +4591,15 @@ def rotate(self, a, b): | |||
|         positive or to the right otherwise. | ||||
| 
 | ||||
|         >>> ExtendedContext.rotate(Decimal('34'), Decimal('8')) | ||||
|         Decimal("400000003") | ||||
|         Decimal('400000003') | ||||
|         >>> ExtendedContext.rotate(Decimal('12'), Decimal('9')) | ||||
|         Decimal("12") | ||||
|         Decimal('12') | ||||
|         >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2')) | ||||
|         Decimal("891234567") | ||||
|         Decimal('891234567') | ||||
|         >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0')) | ||||
|         Decimal("123456789") | ||||
|         Decimal('123456789') | ||||
|         >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2')) | ||||
|         Decimal("345678912") | ||||
|         Decimal('345678912') | ||||
|         """ | ||||
|         return a.rotate(b, context=self) | ||||
| 
 | ||||
|  | @ -4624,11 +4624,11 @@ def scaleb (self, a, b): | |||
|         """Returns the first operand after adding the second value its exp. | ||||
| 
 | ||||
|         >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2')) | ||||
|         Decimal("0.0750") | ||||
|         Decimal('0.0750') | ||||
|         >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0')) | ||||
|         Decimal("7.50") | ||||
|         Decimal('7.50') | ||||
|         >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3')) | ||||
|         Decimal("7.50E+3") | ||||
|         Decimal('7.50E+3') | ||||
|         """ | ||||
|         return a.scaleb (b, context=self) | ||||
| 
 | ||||
|  | @ -4643,15 +4643,15 @@ def shift(self, a, b): | |||
|         coefficient are zeros. | ||||
| 
 | ||||
|         >>> ExtendedContext.shift(Decimal('34'), Decimal('8')) | ||||
|         Decimal("400000000") | ||||
|         Decimal('400000000') | ||||
|         >>> ExtendedContext.shift(Decimal('12'), Decimal('9')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2')) | ||||
|         Decimal("1234567") | ||||
|         Decimal('1234567') | ||||
|         >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0')) | ||||
|         Decimal("123456789") | ||||
|         Decimal('123456789') | ||||
|         >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2')) | ||||
|         Decimal("345678900") | ||||
|         Decimal('345678900') | ||||
|         """ | ||||
|         return a.shift(b, context=self) | ||||
| 
 | ||||
|  | @ -4662,23 +4662,23 @@ def sqrt(self, a): | |||
|         algorithm. | ||||
| 
 | ||||
|         >>> ExtendedContext.sqrt(Decimal('0')) | ||||
|         Decimal("0") | ||||
|         Decimal('0') | ||||
|         >>> ExtendedContext.sqrt(Decimal('-0')) | ||||
|         Decimal("-0") | ||||
|         Decimal('-0') | ||||
|         >>> ExtendedContext.sqrt(Decimal('0.39')) | ||||
|         Decimal("0.624499800") | ||||
|         Decimal('0.624499800') | ||||
|         >>> ExtendedContext.sqrt(Decimal('100')) | ||||
|         Decimal("10") | ||||
|         Decimal('10') | ||||
|         >>> ExtendedContext.sqrt(Decimal('1')) | ||||
|         Decimal("1") | ||||
|         Decimal('1') | ||||
|         >>> ExtendedContext.sqrt(Decimal('1.0')) | ||||
|         Decimal("1.0") | ||||
|         Decimal('1.0') | ||||
|         >>> ExtendedContext.sqrt(Decimal('1.00')) | ||||
|         Decimal("1.0") | ||||
|         Decimal('1.0') | ||||
|         >>> ExtendedContext.sqrt(Decimal('7')) | ||||
|         Decimal("2.64575131") | ||||
|         Decimal('2.64575131') | ||||
|         >>> ExtendedContext.sqrt(Decimal('10')) | ||||
|         Decimal("3.16227766") | ||||
|         Decimal('3.16227766') | ||||
|         >>> ExtendedContext.prec | ||||
|         9 | ||||
|         """ | ||||
|  | @ -4688,11 +4688,11 @@ def subtract(self, a, b): | |||
|         """Return the difference between the two operands. | ||||
| 
 | ||||
|         >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.07')) | ||||
|         Decimal("0.23") | ||||
|         Decimal('0.23') | ||||
|         >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.30')) | ||||
|         Decimal("0.00") | ||||
|         Decimal('0.00') | ||||
|         >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('2.07')) | ||||
|         Decimal("-0.77") | ||||
|         Decimal('-0.77') | ||||
|         """ | ||||
|         return a.__sub__(b, context=self) | ||||
| 
 | ||||
|  | @ -4721,21 +4721,21 @@ def to_integral_exact(self, a): | |||
|         context. | ||||
| 
 | ||||
|         >>> ExtendedContext.to_integral_exact(Decimal('2.1')) | ||||
|         Decimal("2") | ||||
|         Decimal('2') | ||||
|         >>> ExtendedContext.to_integral_exact(Decimal('100')) | ||||
|         Decimal("100") | ||||
|         Decimal('100') | ||||
|         >>> ExtendedContext.to_integral_exact(Decimal('100.0')) | ||||
|         Decimal("100") | ||||
|         Decimal('100') | ||||
|         >>> ExtendedContext.to_integral_exact(Decimal('101.5')) | ||||
|         Decimal("102") | ||||
|         Decimal('102') | ||||
|         >>> ExtendedContext.to_integral_exact(Decimal('-101.5')) | ||||
|         Decimal("-102") | ||||
|         Decimal('-102') | ||||
|         >>> ExtendedContext.to_integral_exact(Decimal('10E+5')) | ||||
|         Decimal("1.0E+6") | ||||
|         Decimal('1.0E+6') | ||||
|         >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77')) | ||||
|         Decimal("7.89E+77") | ||||
|         Decimal('7.89E+77') | ||||
|         >>> ExtendedContext.to_integral_exact(Decimal('-Inf')) | ||||
|         Decimal("-Infinity") | ||||
|         Decimal('-Infinity') | ||||
|         """ | ||||
|         return a.to_integral_exact(context=self) | ||||
| 
 | ||||
|  | @ -4749,21 +4749,21 @@ def to_integral_value(self, a): | |||
|         be set.  The rounding mode is taken from the context. | ||||
| 
 | ||||
|         >>> ExtendedContext.to_integral_value(Decimal('2.1')) | ||||
|         Decimal("2") | ||||
|         Decimal('2') | ||||
|         >>> ExtendedContext.to_integral_value(Decimal('100')) | ||||
|         Decimal("100") | ||||
|         Decimal('100') | ||||
|         >>> ExtendedContext.to_integral_value(Decimal('100.0')) | ||||
|         Decimal("100") | ||||
|         Decimal('100') | ||||
|         >>> ExtendedContext.to_integral_value(Decimal('101.5')) | ||||
|         Decimal("102") | ||||
|         Decimal('102') | ||||
|         >>> ExtendedContext.to_integral_value(Decimal('-101.5')) | ||||
|         Decimal("-102") | ||||
|         Decimal('-102') | ||||
|         >>> ExtendedContext.to_integral_value(Decimal('10E+5')) | ||||
|         Decimal("1.0E+6") | ||||
|         Decimal('1.0E+6') | ||||
|         >>> ExtendedContext.to_integral_value(Decimal('7.89E+77')) | ||||
|         Decimal("7.89E+77") | ||||
|         Decimal('7.89E+77') | ||||
|         >>> ExtendedContext.to_integral_value(Decimal('-Inf')) | ||||
|         Decimal("-Infinity") | ||||
|         Decimal('-Infinity') | ||||
|         """ | ||||
|         return a.to_integral_value(context=self) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Raymond Hettinger
						Raymond Hettinger