- #1
ewant
- 8
- 0
Hello there,
This is my first post on this forum so bear with me if I don't know the rules or I am posting in the wrong area.
I am coding up an of equation for a scattering rate which involve quite a few positive (and a couple of negative) exponentials which often have terms that go into hundreds leading to results that have huge exponents. I originally wrote up this scattering rate in Mathematica and it didn't complain, but when I looked in detail at the equation some terms were reaching exponents of over a 1000!
I am writing the scattering rate in Fortran 95 for a simulator and this is where my problems occur. In Fortan95 I can use double precision numbers which have a max. exponent range of 10^+/-308 and I am overflowing. I am currently using the atomic unit system which should help as it normalizes a lot of the units to 1. The equation itself should produce a value between 0 and 1.
I have tried splitting up the equation into components, then taking the natural logarithm to try and simplify the problem but this has not helped. I started to think about trying to scale the numbers I am using in a manner similar to changing unit system, but I don't have any notes/references on where to start.
Any help/ideas on this would be a great help, thanks.
This is my first post on this forum so bear with me if I don't know the rules or I am posting in the wrong area.
I am coding up an of equation for a scattering rate which involve quite a few positive (and a couple of negative) exponentials which often have terms that go into hundreds leading to results that have huge exponents. I originally wrote up this scattering rate in Mathematica and it didn't complain, but when I looked in detail at the equation some terms were reaching exponents of over a 1000!
I am writing the scattering rate in Fortran 95 for a simulator and this is where my problems occur. In Fortan95 I can use double precision numbers which have a max. exponent range of 10^+/-308 and I am overflowing. I am currently using the atomic unit system which should help as it normalizes a lot of the units to 1. The equation itself should produce a value between 0 and 1.
I have tried splitting up the equation into components, then taking the natural logarithm to try and simplify the problem but this has not helped. I started to think about trying to scale the numbers I am using in a manner similar to changing unit system, but I don't have any notes/references on where to start.
Any help/ideas on this would be a great help, thanks.