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

  • Thread starter Thread starter TheIsingGuy
  • Start date Start date
  • Tags Tags
    Fortran
AI Thread Summary
When performing computations with extremely small numbers, such as on the scale of 10^-30, overflow errors can occur, particularly in double precision calculations. The discussion highlights that using direct dimensional variables can lead to significant accuracy issues due to the presence of both very large and very small numbers in equations. To mitigate these problems, it is recommended to non-dimensionalize variables before performing calculations. This involves scaling values to a reference point, which can improve computational accuracy. If non-dimensionalization isn't feasible, exploring alternative algorithms or methods, as suggested in IEEE literature, may be necessary. The initial computation in the example provided is likely to yield a result in the range of e-700, which exceeds the limits of double precision representation.
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:
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
4
Views
2K
Replies
5
Views
5K
Replies
59
Views
11K
Replies
7
Views
3K
Replies
8
Views
4K
Replies
13
Views
2K
Replies
3
Views
3K
Replies
22
Views
5K
Back
Top