Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/data/ |
Upload File : |
<?php namespace Yandex\Market\Data; class Quantity { public static function equal($first, $second, $gap = 0.01) { if ($first === $second) { return true; } $firstRounded = static::round($first); $secondRounded = static::round($second); if ($firstRounded === $secondRounded) { return true; } $diff = abs($firstRounded - $secondRounded); return $diff <= $gap; } public static function floor($value, $precision = 2, $gap = 0.01) { $roundValue = static::round($value, $precision); $diff = abs($roundValue - $value); if ($diff <= $gap) { return $roundValue; } $multiplier = 10 ** $precision; $floorValue = (floor($value * $multiplier) / $multiplier); return $floorValue; } public static function round($value, $precision = 2) { return round($value, $precision); } }