[comp.sys.ibm.pc] MS Fortran v 5.0 error trapping

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (07/25/89)

(This is a repost from alt.msdos.programmer - I didn't get any replies there.
Sorry if anyone has had to read it twice!)

I've just bought Microsoft Fortran version 5.0, in order to work with a function
minimizing program that was written for a mainframe.  My program works, mostly,
but occasionally aborts with overflows or out of range values.  On the HP3000
where it last ran it was possible to trap each of these errors, set a flag,
and return a default value, so the program could continue on.  

In the MS Fortran manual, the only mention of error trapping that I can find
has to do with I/O errors.  Is it really impossible to trap calculation errors
in MS Fortran?

Duncan Murdoch

barkdoll@cattell.psych.upenn.edu (Ed Barkdoll) (07/27/89)

In article <319@maytag.waterloo.edu> dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes:
>
>I've just bought Microsoft Fortran version 5.0, in order to work with a function
>minimizing program that was written for a mainframe.  My program works, mostly,
>but occasionally aborts with overflows or out of range values.  On the HP3000
> ...
>In the MS Fortran manual, the only mention of error trapping that I can find
>has to do with I/O errors.  Is it really impossible to trap calculation errors
>in MS Fortran?
>
>Duncan Murdoch
	In MS fortran 4.1 you can handle so called floating point exceptions
by calling LCWRQQ. Page 363 of the manual states:

"The LCWRQQ procedure sets the control word to a given value.  LCWRQQ has the 
following declaration:
SUBROUTINE LCWRQQ(CW)
INTEGER*2 CW

The integer*2 argument passed to LCWRQQ is known as the 'users control word'"


	According to page 362 passing a control word value of 4926 should
disable overflow and zero divide errors.  I haven't tried it myself so I can't
vouch for it and the call may be different for fortran 5.0

	Edwin Barkdoll [barkdoll@cattell.psych.upenn.edu]