1 !Program to test NEAREST intrinsic function.
4 real s, r, x, y, inf, max, min
5 integer i, infi, maxi, mini
27 if (.not. (x .gt. s .and. y .lt. s )) call abort()
33 call test_up(max, inf)
34 call test_up(-inf, -max)
38 call test_down(inf, max)
39 call test_down(-max, -inf)
40 call test_down(0, -min)
41 call test_down(min, 0)
44 subroutine test_up(s, e)
48 if (x .ne. e) call abort()
51 subroutine test_down(s, e)
55 if (x .ne. e) call abort()
58 subroutine test_n(s1, r)
62 if (nearest(x, -r) .ne. s1) call abort()
64 if (nearest(x, r) .ne. s1) call abort()
68 if (nearest(x, -r) .ne. s1) call abort()
70 if (nearest(x, r) .ne. s1) call abort()