private function formatValue($value, $precision)
    {
        $formatted = sprintf("%0.${precision}F", $value);

        if ($this->hasAutomaticPrecision()) {
            // [0 => integer part, 1 => fractional part].
            $formattedParts = explode('.', $formatted);

            if (isset($formattedParts[1])) {
                // Strip trailing 0s in fractional part.
                if (!$formattedParts[1] = chop($formattedParts[1], '0')) {
                    // Remove fractional part.
                    unset($formattedParts[1]);
                }

                $formatted = join('.', $formattedParts);
            }
        }

        return $formatted;
    }
private function formatValue($value, $precision)
    {
        $formatted = sprintf("%0.${precision}F", $value);

        if ($this->hasAutomaticPrecision()) {
            // [0 => integer part, 1 => fractional part].
            $formattedParts = explode('.', $formatted);

            if (isset($formattedParts[1])) {
                // Strip trailing 0s in fractional part.
                if (!$formattedParts[1] = chop($formattedParts[1], '0')) {
                    // Remove fractional part.
                    unset($formattedParts[1]);
                }

                $formatted = join('.', $formattedParts);
            }
        }

        return $formatted;
    }
private function formatValue ( $ value , $ precision ) { $ formatted = sprintf ( "%0.${precision}F" , $ value ) ; if ( $ this -> hasAutomaticPrecision ( ) ) { // [0 => integer part, 1 => fractional part]. $ formattedParts = explode ( '.' , $ formatted ) ; if ( isset ( $ formattedParts [ 1 ] ) ) { // Strip trailing 0s in fractional part. if ( ! $ formattedParts [ 1 ] = chop ( $ formattedParts [ 1 ] , '0' ) ) { // Remove fractional part. unset ( $ formattedParts [ 1 ] ) ; } $ formatted = join ( '.' , $ formattedParts ) ; } } return $ formatted ; }
Formats the specified number with the specified precision.

If precision scaling is enabled the precision may be reduced when it
contains insignificant digits. If the fractional part is zero it will
be completely removed.

@param float $value Number.
@param $precision Number of fractional digits.

@return string Formatted number.
Formats the specified number with the specified precision .