From: eric948470 on 2 Apr 2010 16:35 How do I find the largest and smallest real numbers my Fortran77 compiler (gcc) is capable of handling. For example, in C, I'd check (if I remember correct) REAL_MAX and REAL_MIN in the header file limits.h. How do I do this in Fortran77?
From: Richard Maine on 2 Apr 2010 16:50 eric948470 <eric948470(a)gmail.com> wrote: > How do I find the largest and smallest real numbers my Fortran77 > compiler (gcc) is capable of handling. For example, in C, I'd check > (if I remember correct) REAL_MAX and REAL_MIN in the header file > limits.h. How do I do this in Fortran77? You look in the compiler documentation (which might not give the answer in quite that form, but ought to at least give sufficient data to compute it). If you insist on the Fortran of 3 decades ago (f77), there really is no other answer. F90+ has the HUGE intrinsic, which is at least close. Strictly speaking, HUGE does not necessarily tell you exactly the value of the largest real that the compiler can handle, but it ought to be at least a good approximation to it. In many cases, a good approximation is adequate. For those wondering about the details, HUGE gives the largest model number, which might not be exactly the same as the largest representable number. For the smallest (by which I assume you mean the smallest in magnitude), see the TINY intrinsic. In that case, the distinction between model numbers and representable ones can be more significant if the system allows denormalized numbers, as those typically are smaller in magnitude than the model numbers can go.) -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: mecej4 on 3 Apr 2010 20:59 On 4/2/2010 3:35 PM, eric948470 wrote: > How do I find the largest and smallest real numbers my Fortran77 > compiler (gcc) is capable of handling. For example, in C, I'd check > (if I remember correct) REAL_MAX and REAL_MIN in the header file > limits.h. How do I do this in Fortran77? Using the values in <limits.h> amounts to relying on those values being correct for the hardware. I could copy (or inherit, with some downloaded package), for example, a version of limits.h to a PC with values that were correct on some other machine, such as a VAX. If you truly want to _determine_ the values by probing your hardware and put the results into a header or include file, use the nifty routine ftp://ftp.netlib.org/blas/machar.f written by W.J. Cody. As Richard Maine has already written, this is all unnecessary in Fortran 9X and later. HTH. -- mecej4
From: aerogeek on 4 Apr 2010 23:48 On Apr 3, 1:35 am, eric948470 <eric948...(a)gmail.com> wrote: > How do I find the largest and smallest real numbers my Fortran77 > compiler (gcc) is capable of handling. For example, in C, I'd check > (if I remember correct) REAL_MAX and REAL_MIN in the header file > limits.h. How do I do this in Fortran77? If you are using Sun FORTRAN 77, then ephuge might ebthe function you are looking for. You can check more on this at this link http://www.oit.uci.edu/dcslib/sun/compilers/fortran/f77rm/6_intrinsics.doc.html
|
Pages: 1 Prev: Format Code Question Next: gfortran included in debian-live "rescue" CD version 5.03 |