1

I need to convert exponential values to log and back to exponential. Using it for noUislider. What i have tried,

Example A:

a = 5.45e-320
5.45e-320

b = Math.log(a)
-735.1316071514119

Math.exp(b)
5.45e-320

Example A is working fine for me but when i try this example

a = 2e-8
2e-8

b = Math.log(a)
-17.72753356339242

Math.exp(b)
2.0000000000000004e-8 

Expected and needed Output: 2e-8

I am curious to know how this Math.log and Math.exp works, I researched on many documents but didn't find my answer.

Please correct me if i am wrong here, Thanks.

Sandeep R
  • 11
  • 2
  • check this https://stackoverflow.com/questions/588004/is-floating-point-math-broken .You can find your answers there – rakesh Jun 08 '17 at 06:29

0 Answers0