- for Long values, the conversion from long to double can lead to loss of precision. Eg.

```
SELECT  CAST(ROUND(922337203685477580) AS LONG) as a
```

returns

```
922337203685477632
```

- for floating point values, when the two numbers passed to ROUND() funciton are too big, the values are truncated to Long.MAX_VALUE and hence wrongly rounded. Eg.

```
SELECT  ROUND(100000000000.0, 8) as a
```

returns

```
9.223372036854776E10
```
x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/expression/function/scalar/math/BinaryMathProcessorTests.java
}
    public void testRoundInputValidation() {
        SqlIllegalArgumentException siae = expectThrows(
            SqlIllegalArgumentException.class,
            () -> new Round(EMPTY, l(5), l("foobarbar")).makePipe().asProcessor().process(null)
        );
        assertEquals("A number is required; received [foobarbar]", siae.getMessage());
        siae = expectThrows(
            SqlIllegalArgumentException.class,
            () -> new Round(EMPTY, l("bla"), l(0)).makePipe().asProcessor().process(null)
        );
        assertEquals("A number is required; received [bla]", siae.getMessage());
        siae = expectThrows(
            SqlIllegalArgumentException.class,
            () -> new Round(EMPTY, l(123.34), l(0.1)).makePipe().asProcessor().process(null)
        );
        assertEquals("An integer number is required; received [0.1] as second parameter", siae.getMessage());
    }
    public void testTruncateWithValidInput() {
        assertEquals(123.0, new Truncate(EMPTY, l(123), l(3)).makePipe().asProcessor().process(null));
        assertEquals(123.4, new Truncate(EMPTY, l(123.45), l(1)).makePipe().asProcessor().process(null));
        assertEquals(123.0, new Truncate(EMPTY, l(123.45), l(0)).makePipe().asProcessor().process(null));
        assertEquals(123.0, new Truncate(EMPTY, l(123.45), null).makePipe().asProcessor().process(null));
        assertEquals(-100.0, new Truncate(EMPTY, l(-123), l(-2)).makePipe().asProcessor().process(null));
        assertEquals(-120.0, new Truncate(EMPTY, l(-123.45), l(-1)).makePipe().asProcessor().process(null));
        assertEquals(-123.0, new Truncate(EMPTY, l(-123.5), l(0)).makePipe().asProcessor().process(null));
        assertEquals(-123.0, new Truncate(EMPTY, l(-123.45), null).makePipe().asProcessor().process(null));
    }
    public void testTruncateFunctionWithEdgeCasesInputs() {
        assertNull(new Truncate(EMPTY, l(null), l(3)).makePipe().asProcessor().process(null));