public function sqrt($scale = null)
{
if ($this->isNegative()) {
throw new \DomainException("Decimal can't handle square roots of negative numbers (it's only for real numbers).");
} elseif ($this->isZero()) {
return DecimalConstants::Zero();
}
$sqrt_scale = $scale !== null ? $scale : $this->scale;
return self::fromString(bcsqrt($this->value, $sqrt_scale + 1), $sqrt_scale);
}