## digitalmars.D - pow

• aerto (2/2) Mar 21 2018 why pow(256, 27) gives 0, instead of
• Adam D. Ruppe (9/11) Mar 21 2018 that result is simply too big to fit in the result. Try using a
• aerto (3/14) Mar 21 2018 thanks, a last question in a diffrent function i use
• H. S. Teoh (10/12) Mar 21 2018 Because 256, being an int type, can only hold a 32-bit result, the
aerto <cvsc gmx.com> writes:
```why pow(256, 27) gives 0, instead of
105312291668557186697918027683670432318895095400549111254310977536L
```
Mar 21 2018
Adam D. Ruppe <destructionator gmail.com> writes:
```On Wednesday, 21 March 2018 at 15:56:00 UTC, aerto wrote:
why pow(256, 27) gives 0, instead of
105312291668557186697918027683670432318895095400549111254310977536L

that result is simply too big to fit in the result. Try using a

import std.bigint, std.stdio;

void main() {
BigInt i = 256;
i ^^= 27;
writeln(i);
}
```
Mar 21 2018
aerto <cvsc gmx.com> writes:
```On Wednesday, 21 March 2018 at 16:00:56 UTC, Adam D. Ruppe wrote:
On Wednesday, 21 March 2018 at 15:56:00 UTC, aerto wrote:
why pow(256, 27) gives 0, instead of
105312291668557186697918027683670432318895095400549111254310977536L

that result is simply too big to fit in the result. Try using a

import std.bigint, std.stdio;

void main() {
BigInt i = 256;
i ^^= 27;
writeln(i);
}

thanks, a last question in a diffrent function i use
writeln(105312291668557186697918027683670432318895095400549111254310977536L);
and i get Error: integer overflow any solution >?
```
Mar 21 2018
Adam D. Ruppe <destructionator gmail.com> writes:
```On Wednesday, 21 March 2018 at 16:29:26 UTC, aerto wrote:
thanks, a last question in a diffrent function i use

use

BigInt i =
"105312291668557186697918027683670432318895095400549111254310977536";

and it should work. Note the quotation marks - it reads it as a
string because a long number literal is limited o 64 bit
representations.
```
Mar 21 2018
"H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
```On Wed, Mar 21, 2018 at 03:56:00PM +0000, aerto via Digitalmars-d wrote:
why pow(256, 27) gives 0, instead of
105312291668557186697918027683670432318895095400549111254310977536L

Because 256, being an int type, can only hold a 32-bit result, the
maximum of which is 2^31 (or 2^32 if you use uint). But 256^27 = 2^216,
far bigger than a 32-bit int can hold.