blob: 0382192d8cef49f5fc6d320f3d15a9dd6d5c47e4 (
plain)
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
|
program main
use, intrinsic :: iso_fortran_env, only : error_unit
implicit none
! http://fortranwiki.org/fortran/show/Real+precision
integer, parameter :: sp = selected_real_kind(6, 37)
integer, parameter :: dp = selected_real_kind(15, 307)
real(sp) :: a32
real(dp) :: a64
real(sp), parameter :: pi32 = 4*atan(1._sp)
real(dp), parameter :: pi64 = 4*atan(1._dp)
if (pi32 == pi64) stop 1
call timestwo(a32)
call timestwo(a64)
contains
elemental subroutine timestwo(a)
class(*), intent(inout) :: a
select type (a)
type is (real(sp))
a = 2*a
type is (real(dp))
a = 2*a
type is (integer)
a = 2*a
end select
end subroutine timestwo
end program
|