Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here



Can anyone help?

I am trying to recreate some arrays using a subroutine written by someone else.  By using real*8 throughout the program I get one set of results, by changing the precision in the subroutine to real at certain functions I get a differnt array resulting.  The array I want is the exact average of the two!

Any ideas?

Are there any problems with using a subroutine, written in 77, for a program in CVF.


RE: real*8


By default I only use double precision. When dealing with array manipulation, especially if it involves equation solving then single precision is a non-starter. It is bad practice to have mixed precision expressions, just because the result may be stored in a double precision variable doesn't mean you have double precision accuracy if it was calculated using single precision variables.

How do you know the result that you want? Are you trying to match results made years ago on a different computer system?

There should be no problem in using F77 with any later standard of Fortran.

RE: real*8

thanks for the advise,

I am trying to match results done a few years ago (1987), but I beleive these to be accurate as they correspond to other results.  
Also, the two matrices I get by varying the precision have the same amount of error when compared to the origional, only in different directions.

RE: real*8

In that case I don't beleive you will be able to match your 1987 results. I suspect your old results were produced on something like a digital VAX computer running under VMS, in which case you will never get an exact match on a PC.

RE: real*8

You might want to read up on how a computer does floating point operations and how variable precision plays a role. The Lahey.com website has an article on "The Perils of Floating Point" which you may find illuminating. Based on what I've read here so far...  I feel quite safe in saying that you currently have no way of knowing for sure what the correct results should be.  I would tend to guess that your double precision version is more likely to give good answers, however, that is not even close to guarantteed either.

Your results are dependant on several things.  The particular computer used,  CPU and possibly other hardware also,  the operating system used, the fortran compiler used and the compiler switches which were set when you compiled the program.  And last of all... the program code itself.  How can you be SURE that the routines logic is sound????


RE: real*8

Independent of the precision issue, it may simply be that you have ill-behaved algorithms and the errors emanate from poor formation of the equations, resulting in dependence on the least significant bits of the numbers.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close