macrelop.blogg.se

Fortran print
Fortran print







fortran print fortran print

Someone might have more experience with this part, and hopefully they will chime in. Neither of my compilers ( pgf90 10.6-0, ifort 12.0.2.137, gfortran 4.5.1) support quad-precision integer. It does not quite answer your question exactly, which is why there are no spaces in output for a quad-precision integer. This answers why you get spaces in output for default formatting. The fourth line is the same value from the 2nd line, but in 8-byte integer representation. Third line is the largest value of an 8-byte integer. Second line is the largest value a 4-byte integer can take. Notice the spaces to fill up to the maximum possible size. The first line is a small number in 4-byte integer representation. When compiler with gfortran, the output is: 23 Print*,b ! medium lenght value, long integer, we expect spaces Print*,huge(b) ! maximum value, long integer, we expect no spaces Print*,huge(a) ! maximum value, short integer, we expect no spaces Print*,a ! small value, short integer, we expect spaces Integer(kind=8) :: b ! long integer for my compiler Default formatting uses as much space is possibly needed by the data type being output, without making adjustments based on the value.Ĭonsider following code: integer(kind=4) :: a ! short integer for my compiler

fortran print

Print* is equivalent to write(unit=*,fmt=*), where fmt=* means use default formatting for the output, which may be compiler dependent. This happens because you are using default formatting for the output.









Fortran print