Unsupported Conversions

Implicit conversions between different numeric types are not carried out for the BigDecimal and BigInteger methods.

See Implicit Conversions Between Numeric Types.

For example, the following is not valid:

// Invalid example
var pi = ScriptUtil.createBigDecimal("3.14159");
var twoPi = pi.multiply(2);
// Implicit conversion of integer to BigDecimal is not done here

Instead, you must always pass BigDecimal parameters to the BigDecimal methods that require them as shown in this example:

var pi = ScriptUtil.createBigDecimal("3.14159");
var twoPi = pi.multiply(ScriptUtil.createBigDecimal(2));