Click to See Complete Forum and Search --> : Big Numbers!


crazycoder
10-01-2006, 03:08 PM
how do I get a really big number to show all the digits instead it automatically using expononents?

Khalid Ali
10-01-2006, 06:45 PM
convert it to a string...:-)
String reallyBigNumberStr = new String(reallyBigNumber);

crazycoder
10-03-2006, 04:25 PM
So, like,

long n = Math.pow(2, 100);
System.out.println(new String(n));
?

crazycoder
10-05-2006, 12:31 PM
I tried that above and it didn't work

agent_x91
10-09-2006, 04:17 AM
You could always try making a method which will convert a string version of the number in standard form into a string version with the actual number, eg. split the e into two numbers (before the e we'll use first_part, and after we'll use second_part) and try this:


int secondp=Integer.parseInt(second_part);

for(int i=0;i<=secondp;i++)
first_part+="0";


And if you really wanted to, you could then put the string version of the number through a method to add commas in the correct places. :)

crazycoder
10-09-2006, 11:53 AM
isn't 'e' exponent?

agent_x91
10-10-2006, 08:12 AM
From my understanding 'e' means "ten to the power of..."

the number before e is multiplied by ten to the power of the number after e.