public function sqrt(int $scale = null): Decimal
    {
        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
        );
    }
public function sqrt(int $scale = null): Decimal
    {
        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
        );
    }
public function sqrt ( int $ scale = null ) : Decimal { 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 ) ; }
Returns the square root of this object
@param  integer $scale
@return Decimal
Returns the square root of this object