summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5test_kind.f90
diff options
context:
space:
mode:
Diffstat (limited to 'fortran/src/H5test_kind.f90')
-rw-r--r--fortran/src/H5test_kind.f9022
1 files changed, 14 insertions, 8 deletions
diff --git a/fortran/src/H5test_kind.f90 b/fortran/src/H5test_kind.f90
index 9ef4753..feef616 100644
--- a/fortran/src/H5test_kind.f90
+++ b/fortran/src/H5test_kind.f90
@@ -76,19 +76,25 @@
jr = 0
write(*, "("" subroutine r"" i2.2,""()"")") j
write(*,*)" implicit none"
- write(*,*)" real :: b"
- write(*,*)" integer :: a(8)"
+ write(*,*)" real :: b(1)"
+ write(*,*)" integer :: a(1)"
write(*,*)" integer :: a_size"
- write(*,*)" integer :: b_size"
- write(*,*)" a_size = bit_size(a(1))"
- write(*,*)" b_size = size(transfer(b,a))*a_size"
- write(*,*)" if (b_size .eq. 32) then"
+ write(*,*)" integer :: real_size"
+ write(*,*)" integer :: ab_size ! How many integers needed to hold a real"
+ write(*,*)" integer :: ba_size ! How many reals needed to hold an integer"
+ write(*,*)" a_size = bit_size(a(1)) ! Size in bits for integer"
+ write(*,*)" ab_size = size(transfer(b,a))"
+ write(*,*)" ba_size = size(transfer(a,b))"
+ write(*,*)" if (ab_size .eq. ba_size) real_size=a_size"
+ write(*,*)" if (ab_size .gt. ba_size) real_size=a_size*ba_size"
+ write(*,*)" if (ab_size .lt. ba_size) real_size=a_size/ba_size"
+ write(*,*)" if (real_size .eq. 32) then"
write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_REAL_NATIVE_4"" "
write(*,*)" endif"
- write(*,*)" if (b_size .eq. 64) then"
+ write(*,*)" if (real_size .eq. 64) then"
write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_REAL_NATIVE_8"" "
write(*,*)" endif"
- write(*,*)" if (b_size .eq. 128) then"
+ write(*,*)" if (real_size .eq. 128) then"
write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_REAL_NATIVE_16"" "
write(*,*)" endif"
write(*,*)" return"