Example #1
0
 /**
  * {@inheritdoc}
  */
 public function compareTo($that)
 {
     $that = Number::of($that);
     if ($that instanceof self) {
         return Math::cmp($this->value, $that->value);
     }
     return -$that->compareTo($this);
 }
Example #2
0
 /**
  * Creates a BigRational of the given value.
  *
  * @param \Arki\Math\Number|int|float|string $value
  *
  * @return BigRational
  *
  * @throws \ArithmeticError If the value cannot be converted to a BigRational.
  */
 public static function of($value)
 {
     return parent::of($value)->toBigRational();
 }