1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +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:
Andrew Gierth
2019-02-16 01:50:16 +00:00
parent 457aef0f1f
commit 72880ac182
7 changed files with 68 additions and 11 deletions

View File

@@ -52,7 +52,7 @@ strtof(const char *nptr, char **endptr)
return fresult;
}
#elif HAVE_BUGGY_WINDOWS_STRTOF
#elif HAVE_BUGGY_STRTOF
/*
* On Windows, there's a slightly different problem: VS2013 has a strtof()
* that returns the correct results for valid input, but may fail to report an
@@ -62,6 +62,14 @@ strtof(const char *nptr, char **endptr)
* well, so prefer to round the strtod() result in such cases. (Normally we'd
* just say "too bad" if strtof() doesn't support subnormals, but since we're
* already in here fixing stuff, we might as well do the best fix we can.)
*
* Cygwin has a strtof() which is literally just (float)strtod(), which means
* we can't avoid the double-rounding problem; but using this wrapper does get
* us proper over/underflow checks. (Also, if they fix their strtof(), the
* wrapper doesn't break anything.)
*
* Test results on Mingw suggest that it has the same problem, though looking
* at the code I can't figure out why.
*/
float
pg_strtof(const char *nptr, char **endptr)