public static int compareLongAgainstDouble( long lhs, double rhs ) { return -compareDoubleAgainstLong( rhs, lhs ); }
private static int compareDoubleAgainstRawType( double lhsDouble, long rhsRawBits, byte rhsType ) { if ( rhsType == BYTE || rhsType == SHORT || rhsType == INT || rhsType == LONG ) { return NumberValues.compareDoubleAgainstLong( lhsDouble, rhsRawBits ); } else if ( rhsType == FLOAT ) { return Double.compare( lhsDouble, Float.intBitsToFloat( (int) rhsRawBits ) ); } else if ( rhsType == DOUBLE ) { return Double.compare( lhsDouble, Double.longBitsToDouble( rhsRawBits ) ); } // We can not throw here because we will visit this method inside a pageCursor.shouldRetry() block. // Just return a comparison that at least will be commutative. return Long.compare( Double.doubleToLongBits( lhsDouble ), rhsRawBits ); } }
@Override public int compareTo( IntegralValue other ) { return NumberValues.compareDoubleAgainstLong( doubleValue(), other.longValue() ); }
public static int compareLongAgainstDouble( long lhs, double rhs ) { return -compareDoubleAgainstLong( rhs, lhs ); }
private static int compareDoubleAgainstRawType( double lhsDouble, long rhsRawBits, byte rhsType ) { if ( rhsType == BYTE || rhsType == SHORT || rhsType == INT || rhsType == LONG ) { return NumberValues.compareDoubleAgainstLong( lhsDouble, rhsRawBits ); } else if ( rhsType == FLOAT ) { return Double.compare( lhsDouble, Float.intBitsToFloat( (int) rhsRawBits ) ); } else if ( rhsType == DOUBLE ) { return Double.compare( lhsDouble, Double.longBitsToDouble( rhsRawBits ) ); } // We can not throw here because we will visit this method inside a pageCursor.shouldRetry() block. // Just return a comparison that at least will be commutative. return Long.compare( Double.doubleToLongBits( lhsDouble ), rhsRawBits ); } }
@Override public int compareTo( IntegralValue other ) { return NumberValues.compareDoubleAgainstLong( doubleValue(), other.longValue() ); }