/**
  * Check for float type, converting if necessary
  *
  * @param  NumericTypeInterface $a
  * @param  NumericTypeInterface $b
  * @return array [FloatType, FloatType]
  */
 protected function checkFloatTypes(NumericTypeInterface $a, NumericTypeInterface $b)
 {
     $a1 = $a instanceof FloatType ? $a : $a->asFloatType();
     $b1 = $b instanceof FloatType ? $b : $b->asFloatType();
     return [$a1, $b1];
 }
Esempio n. 2
0
 /**
  * Compare int and float types
  *
  * @param  NI $a
  * @param  NI $b
  * @return int
  */
 protected function intFloatCompare(NI $a, NI $b)
 {
     return $this->rationalCompare(RationalTypeFactory::fromFloat($a->asFloatType()), RationalTypeFactory::fromFloat($b->asFloatType()));
 }