Package com.singularsys.jep.bigdecimal


package com.singularsys.jep.bigdecimal
A set of components for performing arbitrary precision arithmetic using the BigDecimal class to represent numbers. The package can be setup in a number of different ways using the BigDecComponents class:
  • With unlimited precision, some operators like division will fail
  • Using a MathContext specifying the number of significant figures, and rounding mode.
  • Fixed-point setup, with a specified number of decimal places to use for all results. (Since Jep 4.1)
// unlimited precision
jep = new Jep(new BigDecComponents());
// With the DECIMAL64, 16 digits and a rounding mode of half-even.
jep = new Jep(new BigDecComponents(MathContext.DECIMAL64));
// Fixed-point arithmetic with 2 decimal places, and a rounding mode of half-even.
jep = new Jep(new BigDecComponents(2));
// Fixed-point arithmetic with 2 decimal places, and a rounding mode of half-even
// and string support.
jep = new Jep(new BigDecComponents(MathContext.DECIMAL64, 2, false));
See Also: