summaryrefslogtreecommitdiff
path: root/lib/printf/printfcommon.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-05-12 21:14:12 +0200
committerDavid Lamparter <equinox@diac24.net>2019-06-03 16:44:18 +0200
commit7fa480984edc26617bc3c6bc4d9bc62d3b299a67 (patch)
tree7b367650733b7b7eae44cd8f1d46b5adc4ce7be8 /lib/printf/printfcommon.h
parent86bfbddf6ed922a755c29f23ffcef00240563a20 (diff)
lib/printf: use system printf for floats
We're not libc, we can just fall back to snprintf() to avoid all this low-level float mangling. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/printf/printfcommon.h')
-rw-r--r--lib/printf/printfcommon.h54
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/printf/printfcommon.h b/lib/printf/printfcommon.h
index 68454bce1e..716177c57d 100644
--- a/lib/printf/printfcommon.h
+++ b/lib/printf/printfcommon.h
@@ -45,20 +45,6 @@
*/
-#ifndef NO_FLOATING_POINT
-
-#define dtoa __dtoa
-#define freedtoa __freedtoa
-
-#include <float.h>
-#include <math.h>
-
-#define DEFPREC 6
-
-static int exponent(CHAR *, int, CHAR);
-
-#endif /* !NO_FLOATING_POINT */
-
static CHAR *__ujtoa(uintmax_t, CHAR *, int, int, const char *);
static CHAR *__ultoa(u_long, CHAR *, int, int, const char *);
@@ -254,43 +240,3 @@ __ujtoa(uintmax_t val, CHAR *endp, int base, int octzero, const char *xdigs)
}
return (cp);
}
-
-#ifndef NO_FLOATING_POINT
-
-static int
-exponent(CHAR *p0, int exp, CHAR fmtch)
-{
- CHAR *p, *t;
- CHAR expbuf[MAXEXPDIG];
-
- p = p0;
- *p++ = fmtch;
- if (exp < 0) {
- exp = -exp;
- *p++ = '-';
- }
- else
- *p++ = '+';
- t = expbuf + MAXEXPDIG;
- if (exp > 9) {
- do {
- *--t = to_char(exp % 10);
- } while ((exp /= 10) > 9);
- *--t = to_char(exp);
- for (; t < expbuf + MAXEXPDIG; *p++ = *t++);
- }
- else {
- /*
- * Exponents for decimal floating point conversions
- * (%[eEgG]) must be at least two characters long,
- * whereas exponents for hexadecimal conversions can
- * be only one character long.
- */
- if (fmtch == 'e' || fmtch == 'E')
- *p++ = '0';
- *p++ = to_char(exp);
- }
- return (p - p0);
-}
-
-#endif /* !NO_FLOATING_POINT */