diff --git a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java
index <HASH>..<HASH> 100644
--- a/presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java
+++ b/presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java
@@ -23,7 +23,7 @@ final class FloatingPointBitsConverterUtil
      */
     public static long doubleToSortableLong(double value)
     {
-        long bits = Double.doubleToRawLongBits(value);
+        long bits = Double.doubleToLongBits(value);
         return bits ^ (bits >> 63) & Long.MAX_VALUE;
     }
Discard double NaN differentiation while sorting

NaNs are not comparable (NaN != NaN) and Java's Double.compare(double, double) returns 0 for all NaN representations, thus differentiation between NaNs should be discarded for sorting purposes.