public static object Compare(long x, object other) { if (other is int) { return(CompareWorker(x, (long)(int)other)); } else if (other is long) { return(CompareWorker(x, (long)other)); } else if (other is double) { return(CompareWorker(x, (double)other)); } else if (other is BigInteger) { return(-(int)LongOps.Compare((BigInteger)other, x)); } else if (other is Complex64) { return(ComplexOps.TrueCompare(new Complex64((double)x, 0), (Complex64)other)); } else if (other is float) { return(CompareWorker(x, (double)(float)other)); } else if (other is bool) { return(CompareWorker(x, ((bool)other) ? 1L : 0L)); } else if (other is decimal) { return(CompareWorker(x, (decimal)other)); } else if (other is ulong) { return(CompareWorker(x, (ulong)other)); } Conversion conversion; double y = Converter.TryConvertToInt64(other, out conversion); if (conversion != Conversion.None) { CompareWorker(x, y); } return(Ops.NotImplemented); }
public new object CompareTo(object other) { return(LongOps.Compare(this, other)); }