Support proper %g, %f, and %a float formatting

See #61
See #104
This commit is contained in:
Justine Tunney
2021-03-05 10:31:16 -08:00
parent e26bdbec52
commit f064183646
48 changed files with 1034 additions and 921 deletions

View File

@@ -19,13 +19,12 @@
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
STATIC_YOINK("ntoa");
compatfn char *itoa(int value, char *str, int radix) {
(sprintf)(
str,
VEIL("r",
radix == 16 ? "%x" : radix == 8 ? "%d" : radix == 2 ? "%b" : "%d"),
value);
(sprintf)(str,
VEIL("r", radix == 16 ? "%x"
: radix == 8 ? "%d"
: radix == 2 ? "%b"
: "%d"),
value);
return str;
}