Litipk\BigNumbers\Decimal::arcsin PHP Method

arcsin() public method

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