Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Rasing BigDecimal to a power

 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
reply
    Bookmark Topic Watch Topic
  • New Topic