libquad question
Dominique Dhumieres
dominiq@lps.ens.fr
Mon Sep 6 14:36:00 GMT 2010
Steve,
I am not sure to understand your problem. With the following
modification of your code:
integer, parameter :: k1 = selected_real_kind (precision (0.0))
integer, parameter :: k2 = max(k1, selected_real_kind (precision (0.0_k1) + 1))
integer, parameter :: k3 = max(k2, selected_real_kind (precision (0.0_k2) + 1))
integer, parameter :: k4 = max(k3, selected_real_kind (precision (0.0_k3) + 1))
integer, parameter :: k5 = max(k4, selected_real_kind (precision (0.0_k4) + 1))
real(k1) x4
real(k2) x8
real(k3) x10
real(k4) x16
real(k5) x32
!print *, k1, k2, k3, k4, k5
print *, 'k1 =', k1, selected_real_kind (precision (0.0))
print *, 'k2 =', k2, selected_real_kind (precision (0.0_k1) + 1)
print *, 'k3 =', k3, selected_real_kind (precision (0.0_k2) + 1)
print *, 'k4 =', k4, selected_real_kind (precision (0.0_k3) + 1)
print *, 'k5 =', k5, selected_real_kind (precision (0.0_k4) + 1)
print *
print *, 'x4 =', precision(x4), range(x4)
print *, 'x8 =', precision(x8), range(x8)
print *, 'xk3=', precision(x10), range(x10)
print *, 'xk4=', precision(x16), range(x16)
print *, 'xk5=', precision(x32), range(x32)
end
without the libquad patch I get for x86_64-apple-darwin10.4.0
[macbook] f90/bug% a.out
k1 = 4 4
k2 = 8 8
k3 = 10 10
k4 = 10 -1
k5 = 10 -1
x4 = 6 37
x8 = 15 307
xk3= 18 4931
xk4= 18 4931
xk5= 18 4931
and for powerpc-apple-darwin9
[karma] f90/bug% a.out
k1 = 4 4
k2 = 8 8
k3 = 16 16
k4 = 16 -1
k5 = 16 -1
x4 = 6 37
x8 = 15 307
xk3= 31 291
xk4= 31 291
xk5= 31 291
With the libquad patch on x86_64-apple-darwin10.4.0 I get
[macbook] f90/bug% a.out
k1 = 4 4
k2 = 8 8
k3 = 10 10
k4 = 16 16
k5 = 16 -1
x4 = 6 37
x8 = 15 307
xk3= 18 4931
xk4= 33 4931
xk5= 33 4931
i.e., the libquad patch adds REAL(16) to REAL(4), REAL(8), and REAL(10),
the later being unavailable on PPC for which REAL(16) is already
provided by the so called IBM format (in fact two REAL(8) glued together).
Cheers,
Dominique
More information about the Fortran
mailing list