We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Use of BigDecimal for huge numbers
Page Index Toggle Pages: 1
Use of BigDecimal for huge numbers (Read 488 times)
Use of BigDecimal for huge numbers
Mar 9th, 2007, 2:04pm
 
I'm trying to deal with some huge numbers, as the default pow() function returns infinity for a problem I am working on.  

Can you advise where I am going wrong?

---code ---

java.math.BigDecimal pow_huge (int num, int power) {
 
 java.math.BigDecimal d_num = new java.math.BigDecimal(num);
 
 return d_num.pow(power); // << line 181

}


--- error ---

/tmp/build34005.tmp/Temporary_629_8642.java:181:10:181:25: Semantic Error: No accessible method with signature "pow(int)" was found in type "java.math.BigDecimal".

Re: Use of BigDecimal for huge numbers
Reply #1 - Mar 9th, 2007, 2:33pm
 
BigDecimal.pow(int) was introduced in Java 1.5.  (You can tell by looking at the "Since:" value in the javadoc.)
Page Index Toggle Pages: 1