NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Handling FPE


I compile and run the following short program:

#include <stdlib.h>
#include <stdio.h>

main(int argc, const char *argv)
        printf("%f\n", atoi("1")/atof("0.0"));

It exits successfully!

signal(7) reads:

     Value Name          Default Action       Description
     8     SIGFPE        create core image    floating-point exception

But I don't get my promised core image!
The process prints "inf" and procedes with "exit(0)".

Something is going wrong.

How do I generate FPE programmatically using mathematical operations?
I've tried acosh(atof("0.0")), but it generates "nan".
How do I deal with the software that relies on FPE being generated?


Home | Main Index | Thread Index | Old Index