public function arcsec(int $scale = null): Decimal
    {
        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);
    }
public function arcsec(int $scale = null): Decimal
    {
        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);
    }
public function arcsec ( int $ scale = null ) : Decimal { 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 ) ; }
Calculates the arcsecant of this with the highest possible accuracy

@param integer $scale
@return Decimal
Calculates the arcsecant of this with the highest possible accuracy