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