MCPcopy Index your code
hub / github.com/python/cpython / logb

Method logb

Lib/_pydecimal.py:4693–4717  ·  view source on GitHub ↗

Returns the exponent of the magnitude of the operand's MSD. The result is the integer which is the exponent of the magnitude of the most significant digit of the operand (as though the operand were truncated to a single digit while maintaining the value of that digi

(self, a)

Source from the content-addressed store, hash-verified

4691 return a.log10(context=self)
4692
4693 def logb(self, a):
4694 """ Returns the exponent of the magnitude of the operand's MSD.
4695
4696 The result is the integer which is the exponent of the magnitude
4697 of the most significant digit of the operand (as though the
4698 operand were truncated to a single digit while maintaining the
4699 value of that digit and without limiting the resulting exponent).
4700
4701 >>> ExtendedContext.logb(Decimal('250'))
4702 Decimal('2')
4703 >>> ExtendedContext.logb(Decimal('2.50'))
4704 Decimal('0')
4705 >>> ExtendedContext.logb(Decimal('0.03'))
4706 Decimal('-2')
4707 >>> ExtendedContext.logb(Decimal('0'))
4708 Decimal('-Infinity')
4709 >>> ExtendedContext.logb(1)
4710 Decimal('0')
4711 >>> ExtendedContext.logb(10)
4712 Decimal('1')
4713 >>> ExtendedContext.logb(100)
4714 Decimal('2')
4715 """
4716 a = _convert_other(a, raiseit=True)
4717 return a.logb(context=self)
4718
4719 def logical_and(self, a, b):
4720 """Applies the logical operation 'and' between each operand's digits.

Callers 1

test_logbMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
logbMethod · 0.45

Tested by 1

test_logbMethod · 0.76