FP exception

Richard B. Johnson (root@chaos.analogic.com)
Wed, 18 Nov 1998 16:49:43 -0500 (EST)


Tigran,

I lost the address of the caller with the 'C' program. Anyway don't you
mean this????

int main(int argc, char *argv[])
{
int a = -(MAXINT-1), b = -1, c = a*b;
^--------^---------------------- The negative of 1 less
or -MAXINT, the negative of MAXINT.

You can't use one more than MAXINT with division. There is
no place to put the result.

fprintf(stderr, "%d * %d = %d\n", a, b, c );
if (b) {
c = a / b;
fprintf(stderr, "%d/%d = %d\n", a, b, c );
}
return 0;
}

This works. However, I don't like integer overflow from division
causing a floating-point exception. But, looking at the signals available,
I'd say that there are not too many to chose from.

There isn't any SIGIDIV.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.1.128 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/