Java.math.BigDecimal.pow() Method

Description

The java.math.BigDecimal.pow(int n, MathContext mc) method returns a BigDecimal whose value is (thisn). The current implementation uses the core algorithm defined in ANSI standard X3.274-1996 with rounding according to the context settings.

In general, the returned numerical value is within two ulps of the exact numerical value for the chosen precision.

Declaration

Following is the declaration for java.math.BigDecimal.pow() method

public BigDecimal pow(int n, MathContext mc)

Parameters

n - power to raise this BigDecimal to

mc - the context to use

Return Value

This method returns the value of BigDecimal Object raised to the power of n i.e thisn, using the ANSI standard X3.274-1996 algorithm.

Exception

ArithmeticException - if the result is inexact but the rounding mode is UNNECESSARY, or n is out of range.