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:
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...

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