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('-0')
(self, a)
| 5440 | return a.shift(b, context=self) |
| 5441 | |
| 5442 | def sqrt(self, a): |
| 5443 | """Square root of a non-negative number to context precision. |
| 5444 | |
| 5445 | If the result must be inexact, it is rounded using the round-half-even |
| 5446 | algorithm. |
| 5447 | |
| 5448 | >>> ExtendedContext.sqrt(Decimal('0')) |
| 5449 | Decimal('0') |
| 5450 | >>> ExtendedContext.sqrt(Decimal('-0')) |
| 5451 | Decimal('-0') |
| 5452 | >>> ExtendedContext.sqrt(Decimal('0.39')) |
| 5453 | Decimal('0.624499800') |
| 5454 | >>> ExtendedContext.sqrt(Decimal('100')) |
| 5455 | Decimal('10') |
| 5456 | >>> ExtendedContext.sqrt(Decimal('1')) |
| 5457 | Decimal('1') |
| 5458 | >>> ExtendedContext.sqrt(Decimal('1.0')) |
| 5459 | Decimal('1.0') |
| 5460 | >>> ExtendedContext.sqrt(Decimal('1.00')) |
| 5461 | Decimal('1.0') |
| 5462 | >>> ExtendedContext.sqrt(Decimal('7')) |
| 5463 | Decimal('2.64575131') |
| 5464 | >>> ExtendedContext.sqrt(Decimal('10')) |
| 5465 | Decimal('3.16227766') |
| 5466 | >>> ExtendedContext.sqrt(2) |
| 5467 | Decimal('1.41421356') |
| 5468 | >>> ExtendedContext.prec |
| 5469 | 9 |
| 5470 | """ |
| 5471 | a = _convert_other(a, raiseit=True) |
| 5472 | return a.sqrt(context=self) |
| 5473 | |
| 5474 | def subtract(self, a, b): |
| 5475 | """Return the difference between the two operands. |