signal functions are used to check operation like 0.1e-100/10e+100 for if the result out of range of double(float,...) or not
from the theory :
if we have digital forms of some numbers : 1110101010 and 1100101010 (same size ,of course) , while additioning them , we can have 1 , that is nowhere to write ( no place) , in this situation , proc-or put a flag on this operation and the signal func-ion read this flag...
ok, now practise - example is:
Code:
#include<signal.h>
#include<stdio.h>
#include<stdlib.h>
void hey()
{
printf("!Signal Error! Program interrupted.... Division by zero or overflow\n");
getchar();
exit(1);
}
int main()
{
float z=0.1e-100,k=0.1e-100;
signal(SIGFPE,hey);
printf("%e",z/k);getchar();
}
the questions are , what 1)why and maybe 2) what shall i do , to make it work?
psss.
if you have found a weird mistake in my grammar, dont be very surprised, cause i m from russia
