news@caen.engin.umich.edu (news) (01/03/90)
In order to test some linpack routines (Fortran) I need to do some
trapping of arithmetic execptions . Some of the test programs
operate near underflow/overflow boundaries.
So I wrote a routine in C to do the trapping. I include below the headers of
such a routine ( a test program I have is 272 lines long if someone is
interested):
traps(i1max,i3max,i5max,i2max,i4max)
int i1max,i2max,i3max,i4max,i5max;
/*
This routine sets the number of arithmetic exceptions permitted.
i1max is the number of fixed point overflows permitted.
i2max is the number of fixed point divide by zero permitted.
i3max is the number of floating point overflows permitted.
i4max is the number of floating point divide by zero permitted.
i5max is the number of floating point underflows permitted.
*/
{
signal(SIGFPE,handler);
}
I've only been able to trap integer and floating division by zero.
Overflows and underflows are not caught at all (they return +Inf or -Inf or
just the biggest number you can have). This is not peculiar to the apollos.
I noticed a similar behavior on the suns, decs and alliant. I believe I read
somewhere this is what f77 following IEEE rules is supposed to do (I don't like it).
We are running SR10.1 (similar behavior in 10.2) BSD4.3.
My question: is it possible to trap (either in C or f77) overflows/underflows and
redirect control to a handler program ?
A example would be most welcome. Or if you already wrote such a trapping when
testing the linpack demos, I would appreciate getting a copy of it.
Roque D. Oliveira
oliveria@caen.engin.umich.edu
Computer Aided Engineering Network
U. of Michigan
oj@apollo.HP.COM (Ellis Oliver Jones) (01/05/90)
In article <47d29220.bb89@spam.engin.umich.edu> news@caen.engin.umich.edu (news) writes: >We are running SR10.1 (similar behavior in 10.2) BSD4.3. >My question: is it possible to trap (either in C or f77) overflows/underflows and >redirect control to a handler program ? look at /usr/apollo/man/mana/fpp_set_trap_enables.a /oj