Sometime you need to create or pass on a Java BigDecimal
value. That's easy to do with javaCast( 'BigDecimal', 123 )
but sometimes a Java rounding error creeps in which can mean you actually have 123.00000000002
which can break the code that's expecting the BigDecimal
value.
You can control the number of decimal places with javaCast( 'BigDecimal', 123 ).setScale( 2, 3 )
which sets the number of decimal places to 2
with 3
as the ceiling value.