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

arctan() public méthode

Calculates the arctangente of this with the highest possible accuracy
public arctan ( integer $scale = null ) : Decimal
$scale integer
Résultat Decimal
    public function arctan($scale = null)
    {
        $piOverFour = DecimalConstants::pi()->div(Decimal::fromInteger(4), $scale + 2)->round($scale);
        if ($this->round($scale)->isZero()) {
            return DecimalConstants::zero();
        }
        if ($this->round($scale)->equals(DecimalConstants::one())) {
            return $piOverFour;
        }
        if ($this->round($scale)->equals(DecimalConstants::negativeOne())) {
            return DecimalConstants::negativeOne()->mul($piOverFour);
        }
        $scale = $scale === null ? 32 : $scale;
        return self::simplePowerSerie($this, DecimalConstants::zero(), $scale + 2)->round($scale);
    }