public function compareTo(Object $obj) { if ($obj === null) { throw new NullPointerException(); } if ($obj instanceof BigDecimal) { return bccomp($this->value, $obj->value); } throw new ClassCastException('Could not cast ' . $obj->getClass()->getName() . ' to BigDecimal.'); }
public function compareTo(Object $obj) { if ($obj === null) { throw new NullPointerException(); } if ($obj instanceof Float) { return $this->value - $obj->value < 0 ? -1 : ($this->value - $obj->value > 0 ? 1 : 0); } throw new ClassCastException('Could not cast ' . $obj->getClass()->getName() . ' to Float.'); }
public function compareTo(Object $obj) { if ($obj instanceof Byte) { return $this->value - $obj->value; } throw new ClassCastException('Could not cast ' . $obj->getClass()->getName() . ' to Byte.'); }