/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Math/Division.php
39 строк
794 B
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2014 Adobe * All Rights Reserved. */ namespace Magento\Framework\Math; /** * Division library * * @api * @since 100.0.2 */ class Division { /** * Const for correct dividing decimal values */ const DIVIDE_EPSILON = 10000; /** * Returns the floating point remainder (modulo) of the division of the arguments * * @param float|int $dividend * @param float|int $divisor * @return float|int */ public function getExactDivision($dividend, $divisor) { $epsilon = $divisor / self::DIVIDE_EPSILON; $remainder = fmod($dividend, $divisor); if (abs($remainder - $divisor) < $epsilon || abs($remainder) < $epsilon) { $remainder = 0; } return $remainder; } }