SwatI18N/SwatI18NLocale.php
public function formatNumber(
        $value,
        $decimals = null,
        array $format = array()
    ) {
        $value = (float) $value;

        $format = $this->getNumberFormat()->override($format);

        if ($decimals === null) {
            $decimals = $this->getFractionalPrecision($value);
        }

        $value = round($value, $decimals);

        $integer_part = $this->formatIntegerGroupings($value, $format);
        $fractional_part = $this->formatFractionalPart(
            $value,
            $decimals,
            $format
        );

        $sign = $value < 0 ? '-' : '';

        $formatted_value = $sign . $integer_part . $fractional_part;

        return $formatted_value;
    }
public function formatNumber(
        $value,
        $decimals = null,
        array $format = array()
    ) {
        $value = (float) $value;

        $format = $this->getNumberFormat()->override($format);

        if ($decimals === null) {
            $decimals = $this->getFractionalPrecision($value);
        }

        $value = round($value, $decimals);

        $integer_part = $this->formatIntegerGroupings($value, $format);
        $fractional_part = $this->formatFractionalPart(
            $value,
            $decimals,
            $format
        );

        $sign = $value < 0 ? '-' : '';

        $formatted_value = $sign . $integer_part . $fractional_part;

        return $formatted_value;
    }
public function formatNumber ( $ value , $ decimals = null , array $ format = array ( ) ) { $ value = ( float ) $ value ; $ format = $ this -> getNumberFormat ( ) -> override ( $ format ) ; if ( $ decimals === null ) { $ decimals = $ this -> getFractionalPrecision ( $ value ) ; } $ value = round ( $ value , $ decimals ) ; $ integer_part = $ this -> formatIntegerGroupings ( $ value , $ format ) ; $ fractional_part = $ this -> formatFractionalPart ( $ value , $ decimals , $ format ) ; $ sign = $ value < 0 ? '-' : '' ; $ formatted_value = $ sign . $ integer_part . $ fractional_part ; return $ formatted_value ; }
Formats a numeric value for this locale

This methods uses the POSIX.2 LC_NUMERIC specification for formatting
numeric values.

Numeric values are rounded to the specified number of fractional digits
using a round-half-up rounding method (PHP's default round).

@param float $value the numeric value to format.
@param integer $decimals optional. The number of fractional digits to
include in the returned string. If not
specified, all fractional digits are included.
@param array $format optional. An associative array of number formatting
information that overrides the formatting for this
locale. The array is of the form
<i>'property' => value</i>. For example, use the
value <code>array('grouping' => 0)</code> to turn
off numeric groupings.

@return string a UTF-8 encoded string containing the formatted numeric
value.

@throws SwatException if a property name specified in the <i>$format</i>
parameter is invalid.
Formats a numeric value for this locale