How Can I Define and Use Very Small Numbers in Fortran 90?

  • Context: Fortran 
  • Thread starter Thread starter TheIsingGuy
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

Defining and using very small numbers in Fortran 90, particularly on the scale of 10^-30, presents significant computational challenges due to overflow errors. The discussion highlights that using double precision variables can lead to inaccuracies when performing operations with such small values. Non-dimensionalizing variables is recommended to improve accuracy in computations. For extreme cases, exploring alternative algorithms and consulting IEEE papers is advised to handle the limitations of double precision effectively.

PREREQUISITES
  • Understanding of Fortran 90 programming language
  • Familiarity with double precision data types
  • Knowledge of non-dimensionalization techniques in computational fluid dynamics (CFD)
  • Basic concepts of numerical stability and overflow errors
NEXT STEPS
  • Research non-dimensionalization methods in CFD
  • Explore alternative algorithms for handling small number computations
  • Study IEEE standards for floating-point arithmetic
  • Review literature on numerical methods for high-accuracy computations
USEFUL FOR

Researchers, engineers, and developers working with Fortran 90 who need to perform high-precision calculations involving very small numbers, particularly in fields like computational fluid dynamics.

TheIsingGuy
Messages
20
Reaction score
0
how do I define and use small numbers for computations? on the scale of 10^-30?

e.g.
Program A
implicit none
double precision a,b,c,d
c = (a*b)/(a+b)
d = etc...

End program

The above has an overflow error when I give a,b the values 3.345 * 10^-27

Can anyone help?

Thanks

Ising
 
Technology news on Phys.org
You're going to run into problems on any computer trying to do those computations. I am from the high-accuracy CFD world. Many solvers will attempt to solve for the dimensional variables directly. Unfortunately in the equations, you get very large (and very small, O e+-8) running around. Performing computations on numbers like this results in poor accuracy.

In order to avoid this, we non-dimensionalize all the variables first. Insteady of pressure being 101,300, it becomes 0.714, instead of density being 0.0012, it becomes 1.0. This makes the speed of sound 1.0, etc, etc.

In your case, if this is unavoidable, you'll have to go to alternate algorithms for this. Try to check out some IEEE papers, you might be able to find something. I was able to find this page though:
http://docs.sun.com/app/docs/doc/801-7639/6i1ucu1ug?a=view

The first computation in that equation should give a number on the order of e-700, which is out of the range of double precision.
 
Last edited by a moderator:

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 59 ·
2
Replies
59
Views
12K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 26 ·
Replies
26
Views
4K
  • · Replies 22 ·
Replies
22
Views
5K