MCPcopy Index your code
hub / github.com/RustPython/RustPython / logb

Method logb

Lib/_pydecimal.py:4690–4714  ·  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

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