dealing with large numbers
I'm supposed to calculate some rediculously large numbers (like 46^75). I know these numbers are definitely way beyond the capacity of doubles. Can anyone suggest a variable type to do that? Thanks.
instead of double, use long. ex:
They say if you play a Microsoft Windows CD backwards it will play satanic messages. But thats nothing, if you play it forwards it installs Windows.
That isn't quite long enough
BigDecimal d = new BigDecimal(Math.pow(46,75));
Thanks a bunch! Now another question is how do I raise this number to the power of 1/75? I know this sounds stupid, but my project requires such silly computations. so I need to do
(46^75)^(1/75), which will be 46 again. I know that BigInteger has a function called pow() but it only takes int. Any idea?
Well, n^(1/a) is equivalent to the a root of n. Unfortunately, BigInteger doesn't have a method for that either... I'm not sure how you would do that.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center