private function round($value, $precision)
    {
        $precision = $this->getUninitializedPrecision($value, $precision);

        $roundingModeAttribute = $this->getAttribute(self::ROUNDING_MODE);
        if (isset(self::$phpRoundingMap[$roundingModeAttribute])) {
            $value = round($value, $precision, self::$phpRoundingMap[$roundingModeAttribute]);
        } elseif (isset(self::$customRoundingList[$roundingModeAttribute])) {
            $roundingCoef = pow(10, $precision);
            $value *= $roundingCoef;
            $value = (float) (string) $value;

            switch ($roundingModeAttribute) {
                case self::ROUND_CEILING:
                    $value = ceil($value);
                    break;
                case self::ROUND_FLOOR:
                    $value = floor($value);
                    break;
                case self::ROUND_UP:
                    $value = $value > 0 ? ceil($value) : floor($value);
                    break;
                case self::ROUND_DOWN:
                    $value = $value > 0 ? floor($value) : ceil($value);
                    break;
            }

            $value /= $roundingCoef;
        }

        return $value;
    }
private function round($value, $precision)
    {
        $precision = $this->getUninitializedPrecision($value, $precision);

        $roundingModeAttribute = $this->getAttribute(self::ROUNDING_MODE);
        if (isset(self::$phpRoundingMap[$roundingModeAttribute])) {
            $value = round($value, $precision, self::$phpRoundingMap[$roundingModeAttribute]);
        } elseif (isset(self::$customRoundingList[$roundingModeAttribute])) {
            $roundingCoef = pow(10, $precision);
            $value *= $roundingCoef;
            $value = (float) (string) $value;

            switch ($roundingModeAttribute) {
                case self::ROUND_CEILING:
                    $value = ceil($value);
                    break;
                case self::ROUND_FLOOR:
                    $value = floor($value);
                    break;
                case self::ROUND_UP:
                    $value = $value > 0 ? ceil($value) : floor($value);
                    break;
                case self::ROUND_DOWN:
                    $value = $value > 0 ? floor($value) : ceil($value);
                    break;
            }

            $value /= $roundingCoef;
        }

        return $value;
    }
private function round ( $ value , $ precision ) { $ precision = $ this -> getUninitializedPrecision ( $ value , $ precision ) ; $ roundingModeAttribute = $ this -> getAttribute ( self :: ROUNDING_MODE ) ; if ( isset ( self :: $ phpRoundingMap [ $ roundingModeAttribute ] ) ) { $ value = round ( $ value , $ precision , self :: $ phpRoundingMap [ $ roundingModeAttribute ] ) ; } elseif ( isset ( self :: $ customRoundingList [ $ roundingModeAttribute ] ) ) { $ roundingCoef = pow ( 10 , $ precision ) ; $ value *= $ roundingCoef ; $ value = ( float ) ( string ) $ value ; switch ( $ roundingModeAttribute ) { case self :: ROUND_CEILING : $ value = ceil ( $ value ) ; break ; case self :: ROUND_FLOOR : $ value = floor ( $ value ) ; break ; case self :: ROUND_UP : $ value = $ value > 0 ? ceil ( $ value ) : floor ( $ value ) ; break ; case self :: ROUND_DOWN : $ value = $ value > 0 ? floor ( $ value ) : ceil ( $ value ) ; break ; } $ value /= $ roundingCoef ; } return $ value ; }
Rounds a value.

@param int|float $value     The value to round
@param int       $precision The number of decimal digits to round to

@return int|float The rounded value
Rounds a value .