Litipk\BigNumbers\Decimal::sin PHP Method

sin() public method

Calculates the sine of this method with the highest possible accuracy Note that accuracy is limited by the accuracy of predefined PI;
public sin ( integer $scale = null ) : Decimal
$scale integer
return Decimal sin($this)
    public function sin($scale = null)
    {
        // First normalise the number in the [0, 2PI] domain
        $x = $this->mod(DecimalConstants::PI()->mul(Decimal::fromString("2")));
        // PI has only 32 significant numbers
        $scale = $scale === null ? 32 : $scale;
        return self::factorialSerie($x, DecimalConstants::zero(), function ($i) {
            return $i % 2 === 1 ? $i % 4 === 1 ? DecimalConstants::one() : DecimalConstants::negativeOne() : DecimalConstants::zero();
        }, $scale);
    }