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

Method sqrt

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

Square root of a non-negative number to context precision. If the result must be inexact, it is rounded using the round-half-even algorithm. >>> ExtendedContext.sqrt(Decimal('0')) Decimal('0') >>> ExtendedContext.sqrt(Decimal('-0')) Decimal('

(self, a)

Source from the content-addressed store, hash-verified

5473 return a.shift(b, context=self)
5474
5475 def sqrt(self, a):
5476 """Square root of a non-negative number to context precision.
5477
5478 If the result must be inexact, it is rounded using the round-half-even
5479 algorithm.
5480
5481 >>> ExtendedContext.sqrt(Decimal('0'))
5482 Decimal('0')
5483 >>> ExtendedContext.sqrt(Decimal('-0'))
5484 Decimal('-0')
5485 >>> ExtendedContext.sqrt(Decimal('0.39'))
5486 Decimal('0.624499800')
5487 >>> ExtendedContext.sqrt(Decimal('100'))
5488 Decimal('10')
5489 >>> ExtendedContext.sqrt(Decimal('1'))
5490 Decimal('1')
5491 >>> ExtendedContext.sqrt(Decimal('1.0'))
5492 Decimal('1.0')
5493 >>> ExtendedContext.sqrt(Decimal('1.00'))
5494 Decimal('1.0')
5495 >>> ExtendedContext.sqrt(Decimal('7'))
5496 Decimal('2.64575131')
5497 >>> ExtendedContext.sqrt(Decimal('10'))
5498 Decimal('3.16227766')
5499 >>> ExtendedContext.sqrt(2)
5500 Decimal('1.41421356')
5501 >>> ExtendedContext.prec
5502 9
5503 """
5504 a = _convert_other(a, raiseit=True)
5505 return a.sqrt(context=self)
5506
5507 def subtract(self, a, b):
5508 """Return the difference between the two operands.

Callers

nothing calls this directly

Calls 2

_convert_otherFunction · 0.85
sqrtMethod · 0.45

Tested by

no test coverage detected