public void testDoublesRoundTrip(){
  byte[] encoded=new byte[Double.BYTES];
  for (int i=0; i < 10000; i++) {
    double value=Double.longBitsToDouble(TestUtil.nextLong(random(),Long.MIN_VALUE,Long.MAX_VALUE));
    NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(value),encoded,0);
    double actual=NumericUtils.sortableLongToDouble(NumericUtils.sortableBytesToLong(encoded,0));
    assertEquals(Double.doubleToLongBits(value),Double.doubleToLongBits(actual));
  }
}

public void testDoublesRoundTrip ( ) { byte [ ] encoded = new byte [ Double . BYTES ] ; for ( int i = 0 ; i < 10000 ; i ++ ) { double value = Double . longBitsToDouble ( TestUtil . nextLong ( random ( ) , Long . MIN_VALUE , Long . MAX_VALUE ) ) ; NumericUtils . longToSortableBytes ( NumericUtils . doubleToSortableLong ( value ) , encoded , 0 ) ; double actual = NumericUtils . sortableLongToDouble ( NumericUtils . sortableBytesToLong ( encoded , 0 ) ) ; assertEquals ( Double . doubleToLongBits ( value ) , Double . doubleToLongBits ( actual ) ) ; } }
test round - trip encoding of random doubles
