| 1 |
! Program to test the real->integer conversion routines. |
| 2 |
program intrinsic_integer |
| 3 |
implicit none |
| 4 |
|
| 5 |
call test (0.0, (/0, 0, 0, 0/)) |
| 6 |
call test (0.3, (/0, 1, 0, 0/)) |
| 7 |
call test (0.7, (/0, 1, 0, 1/)) |
| 8 |
call test (-0.3, (/-1, 0, 0, 0/)) |
| 9 |
call test (-0.7, (/-1, 0, 0, -1/)) |
| 10 |
contains |
| 11 |
subroutine test(val, res) |
| 12 |
real :: val |
| 13 |
integer, dimension(4) :: res |
| 14 |
|
| 15 |
if ((floor(val) .ne. res(1)) .or. (ceiling(val) .ne. res(2)) & |
| 16 |
.or. (int(val) .ne. res(3)) .or. (nint(val) .ne. res(4))) STOP 1 |
| 17 |
end subroutine |
| 18 |
end program |