- 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/main/java/org/elasticsearch/xpack/sql/expression/function/scalar/math/BinaryOptionalMathProcessor.java
if ((left instanceof Number) == false) {
                throw new SqlIllegalArgumentException("A number is required; received [{}]", left);
            }
            if (right != null) {
                if ((right instanceof Number) == false) {
                    throw new SqlIllegalArgumentException("A number is required; received [{}]", right);
                }
                if (right instanceof Float || right instanceof Double) {
                    throw new SqlIllegalArgumentException("An integer number is required; received [{}] as second parameter", right);
                }
            } else {
                right = 0;
            }
            return process.apply(left, right);
        }
    }
    private final Processor left, right;
    private final BinaryOptionalMathOperation operation;
    public static final String NAME = "mob";
    public BinaryOptionalMathProcessor(Processor left, Processor right, BinaryOptionalMathOperation operation) {
        this.left = left;
        this.right = right;
        this.operation = operation;
    }
    public BinaryOptionalMathProcessor(StreamInput in) throws IOException {
        left = in.readNamedWriteable(Processor.class);
        right = in.readOptionalNamedWriteable(Processor.class);
        operation = in.readEnum(BinaryOptionalMathOperation.class);
    }
    @Override