The pow(int) method added in jsr13 calculates the return value with
return new BigDecimal(intVal.pow(n), scale * n);
This scale calculation is not properly guarded against integer over/underflow, allowing for potentially very misleading results. Additionally, the calculation of 0^n should probably be special-cased.
return new BigDecimal(intVal.pow(n), scale * n);
This scale calculation is not properly guarded against integer over/underflow, allowing for potentially very misleading results. Additionally, the calculation of 0^n should probably be special-cased.
- relates to
-
JDK-4851776 Allow control of precision and rounding of BigDecimal arithmetic operations
- Resolved
-
JDK-4609098 Add Decimal Arithmetic Enhancements into J2SE (JSR-013)
- Closed