Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FloatComparator.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
8 namespace Magento\Framework\Math;
9 
17 {
23  private static $epsilon = 0.00001;
24 
33  public function equal(float $a, float $b): bool
34  {
35  return abs($a - $b) <= self::$epsilon;
36  }
37 
46  public function greaterThan(float $a, float $b): bool
47  {
48  return ($a - $b) > self::$epsilon;
49  }
50 
59  public function greaterThanOrEqual(float $a, float $b): bool
60  {
61  return $this->equal($a, $b) || $this->greaterThan($a, $b);
62  }
63 }