Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran 90 question

  1. Aug 13, 2009 #1
    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
     
  2. jcsd
  3. Aug 13, 2009 #2

    minger

    User Avatar
    Science Advisor

    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 [Broken]

    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: May 4, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Fortran 90 question
  1. Fortran 90 Question (Replies: 6)

Loading...