summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2014-12-25 22:48:20 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2014-12-25 22:48:20 +0100
commitda932d59161a2d833596be5443c81ff244d2db58 (patch)
treef0be076d5698256344227fb8c63f5da29ff57939 /libc/stdio
parent88842f7126daccf205204be05d3143c73fa0624d (diff)
parent638a23483b40c5b606ee323e6612e7e454e5154b (diff)
merge upstream changes
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/_fpmaxtostr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c
index f7ea792c4..35805844a 100644
--- a/libc/stdio/_fpmaxtostr.c
+++ b/libc/stdio/_fpmaxtostr.c
@@ -45,11 +45,6 @@
*/
#define isnan(x) ((x) != (x))
-/* Without seminumerical functions to examine the sign bit, this is
- * about the best we can do to test for '-0'.
- */
-#define zeroisnegative(x) ((1./(x)) < 0)
-
/*****************************************************************************/
/* Don't change anything that follows peroid!!! ;-) */
/*****************************************************************************/
@@ -262,7 +257,13 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
if (x == 0) { /* Handle 0 now to avoid false positive. */
#ifdef __UCLIBC_HAVE_SIGNED_ZERO__
- if (zeroisnegative(x)) { /* Handle 'signed' zero. */
+ union {
+ double x;
+ struct {
+ unsigned int l1, l2;
+ } i;
+ } u = {x};
+ if (u.i.l1 ^ u.i.l2) { /* Handle 'signed' zero. */
*sign_str = '-';
}
#endif /* __UCLIBC_HAVE_SIGNED_ZERO__ */