File: format_28.f90

package info (click to toggle)
lfortran 0.59.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 56,736 kB
  • sloc: cpp: 168,052; f90: 74,272; python: 17,537; ansic: 7,705; yacc: 2,345; sh: 1,334; fortran: 895; makefile: 37; javascript: 15
file content (48 lines) | stat: -rw-r--r-- 1,468 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
program format_28
    implicit none
    integer w,io
    character(12) fmt
    real :: x = -0.0
    real, parameter :: a(4) = [ 1.0, 2.0, 3.0, 4.0 ]
    real, parameter :: b(4) = a / SUM(a)
    print "(4E11.3)", b
    do w = 6,9
      write(fmt,'(A,I0,A)') '(A,ES',w,'.2E1)'
      write(*,fmt,iostat=io) fmt//' ',3e20
      if(io/=0) cycle
    end do
    print "(ES6.2E1)", 3e20
    print "(ES7.2E1)", 3e20
    print "(ES8.2E2)", 3e20
    print "(ES9.2E1)", 3e20
    print "(ES10.2E1)", 3e20
    print "(ES11.2E1)", 3e20
    write(*,"(ES0.0E0)") 0.0
    write(*,"(ES0.0e0)") 10.0
    write(*,"(ES0.0E0)") 3.14159
    write(*,"(ES0.0E0)") 3.14159E+05
    write(*,"(ES0.0E0)") 1.23456789E+10
    write(*,"(ES0.0E0)") -1.23456789E+10
    write(*, "(ES7.3E4)") 1.23456789E+10
    write(*, "(ES7.3E4)") -1.23456789E+10
    write(*,"(ES10.3E2)") 1.23e-40
    write(*,"(ES10.3E2)") -1.23e-40
    write(*,"(ES10.2E1)") 123.45
    write(*,"(ES10.2E2)") 123.45
    write(*,"(ES10.2E3)") 123.45
    write(*,"(ES10.2E2)") 1.0e+2
    write(*,"(ES10.2E2)") 1.0e+0
    write(*,"(ES10.2E2)") 9.995e+0  
    write(*,"(SP,ES10.2E1)") 123.45
    write(*,"(SS,ES10.2E1)") 123.45
    write(*,"(ES4.1E1)") 3.14e+0 
    write(*,"(ES5.1E1)") 3.14e+0
    write(*,"(ES6.1E1)") 0.0
    write(*,"(ES0.0E0)") 0.0
    print '(E7.2)', 289.
    print '(E7.2)', 289.
    print '(E8.2)', 289.
    print '(E7.2)', 0.289
    print '(E9.2)', 1.23456789e+12
    print '(E7.2)', -289.
end program format_28