I am writing some software to compute partition functions from some monte carlo simulations. The issue is that I have to make sure that I dont obtain nonsens due to the limitations of the size of a float.
I am worried about the following piece of code:
----------------------
arg = (BETA[k]-BETA[j])*Eis + Z[k]-Z[j]
den+=exp(arg)
---------------------------
Now, arg can be rather large. So how can I find out what is the largest/smallest argument that exp can operate on? Also, I suppose that I can declare 'den' as a long double, but that will not help, since exp returns only a double, right?
I am doing this with gcc (g++) on a 64 bit intel mac.
Best
Carlis
I am worried about the following piece of code:
----------------------
arg = (BETA[k]-BETA[j])*Eis
den+=exp(arg)
---------------------------
Now, arg can be rather large. So how can I find out what is the largest/smallest argument that exp can operate on? Also, I suppose that I can declare 'den' as a long double, but that will not help, since exp returns only a double, right?
I am doing this with gcc (g++) on a 64 bit intel mac.
Best
Carlis