1

I have an Algorithmic implementation which deal in extremely small and extremely large values. I am using

BigDecimalMath result = BigDecimalMath.exp(a) 
//where a is any bigdecimal value

BigDecimalMath library can be found here https://arxiv.org/src/0908.3030v2/anc

According to my best knowledge this function calculate only upto E9 (i.e -3.44E9) but my smallest value is -3.47E14 (for which it give overflow error) I am implementing this Algorithm in JAVA as it already implemented in other programming languages so I have to find the solution for this problem.

Can anyone help in this with or without using this library.

K.Liaqat
  • 143
  • 1
  • 3
  • 14
  • What is BigDecimalMath? Is it part of java? If you mean groovy implementation, you should mention it in tags at least. – Artur Biesiadowski Mar 02 '17 at 13:23
  • Please check, I have updated the question with library detail. – K.Liaqat Mar 02 '17 at 13:28
  • 1
    take a look at: [Power by squaring for negative exponents](http://stackoverflow.com/a/30962495/2521214) – Spektre Mar 02 '17 at 13:34
  • Implementing this is going to be _extremely_ hard. You're probably going to have to use the Taylor series expansion for exponentiation and also figure out how to calculate to a specified precision, because most results will be irrational. – Louis Wasserman Mar 02 '17 at 19:50
  • 1
    @LouisWasserman it is not that hard to code ... also no need for Taylor series [`log2,exp2` approach](http://stackoverflow.com/a/18169727/2521214) is enough and can be significantly speeded up by LUT of `0.5^(2^i)` The only problem is the `e` constant ... – Spektre Mar 03 '17 at 13:41

0 Answers0