public function getRoundedAmount(): float
    {
        $fractionDigits = Intl::getCurrencyBundle()->getFractionDigits($this->currency);
        $roundingIncrement = Intl::getCurrencyBundle()->getRoundingIncrement($this->currency);

        $value = round($this->amount, $fractionDigits);

        // Swiss rounding
        if (0 < $roundingIncrement && 0 < $fractionDigits) {
            $roundingFactor = $roundingIncrement / pow(10, $fractionDigits);
            $value = round($value / $roundingFactor) * $roundingFactor;
        }

        return $value;
    }
public function getRoundedAmount(): float
    {
        $fractionDigits = Intl::getCurrencyBundle()->getFractionDigits($this->currency);
        $roundingIncrement = Intl::getCurrencyBundle()->getRoundingIncrement($this->currency);

        $value = round($this->amount, $fractionDigits);

        // Swiss rounding
        if (0 < $roundingIncrement && 0 < $fractionDigits) {
            $roundingFactor = $roundingIncrement / pow(10, $fractionDigits);
            $value = round($value / $roundingFactor) * $roundingFactor;
        }

        return $value;
    }
public function getRoundedAmount ( ) : float { $ fractionDigits = Intl :: getCurrencyBundle ( ) -> getFractionDigits ( $ this -> currency ) ; $ roundingIncrement = Intl :: getCurrencyBundle ( ) -> getRoundingIncrement ( $ this -> currency ) ; $ value = round ( $ this -> amount , $ fractionDigits ) ; // Swiss rounding if ( 0 < $ roundingIncrement && 0 < $ fractionDigits ) { $ roundingFactor = $ roundingIncrement / pow ( 10 , $ fractionDigits ) ; $ value = round ( $ value / $ roundingFactor ) * $ roundingFactor ; } return $ value ; }
Returns the amount rounded to the correct number of decimal places for that currency
Returns the amount rounded to the correct number of decimal places for that currency