×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

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

Precision

Precision

Precision

(OP)
hi everybody,
I am using f 77 and i want to use more than 14 decimal places (more than double precision). I would be glad if you could help me in this manner. thanks in advance, have a nice day.

RE: Precision

Just google for multi-precision arithmetic and fortran.

RE: Precision

You could always go to quadruple precision, which works the same as double precision.

RE: Precision

You'll notice that the quadruple precision is listed under:
NAG FORTRAN 77 EXTENSIONS

and that only double precision is listed as a "standard data type"

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

RE: Precision

As stated by others... "quad" precision is not truly defined or standard (even "double" depends on the computer system you are on).  Some compilers will give you the extended precision you want easily.

What type of application do you need the extra precision for?  Many times...  the extended precision is not really warranted.  Often, all you need is a slightly better algorithm.

Dan  smile

RE: Precision

I don't see how it really matters if QUAD precision is "standard" F77 or not--you might have the capability, you might not; it certainly doesn't hurt to try using QUAD, and the OP might just have that capability.

RE: Precision

Sometimes it matters,  sometimes it doesn't.  If he is writing a program that he wishes to use for a long time... or continue to add to and maintane in the future, or in the case that he wants it to run fast ( I doubt that is the case here, but... it is certainly a concern with some codes ).  C

If he wants fast executing code, using a data type that is native to the computer he is using is generally a better choice than to use a software implemented extended precision data type (slower calculations and a higher likelihood of bugs in the extended precision algorithm itself).  Keep in mind... most people on this forum probably think of Double Precision as giving up to about 16 digits of precision.  Though that may be true for Intel computers, it's not true of all others.  Some computers have over 30 digits of precision with their Double Precision variables.

If he is building a large code and/or a code that he intends to use well into the future, keeping it "standard conforming" with the fortran language as much as possible is ALWAYS a good choice.  Any time you move away from the language Standard, you risk having more maintenance headaches in the future. I generally conclude that the algorithm that can give the desired results using the least precision data type is the better solution.  This may not ALWAYS be true, however, I'm pretty sure it is true most of the time.

In any case...  whether or not to use an extended precision data type should be considered carefully when writing a code that you want to continue to use into the future.

Dan   smile
www.dtware.com

RE: Precision

(OP)
i am trying to write a script that will calculate the deflection (moments and shear also) of a plate, i solved a boundary value problem using mathematica, and since mathematica is very slow compared to fortran (i want to create a design table, or chart), i converted the script to fortran, however since the solution is a double series solution which is going to infinity (not the solution but the series when the series goes to infinity, the solution converges to the value). sometimes it is not converging using 20-30 terms , it may need more terms, thats why i need more precision and my compiler is even not supporting double precision, for some cases i need more than double precision.
as a simple example:

10^9* (0.123456789-0.123456788)
if you have 9 digits precision the result is 1, if you have a precision less than 9 the result is 0.

I guess i should switch to C which has big number option. thanks a lot for your valuable comments.

 

RE: Precision

Why not change compiler to g77 or g95.  They're both free and support double precision which will give appx 16SD.

RE: Precision

Hi Turantug,

Something doesn't seem quite right.  All Fortran compilers should allow you to declare Double Precision variables anytime you want to.  If they don't, they simply aren't valid fortran compilers.  And, if you are on a Windows computer, then... it is pretty much a given that your compilers idea of double precision is probably an 8-byte Real number.  That will generally mean 15-16 digits of precision.  My guess is that there is something in your code which is not quite right.  You might want to consider posting the part of your code that declares the variables for the math you are referring to in your prior post.  Also...  exactly which compiler are you using?

Dan   smile
www.dtware.com

RE: Precision

(OP)
thank you all for your valuable comments.
Dan, you are right, instead of quad precision i wrote double precison and  i am sure that my compiler is not supporting quad precision. i am using absoft pro fortran 7.5, and according to technical support people if i want to use quad precision, i need to upgrade my compiler and i dont want to upgrade. is there any free compiler that supports quad precision.   

RE: Precision

Look up multi-precision arithmetic on the net.  There are several free packages that support multi precision arithmetic if you wish to go in that direction instead of relying on compilers which may or may not have the quad precision flag.

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


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

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