public function arcsec($scale = null)
{
if ($this->comp(DecimalConstants::one(), $scale + 2) === -1 && $this->comp(DecimalConstants::negativeOne(), $scale + 2) === 1) {
throw new \DomainException("The arcsecant of this number is undefined.");
}
$piOverTwo = DecimalConstants::pi()->div(Decimal::fromInteger(2), $scale + 2)->round($scale);
if ($this->round($scale)->equals(DecimalConstants::one())) {
return DecimalConstants::zero();
}
if ($this->round($scale)->equals(DecimalConstants::negativeOne())) {
return DecimalConstants::pi()->round($scale);
}
$scale = $scale === null ? 32 : $scale;
return $piOverTwo->sub(self::powerSerie(DecimalConstants::one()->div($this, $scale + 2), DecimalConstants::zero(), $scale + 2))->round($scale);
}