mirror of
https://github.com/opnsense/src.git
synced 2026-04-27 17:17:19 -04:00
Print a '-' sign for negative zero. Tested with
#include <stdio.h>
int main(void)
{
printf("%+f\n", -0.0);
printf("%+f\n", +0.0);
printf("%+f\n", 0.0);
return 0;
}
to output
-0.000000
+0.000000
+0.000000
PR: bin/41823
Submitted by: GOTO Kentaro <gotoken@notwork.org>
Liked by: bde
MFC after: 3 weeks
This commit is contained in:
parent
3c94f41f51
commit
3dd657600a
1 changed files with 2 additions and 7 deletions
|
|
@ -1409,13 +1409,8 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt,
|
|||
ndigits++;
|
||||
mode = 2; /* ndigits significant digits */
|
||||
}
|
||||
if (value < 0) {
|
||||
value = -value;
|
||||
*sign = '-';
|
||||
} else
|
||||
*sign = '\000';
|
||||
digits = __dtoa(value, mode, ndigits, decpt, &dsgn, &rve,
|
||||
dtoaresultp);
|
||||
digits = __dtoa(value, mode, ndigits, decpt, &dsgn, &rve, dtoaresultp);
|
||||
*sign = dsgn != 0;
|
||||
if ((ch != 'g' && ch != 'G') || flags & ALT) {
|
||||
/* print trailing zeros */
|
||||
bp = digits + ndigits;
|
||||
|
|
|
|||
Loading…
Reference in a new issue