[6] | 1 | ! $Header: /home/ssipsl/CVSREP/ORCHIDEE_OL/getprec.f90,v 1.3 2006/09/14 22:53:13 ssipsl Exp $ |
---|
| 2 | !- |
---|
| 3 | PROGRAM getprec |
---|
| 4 | !--------------------------------------------------------------------- |
---|
| 5 | !- This program verifies that that the number representation |
---|
| 6 | !- between the different components of the model are compatible |
---|
| 7 | !--------------------------------------------------------------------- |
---|
| 8 | USE defprec |
---|
| 9 | !- |
---|
| 10 | IMPLICIT NONE |
---|
| 11 | !- |
---|
| 12 | INTEGER :: i |
---|
| 13 | REAL :: r |
---|
| 14 | !- |
---|
| 15 | INTEGER :: range_int,range_real,precision_real |
---|
| 16 | !--------------------------------------------------------------------- |
---|
| 17 | range_int = RANGE(i) |
---|
| 18 | range_real = RANGE(r) |
---|
| 19 | precision_real = PRECISION(r) |
---|
| 20 | !- |
---|
| 21 | WRITE(*,*) 'The following ranges and precisions are standard' |
---|
| 22 | WRITE(*,*) 'on this computer with your compiler options :' |
---|
| 23 | WRITE(*,*) ' INTEGER range :',range_int |
---|
| 24 | WRITE(*,*) ' REAL range :',range_real |
---|
| 25 | WRITE(*,*) ' REAL precision :',precision_real |
---|
| 26 | !- |
---|
| 27 | WRITE(*,*) 'The corresponding kinds are :' |
---|
| 28 | WRITE(*,*) ' KIND for integer :', & |
---|
| 29 | & SELECTED_INT_KIND(range_int) |
---|
| 30 | WRITE(*,*) ' KIND for real :', & |
---|
| 31 | & SELECTED_REAL_KIND(precision_real,range_real) |
---|
| 32 | !- |
---|
| 33 | WRITE(*,*) 'We test if this corresponds to what is used' |
---|
| 34 | WRITE(*,*) 'in various parts of the code :' |
---|
| 35 | !- |
---|
| 36 | ! Real : |
---|
| 37 | !- |
---|
| 38 | IF (SELECTED_REAL_KIND(precision_real,range_real) /= r_std) THEN |
---|
| 39 | WRITE(*,*) ' REAL : ERROR, the wrong kind is specified.' |
---|
| 40 | WRITE(*,*) ' Use the value above.' |
---|
| 41 | ELSE |
---|
| 42 | WRITE(*,*) ' REAL : OK' |
---|
| 43 | ENDIF |
---|
| 44 | !- |
---|
| 45 | ! Integer : |
---|
| 46 | !- |
---|
| 47 | IF (SELECTED_INT_KIND(range_int) /= i_std) THEN |
---|
| 48 | WRITE(*,*) ' INTEGER : ERROR, the wrong kind is specified.' |
---|
| 49 | WRITE(*,*) ' Use the value above.' |
---|
| 50 | ELSE |
---|
| 51 | WRITE(*,*) ' INTEGER : OK' |
---|
| 52 | ENDIF |
---|
| 53 | !------------------ |
---|
| 54 | END PROGRAM getprec |
---|