Example #1
0
 /**
  * Compare two numbers.
  *
  * @param Number $comparedNumber
  *
  * @return bool
  */
 public function equals(Number $comparedNumber)
 {
     if ($this->value() !== $comparedNumber->value() || !$this->getNumberSystem()->equals($comparedNumber->getNumberSystem())) {
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Compare two Numbers.
  *
  * @param Number $a First number
  * @param Number $b Second number
  *
  * @return int 0 if equal, 1 of $b is greater, -1 if $a is greater
  */
 public static function compare(Number $a, Number $b)
 {
     if ($a->value() == $b->value()) {
         return 0;
     }
     return $b->value() > $a->value() ? 1 : -1;
 }