• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/iblock.php
  • Класс: CAllIBlock
  • Вызов: CAllIBlock::roundDB
static function roundDB($value)
{
	$len = 18;
	$dec = 4;
	$eps = 1.00 / pow(10, $len + 4);
	$rounded = round(doubleval($value) + $eps, $len);
	if (is_nan($rounded) || is_infinite($rounded))
		$rounded = 0;

	$result = sprintf("%01.".$dec."f", $rounded);
	if (mb_strlen($result) > ($len - $dec))
		$result = trim(mb_substr($result, 0, $len - $dec), ".");

	return $result;
}