Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Precision

Status
Not open for further replies.

turantug

Civil/Environmental
Jun 1, 2006
11
0
0
TR
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.
 
Replies continue below

Recommended for you

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
 
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 :)
 
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.
 
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 :)
 
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.

 
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 :)
 
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.
 
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.
 
Status
Not open for further replies.
Back
Top