mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Cygwin and Mingw floating-point fixes.
Deal with silent-underflow errors in float4 for cygwin and mingw by using our strtof() wrapper; deal with misrounding errors by adding them to the resultmap. Some slight reorganization of declarations was done to avoid duplicating material between cygwin.h and win32_port.h. While here, remove from the resultmap all references to float8-small-is-zero; inspection of cygwin output suggests it's no longer required there, and the freebsd/netbsd/openbsd entries should no longer be necessary (these date back to c. 2000). This commit doesn't remove the file itself nor the documentation references for it; that will happen in a subsequent commit if all goes well.
This commit is contained in:
@@ -510,16 +510,23 @@ typedef unsigned short mode_t;
|
||||
#define isnan(x) _isnan(x)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || \
|
||||
defined(__MINGW32__) || defined(__MINGW64__)
|
||||
/*
|
||||
* VS2013 has a strtof() that seems to give correct answers for valid input,
|
||||
* even on the rounding edge cases, but which doesn't handle out-of-range
|
||||
* input correctly. Work around that.
|
||||
*
|
||||
* Mingw claims to have a strtof, and my reading of its source code suggests
|
||||
* that it ought to work (and not need this hack), but the regression test
|
||||
* results disagree with me; whether this is a version issue or not is not
|
||||
* clear. However, using our wrapper (and the misrounded-input variant file,
|
||||
* already required for supporting ancient systems) can't make things any
|
||||
* worse, except for a tiny performance loss when reading zeros.
|
||||
*
|
||||
* See also cygwin.h for another instance of this.
|
||||
*/
|
||||
#define HAVE_BUGGY_WINDOWS_STRTOF 1
|
||||
extern float pg_strtof(const char *nptr, char **endptr);
|
||||
#define strtof(a,b) (pg_strtof((a),(b)))
|
||||
|
||||
#define HAVE_BUGGY_STRTOF 1
|
||||
#endif
|
||||
|
||||
/* Pulled from Makefile.port in MinGW */
|
||||
|
||||
Reference in New Issue
Block a user