summaryrefslogtreecommitdiff
path: root/missing/vsnprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'missing/vsnprintf.c')
-rw-r--r--missing/vsnprintf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/missing/vsnprintf.c b/missing/vsnprintf.c
index b21261d7df1..266290a139e 100644
--- a/missing/vsnprintf.c
+++ b/missing/vsnprintf.c
@@ -1018,8 +1018,11 @@ cvt(value, ndigits, flags, sign, decpt, ch, length)
if (value < 0) {
value = -value;
*sign = '-';
- } else
- *sign = '\000';
+ } else if (value == 0.0 && 1.0/value < 0) {
+ *sign = '-';
+ } else {
+ *sign = '\000';
+ }
digits = BSD__dtoa(value, mode, ndigits, decpt, &dsgn, &rve);
if (flags & ALT) { /* Print trailing zeros */
bp = digits + ndigits;