• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/product/price.php
  • Класс: BitrixCatalogProductPrice
  • Вызов: Price::roundWhole
static function roundWhole($value, $precision, $type)
{
	$quotient = $value/$precision;
	$quotientFloor = floor($quotient);
	switch ($type)
	{
		case CatalogRoundingTable::ROUND_UP:
			if (($quotient - $quotientFloor) > self::VALUE_EPS)
				$quotientFloor += 1;
			break;
		case CatalogRoundingTable::ROUND_DOWN:
			if ($quotientFloor < floor(($value + self::VALUE_EPS)/$precision))
				$quotientFloor += 1;
			break;
		case CatalogRoundingTable::ROUND_MATH:
		default:
			if (($quotient - $quotientFloor + self::VALUE_EPS) >= .5)
				$quotientFloor += 1;
			break;
	}

	return $quotientFloor*$precision;
}