Common/Model/Units.php
static function round($value, $unit = 'piece')
    {
        if (0 < $precision = static::getPrecision($unit)) {
            $divider = pow(10, $precision);

            return round(floor($value * $divider) / $divider, $precision);
        }

        return floor($value);
    }
static function round($value, $unit = 'piece')
    {
        if (0 < $precision = static::getPrecision($unit)) {
            $divider = pow(10, $precision);

            return round(floor($value * $divider) / $divider, $precision);
        }

        return floor($value);
    }
static function round ( $ value , $ unit = 'piece' ) { if ( 0 < $ precision = static :: getPrecision ( $ unit ) ) { $ divider = pow ( 10 , $ precision ) ; return round ( floor ( $ value * $ divider ) / $ divider , $ precision ) ; } return floor ( $ value ) ; }
Rounds the given value for the given unit.

@param float  $value
@param string $unit

@return float|int
Rounds the given value for the given unit .