How to stop a negative exponential from rounding to zero?

33 Views Asked by At

I'm doing materials homework and calculating vacancy density, which has some large constants (Na and k), and have to do the function. the right side of the density equation is exp(-Q/(kT)), which gives me, understandably, a very large negative exponent. Problem is, excel rounds whatever this number is to zero (I'm assuming from floating point arithmetic rounding). I then multiply it by Avogadro's number, potentially bringing it back up from an infinitesimal. But when excel, or even arbitrary precision calculators do it, they still return zero (times a constant). Is there a way to retain my incredibly, incredibly tiny exponential?

1

There are 1 best solutions below

1
On BEST ANSWER

If you are multiplying by a large number, consider working with the logarithm. $$\ln\left(N_Ae^{-\frac{Q}{kT}}\right) = \ln N_A - \frac{Q}{kT}.$$ You can do all of your arithmetic with the logarithms then compute the exponential as a final step.