os: add support for %f to pnprintf

This is the lazy man's %f support. Print the decimal part of the number,
then append a decimal point, then print the first two digits of the
fractional part. So %f in sigsafe printing is really %.2f.

No boundary checks in place here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Peter Hutterer
2013-01-10 13:20:12 +10:00
parent 20def57632
commit cde7cbe967
4 changed files with 98 additions and 0 deletions

View File

@@ -250,6 +250,7 @@ extern char **xstrtokenize(const char *str, const char *separators);
extern void FormatInt64(int64_t num, char *string);
extern void FormatUInt64(uint64_t num, char *string);
extern void FormatUInt64Hex(uint64_t num, char *string);
extern void FormatDouble(double dbl, char *string);
/**
* Compare the two version numbers comprising of major.minor.