master
1#include <stdio.h>
2#include <float.h>
3#include <errno.h>
4#include <math.h>
5
6extern long double __cdecl
7__mingw_wcstold (const wchar_t * __restrict__ _Str, wchar_t ** __restrict__ _EndPtr);
8
9double __cdecl
10__mingw_wcstod (const wchar_t * __restrict__ _Str, wchar_t ** __restrict__ _EndPtr);
11
12double __cdecl
13__mingw_wcstod (const wchar_t * __restrict__ _Str, wchar_t ** __restrict__ _EndPtr)
14{
15 long double ret = __mingw_wcstold (_Str, _EndPtr);
16 if (isfinite(ret)) {
17 /* Check for cases that aren't out of range for long doubles, but that are
18 * for doubles. */
19 if (ret > DBL_MAX)
20 errno = ERANGE;
21 else if (ret < -DBL_MAX)
22 errno = ERANGE;
23 else if (ret > 0 && ret < DBL_MIN)
24 errno = ERANGE;
25 else if (ret < 0 && ret > -DBL_MIN)
26 errno = ERANGE;
27 }
28 return ret;
29}
30
31