My machine (or, perhaps the Java Math Library) is unable to calculate 2^1024(+), it can however, calculate up to 2^1023.

If I wanted to calculate a higher value, such as 2^1024, then how would I go about doing this? It can be in standard form if required.

I'm happy to implement C++ for this, but would prefer pure Java.

Any ideas? Is there some sort of algorithm I could use to allow larger operations? Could I some how split the calculation into several individual calculations, run them seperately, and then somehow combine the answers?

(I doubt I need to remind you that these are EXTREMELY large numbers; i.e:

2^1023 = 8.98846567431158e+307

Which is something like:

898846567431158000000000000000000000000000000000000000000000000000000000000000

000000000000000000000000000000000000000000000000000000000000000000000000000000

000000000000000000000000000000000000000000000000000000000000000000000000000000

000000000000000000000000000000000000000000000000000000000000000000000000

So, storing the results in a variable isn't my ultimate goal, I just need to output the solutions...

Thanks! :)

<script>

function power2(maxpower){

var pow =new Array()

digits=Math.round(4*(maxpo

len=0

for (i=0;i<=digits;i++)

{pow[i]=0}

pow[0]=1.0

for (power=0;power<=maxpower-1

{

for (i=0;i<=len;i++)

pow[i]+=pow[i]

lentemp=len

for (i=0;i<=lentemp-1;i++)

if (pow[i] >= 10000000000000)

{pow[i+1]+=1

pow[i]=pow[i]-100000000000

}

if (pow[lentemp] >= 10000000000000)

{pow[lentemp+1]+=1

pow[lentemp]=pow[lentemp]-

len+=1

}

}

document.f1.txt.value=""

digits=len

document.f1.txt.value=docu

for (i=0;i<=len;i++)

{l=Math.floor(Math.LOG10E*

if ((i!=0) && (l!=13))

{for (j=1;j<=13-l;j++)

document.f1.txt.value+="0"

document.f1.txt.value+=pow

}

</script>

<body>

<p>Enter value of power and click </p>

<form name="f1">

<p><input type="text" name="power" size="20">

<input type="button" value="calculate" onclick="power2(1.0*docume

<textarea name="txt" rows="20" cols="60"></textarea> </p>

</form>

</body>