![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/Math/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ 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; } }