why i multiply many number make a mistake when i division?

According to wolfram alpha, the result is


However in java the largest number an int can store is


And even a long integer, which is 64 bits can only hold


To get around this, you will need to use some form of big number class. See this question for some ways of doing so.

To summarise that linked question, you can use the big integer class from java.math to get around this:

BigInteger result = new BigInteger("117288381359406970983270");

It also includes functions to add and multiply BigIntegers.

Browse More Popular Posts

Leave a Comment