| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | |
| 7 | #include <math.h> |
| 8 | #include <stdio.h> |
| 9 | |
| 10 | int __CRTDECL |
| 11 | _matherr (struct _exception *pexcept) |
| 12 | { |
| 13 | const char * type; |
| 14 | |
| 15 | switch(pexcept->type) |
| 16 | { |
| 17 | case _DOMAIN: |
| 18 | 	type = "Argument domain error (DOMAIN)"; |
| 19 | 	break; |
| 20 | |
| 21 | case _SING: |
| 22 | 	type = "Argument singularity (SIGN)"; |
| 23 | 	break; |
| 24 | |
| 25 | case _OVERFLOW: |
| 26 | 	type = "Overflow range error (OVERFLOW)"; |
| 27 | 	break; |
| 28 | |
| 29 | case _PLOSS: |
| 30 | 	type = "Partial loss of significance (PLOSS)"; |
| 31 | 	break; |
| 32 | |
| 33 | case _TLOSS: |
| 34 | 	type = "Total loss of significance (TLOSS)"; |
| 35 | 	break; |
| 36 | |
| 37 | case _UNDERFLOW: |
| 38 | 	type = "The result is too small to be represented (UNDERFLOW)"; |
| 39 | 	break; |
| 40 | |
| 41 | default: |
| 42 | 	type = "Unknown error"; |
| 43 | 	break; |
| 44 | } |
| 45 | |
| 46 | fprintf (stderr, "_matherr(): %s in %s(%g, %g) (retval=%g)\n", |
| 47 | 	 type, pexcept->name, pexcept->arg1, pexcept->arg2, pexcept->retval); |
| 48 | return 0; |
| 49 | } |
| 50 | |