2 ! testcase from PR 19032 adapted for testsuite
3 ! Our implementation of modulo was wrong for P = 1 and P = -1,
4 ! both in the real and the integer case
6 integer, parameter :: n
=16
7 real, dimension(n
) :: ar
, br
, modulo_result
, floor_result
8 integer, dimension(n
) :: ai
, bi
, imodulo_result
, ifloor_result
14 bi(1:4) = (/ 3,-3, 1, -1/)
20 modulo_result
= modulo(ar
,br
)
21 imodulo_result
= modulo(ai
,bi
)
22 floor_result
= ar
-floor(ar
/br
)*br
23 ifloor_result
= nint(real(ai
-floor(real(ai
)/real(bi
))*bi
))
26 if (modulo_result(i
) /= floor_result(i
) ) then
27 ! print "(A,4F5.0)" ,"real case failed: ", &
28 ! ar(i),br(i), modulo_result(i), floor_result(i)
31 if (imodulo_result(i
) /= ifloor_result(i
)) then
32 ! print "(A,4I5)", "int case failed: ", &
33 ! ai(i), bi(i), imodulo_result(i), ifloor_result(i)