Logo

Programming-Idioms

History of Idiom 66 > diff from v320 to v321

Edit summary for version 321 by :

Version 320

2015-11-01, 23:06:22

Version 321

2015-11-30, 12:37:30

Idiom #66 Big integer exponentiation

Calculate the result z of x power n, where x is a big integer and n is a positive integer.

Idiom #66 Big integer exponentiation

Calculate the result z of x power n, where x is a big integer and n is a positive integer.

Imports
import java.math.BigInteger;
Imports
import java.math.BigInteger;
Code
BigInteger z = x.pow(n);
Code
BigInteger z = x.pow(n);
Comments bubble
This leaves x unchanged.
Comments bubble
This leaves x unchanged.
Demo URL
http://ideone.com/cDCzYo
Demo URL
http://ideone.com/cDCzYo