• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rasing BigDecimal to a power  RSS feed

 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently I am working with J2SE 1.4 and I need to raise a BigDecimal to a power. There is no method in the class BigDecimal that let me do that, and the number is to big too fit in a double (furthermore double is not precise enough).

Any idea of what I should do?
[ June 18, 2005: Message edited by: Edwin Dalorzo ]
 
M Beck
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for integer exponents, it's reasonably easy to build your own pow() function. (easy enough that i have to wonder why it isn't there already, in fact...) negative integer exponents just take an additional division operation, and that's there. but real-number exponents would need a natural-logarithm function, which i see isn't there; on them, you may be out of luck (unless you're willing to put in the effort to fix this class up, that is).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!