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

Method ln

Lib/_pydecimal.py:4643–4663  ·  view source on GitHub ↗

Returns the natural (base e) logarithm of the operand. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.ln(Decimal('0')) Decimal('-Infinity') >>> c.ln(Decimal('1.000')) Decimal('0') >>> c.ln(Decimal('2.71828183')

(self, a)

Source from the content-addressed store, hash-verified

4641 return a.is_zero()
4642
4643 def ln(self, a):
4644 """Returns the natural (base e) logarithm of the operand.
4645
4646 >>> c = ExtendedContext.copy()
4647 >>> c.Emin = -999
4648 >>> c.Emax = 999
4649 >>> c.ln(Decimal('0'))
4650 Decimal('-Infinity')
4651 >>> c.ln(Decimal('1.000'))
4652 Decimal('0')
4653 >>> c.ln(Decimal('2.71828183'))
4654 Decimal('1.00000000')
4655 >>> c.ln(Decimal('10'))
4656 Decimal('2.30258509')
4657 >>> c.ln(Decimal('+Infinity'))
4658 Decimal('Infinity')
4659 >>> c.ln(1)
4660 Decimal('0')
4661 """
4662 a = _convert_other(a, raiseit=True)
4663 return a.ln(context=self)
4664
4665 def log10(self, a):
4666 """Returns the base 10 logarithm of the operand.

Callers 1

test_lnMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
lnMethod · 0.45

Tested by 1

test_lnMethod · 0.76