1: program fpetst 2: character arg 3: logical flag 4: common /fpeflt/ flag 5: 6: call trpfpe(1, 1.2345d0) 7: call traper(3) 8: i = 10 9: j = 0 10: x = 10. 11: y = 0. 12: 13: write (*,*) 14: call getarg (1, arg) 15: if (arg .eq. '1') then 16: write(*,*) 'testing integer overflow, flag=', flag 17: k = inmax() + 10 18: write (*,*) 'k=', k, 'flag=', flag 19: stop('returned') 20: else if (arg .eq. '2') then 21: write(*,*) 'testing integer divide by 0, flag=', flag 22: k = i / j 23: write (*,*) 'k=', k, 'flag=', flag 24: stop('returned') 25: else if (arg .eq. '3') then 26: write(*,*) 'testing floating overflow, flag=', flag 27: z = flmax() * 10. 28: write(*,*) 'z=', z, 'flag=', flag 29: stop('returned') 30: else if (arg .eq. '4') then 31: write(*,*) 'testing floating divide by 0, flag=', flag 32: z = x / y 33: write(*,*) 'z=', z, 'flag=', flag 34: stop('returned') 35: else if (arg .eq. '5') then 36: write(*,*) 'testing floating underflow, flag=', flag 37: z = flmin() / 10. 38: write(*,*) 'z=', z, 'flag=', flag 39: stop('returned') 40: endif 41: write(*,*) 'what??' 42: end