fortranprecisionbitfortran90# What does "real*8" mean?

The manual of a program written in Fortran 90 says, "All real variables and parameters are specified in 64-bit precision (i.e. `real*8`

)."

According to Wikipedia, single precision corresponds to 32-bit precision, whereas double precision corresponds to 64-bit precision, so apparently the program uses double precision.

But what does `real*8`

mean?

I thought that the `8`

meant that 8 digits follow the decimal point. However, Wikipedia seems to say that single precision typically provides 6-9 digits whereas double precision typically provides 15-17 digits. Does this mean that the statement "64-bit precision" is inconsistent with `real*8`

?

Solution

As indicated in comments, `real*8`

isn't *standard* Fortran. This FAQ entry has more details. That said, once we're into the non-standard realm...

The 8 refers to the number of *bytes* that the data type uses.

So a 32-bit integer is `integer*4`

along the same lines. (But is also non-standard.)

A quick search found this guide to Fortran data types, which includes:

The "real

4" statement specifies the variable names to be single precision 4-byte real numbers which has 7 digits of accuracy and a magnitude range of 10 from -38 to +38. The "real" statement is the same as "real4" statement in nearly all 32-bit computers.

and

The "real

8" statement specifies the variable names to be double precision 8-byte real numbers which has 15 digits of accuracy and a magnitude range of 10 from -308 to +308. The "double precision" statement is the same as "real8" statement in nearly all 32-bit computers.

- Why am I getting this error? <class 'TypeError'>: wrong type
- GNU Fortran - Function 'dcosd' has no IMPLICIT type
- f2py does not properly import, despite successfully compiling
- Error in Python trying to create a list of a certain length after a call to Fortran to get the length
- How to get command line arguments of unknown length in Fortran?
- implicit real - complex conversion in fortran
- Optimal way to create once, then frequently access to a large array in Fortran
- How do you iterate through an array in Fortran?
- Why Intel Fortran + Intel MPI report warn(error) when using MPI_Bcast?
- Convert c_int to default kind integer
- Program in Fortran print different results with each execution
- How does work the OpenMP "nonmonotonic:dynamic" schedule?
- GFortran error: ld: library not found for -lSystem when trying to compile
- Write unformatted (binary data) to stdout
- How to call Fortran's FINDLOC within numpy's f2py
- QR factorization in Fortran
- Distribution of for loop iterations over triangular matrix with MPI
- Why MPI_REDUCE shows different number at some array locations?
- Conditional compilation in gfortran
- Fortran with Sparse BLAS not flushing memory
- Standard conforming way to get command line arguments in FORTRAN77
- Fortran C interface for program containing non-c-interoperable derived type
- Processing a shared array by a passed index in a subroutine in a parallel loop
- Gfortran type mismatch error despite "-fallow-argument-mismatch" flag
- Removing whitespace in string
- Pointer to OpenBLAS subroutines in fortran
- Valgrind complains reading from a file
- Use FP exception traps (-ffpe-trap/-fpe0) for code linked against SIGFPE-unsafe library (libxml2)
- Reading missing data from a file
- Do most compilers optimize MATMUL(TRANSPOSE(A),B)?