My program has some problems with precision when using REAL(KIND=16) or REAL*16. Is there a way to go higher than that with precision?
-
1All the current crop of Fortran compilers support 32- and 64-bit floating-point numbers. Some support other sizes too. See the answers to http://stackoverflow.com/questions/22362211/confusing-double-precision-real-in-fortran for guidance on how to specify the kinds for your variables. – High Performance Mark Mar 13 '14 at 16:37
-
2real (N) is NOT the same as real*N and should not be used. See http://stackoverflow.com/questions/3170239/fortran-integer4-vs-integer4-vs-integerkind-4 and http://stackoverflow.com/questions/22362211/confusing-double-precision-real-in-fortran – M. S. B. Mar 13 '14 at 20:47
1 Answers
REAL*32
(kind values are not directly portable) would bee a 256 bit real
. There is no such IEEE floating point type. See http://en.wikipedia.org/wiki/IEEE_floating-point_standard
I don't know of any processor (compiler) that supports such a kind as an extension. Also, no hardware known to me handles this natively.
At such high precisions already I would reconsider the algorithm and its stability. It is not usual for program to need more then quad (your 16 bytes) precision. Even double is normally enough. I do many of my computations with single precision.
Finally, there are some libraries that support more precision, but their use is more complicated than just recompiling with different kind parameter. See
http://crd-legacy.lbl.gov/~dhbailey/mpdist/
At a special request: The kind numbers are implementation dependent. Kind 16 may not exist or may not denote IEEE 128 bit float. See many questions here Fortran: integer*4 vs integer(4) vs integer(kind=4) Fortran 90 kind parameter What does `real*8` mean? and so on.

- 1
- 1

- 57,977
- 4
- 76
- 119
-
I have never done that, but it is tiring to repeat the same words again. Here the intention of the question is totally clear. REAL*16 is unique at least in storage size, and in fact on all systems I know it is the IEEE 128 bit float. It was always a real variable for 16 characters - 16 bytes, although non-standard. – Vladimir F Героям слава Mar 13 '14 at 21:54