About BigDecimals
The BigDecimal class provides a decimal, floating-point arithmetic which produces arbitrary-precision signed decimal numbers. Use BigDecimals when you do not want to be limited and you need more precision than floats allow.
For a description and comparison of the different types of floating-point numbers (floats, doubles, and BigDecimals), see Floating-Point Literals.
-
Java constructors to specify a scale.
-
Java methods [divide(BigDecimal, int), divide(BigDecimal, int, int), and setScale(int, int))].
-
Cisco Unified CCX math operators (see BigDecimal Enhancements and BigDecimals tab Syntax Buttons).
Because the BigDecimal class gives you control over rounding and the number of decimal places you are interested in, it can be useful when dealing with money or in any circumstance where the tolerance for rounding errors is low.
As specified in the Sun Java specification on such, a BigDecimal consists of an arbitrary precision integer unscaled value and a non-negative 32-bit integer scale, which represents the number of digits to the right of the decimal point. The number represented by the BigDecimal is (unscaledValue/10scale). BigDecimal provides operations for basic arithmetic, scale manipulation, comparison, hashing, and format conversion.
For examples of how you can use BigDecimals, see Example BigDecimal Code and BigDecimal tab Syntax Buttons.