Litipk\BigNumbers\Decimal::arccsc PHP Méthode

arccsc() public méthode

Calculates the arccosecant of this with the highest possible accuracy
public arccsc ( integer $scale = null ) : Decimal
$scale integer
Résultat Decimal
    public function arccsc($scale = null)
    {
        if ($this->comp(DecimalConstants::one(), $scale + 2) === -1 && $this->comp(DecimalConstants::negativeOne(), $scale + 2) === 1) {
            throw new \DomainException("The arccosecant of this number is undefined.");
        }
        $scale = $scale === null ? 32 : $scale;
        if ($this->round($scale)->equals(DecimalConstants::one())) {
            return DecimalConstants::pi()->div(Decimal::fromInteger(2), $scale + 2)->round($scale);
        }
        if ($this->round($scale)->equals(DecimalConstants::negativeOne())) {
            return DecimalConstants::pi()->div(Decimal::fromInteger(-2), $scale + 2)->round($scale);
        }
        return self::powerSerie(DecimalConstants::one()->div($this, $scale + 2), DecimalConstants::zero(), $scale + 2)->round($scale);
    }