Exemple #1
0
 /**
  * @param Rational $value
  * @return bool
  */
 public function isLessThan(Rational $value) : bool
 {
     $first = $this->getSimplified();
     $second = $value->getSimplified();
     $lcm = $first->getDenominator()->getLcm($second->getDenominator())->getValue();
     $left = $first->getNumerator()->getValue();
     $left *= $lcm / $first->getDenominator()->getValue();
     $right = $second->getNumerator()->getValue();
     $right *= $lcm / $second->getDenominator()->getValue();
     return $left < $right;
 }