round(nan(), 2) returns 0.0
`SELECT round(nan(), 2)` results in `0.0`, but should be `NaN`. This is a regression since 0.144.5.

diff --git a/presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java b/presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java
index c7a1031919..de0796209f 100644
--- a/presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java
+++ b/presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java
@@ -465,6 +465,10 @@ public final class MathFunctions
     @SqlType(StandardTypes.DOUBLE)
     public static double round(@SqlType(StandardTypes.DOUBLE) double num, @SqlType(StandardTypes.BIGINT) long decimals)
     {
+        if (Double.isNaN(num)) {
+            return num;
+        }
+
         double factor = Math.pow(10, decimals);
         return Math.round(num * factor) / factor;
     }
diff --git a/presto-main/src/test/java/com/facebook/presto/operator/scalar/TestMathFunctions.java b/presto-main/src/test/java/com/facebook/presto/operator/scalar/TestMathFunctions.java
index 4a937b84e4..8b05ad68ac 100644
--- a/presto-main/src/test/java/com/facebook/presto/operator/scalar/TestMathFunctions.java
+++ b/presto-main/src/test/java/com/facebook/presto/operator/scalar/TestMathFunctions.java
@@ -485,6 +485,8 @@ public class TestMathFunctions
         assertFunction("round(CAST(NULL as DOUBLE), CAST(NULL as BIGINT))", DOUBLE, null);
         assertFunction("round(-3.0, CAST(NULL as BIGINT))", DOUBLE, null);
         assertFunction("round(CAST(NULL as DOUBLE), 1)", DOUBLE, null);
+
+        assertFunction("round(nan(), 2)", DOUBLE, Double.NaN);
     }
 
     @Test
['presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java', 'presto-main/src/test/java/com/facebook/presto/operator/scalar/TestMathFunctions.java']