MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / same_quantum

Method same_quantum

tools/python-3.11.9-amd64/Lib/_pydecimal.py:5402–5424  ·  view source on GitHub ↗

Returns True if the two operands have the same exponent. The result is never affected by either the sign or the coefficient of either operand. >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.001')) False >>> ExtendedContext.same_quantum(D

(self, a, b)

Source from the content-addressed store, hash-verified

5400 return a.rotate(b, context=self)
5401
5402 def same_quantum(self, a, b):
5403 """Returns True if the two operands have the same exponent.
5404
5405 The result is never affected by either the sign or the coefficient of
5406 either operand.
5407
5408 >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.001'))
5409 False
5410 >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.01'))
5411 True
5412 >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('1'))
5413 False
5414 >>> ExtendedContext.same_quantum(Decimal('Inf'), Decimal('-Inf'))
5415 True
5416 >>> ExtendedContext.same_quantum(10000, -1)
5417 True
5418 >>> ExtendedContext.same_quantum(Decimal(10000), -1)
5419 True
5420 >>> ExtendedContext.same_quantum(10000, Decimal(-1))
5421 True
5422 """
5423 a = _convert_other(a, raiseit=True)
5424 return a.same_quantum(b)
5425
5426 def scaleb (self, a, b):
5427 """Returns the first operand after adding the second value its exp.

Callers

nothing calls this directly

Calls 2

_convert_otherFunction · 0.85
same_quantumMethod · 0.45

Tested by

no test coverage detected