MATHERR.C
上传用户:qq5388545
上传日期:2022-07-04
资源大小:29849k
文件大小:1k
- #include <stdio.h>
- #include <math.h>
- void main(void)
- {
- printf("Sqrt of -1 is %fn", sqrt(-1.0));
- }
- int matherr(struct exception *error)
- {
- switch (error->type) {
- case DOMAIN: printf("Domain errorn");
- break;
- case PLOSS: printf("Partial precision loss errorn");
- break;
- case OVERFLOW: printf("Overflow errorn");
- break;
- case SING: printf("Error in singularityn");
- break;
- case TLOSS: printf("Total precision loss errorn");
- break;
- case UNDERFLOW: printf("Underflow errorn");
- break;
- };
- printf("Error occurred in %s values %fn",
- error->name, error->arg1);
- error->retval = 1;
- return(1);
- }
-