private function roundCurrency($value, $currency)
    {
        $fractionDigits = Currencies::getFractionDigits($currency);
        $roundingIncrement = Currencies::getRoundingIncrement($currency);

        // Round with the formatter rounding mode
        $value = $this->round($value, $fractionDigits);

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

        return $value;
    }
private function roundCurrency($value, $currency)
    {
        $fractionDigits = Currencies::getFractionDigits($currency);
        $roundingIncrement = Currencies::getRoundingIncrement($currency);

        // Round with the formatter rounding mode
        $value = $this->round($value, $fractionDigits);

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

        return $value;
    }
private function roundCurrency ( $ value , $ currency ) { $ fractionDigits = Currencies :: getFractionDigits ( $ currency ) ; $ roundingIncrement = Currencies :: getRoundingIncrement ( $ currency ) ; // Round with the formatter rounding mode $ value = $ this -> round ( $ value , $ fractionDigits ) ; // Swiss rounding if ( 0 < $ roundingIncrement && 0 < $ fractionDigits ) { $ roundingFactor = $ roundingIncrement / pow ( 10 , $ fractionDigits ) ; $ value = round ( $ value / $ roundingFactor ) * $ roundingFactor ; } return $ value ; }
Rounds a currency value, applying increment rounding if applicable.

When a currency have a rounding increment, an extra round is made after the first one. The rounding factor is
determined in the ICU data and is explained as of:

"the rounding increment is given in units of 10^(-fraction_digits)"

The only actual rounding data as of this writing, is CHF.

@param float  $value    The numeric currency value
@param string $currency The 3-letter ISO 4217 currency code indicating the currency to use

@return float The rounded numeric currency value

@see http://en.wikipedia.org/wiki/Swedish_rounding
@see http://www.docjar.com/html/api/com/ibm/icu/util/Currency.java.html#1007
Rounds a currency value applying increment rounding if applicable .