Add proper float formatting to vuprintf

Wanted to see how gnarly it is to do.

Big number handling could be done with better algorithms
since it can get a bit slow with large integers or tiny
fractions with many lead zeros when only a few digits are
needed.

Anyway, it supports %e, %E, %f, %F, %g and %G. No %a or long
double support seems warranted at the moment.

Assumes IEEE 754 double format but it's laid out to be able to
replace a function to handle others if needed.

Tested in a driver program that has a duplicate vuprintf and
the content was pasted in once it looked sound enough to put
up a patch.

Change-Id: I6dae8624d3208e644c88e36e6a17d8fc9144f988
This commit is contained in:
Michael Sevakis 2018-01-06 07:17:04 -05:00 committed by Franklin Wei
parent 3e2b50ed3b
commit b70fecf21d
4 changed files with 793 additions and 10 deletions

View file

@ -199,6 +199,9 @@ libc/gmtime.c
#endif /* CONFIG_PLATFORM || HAVE_ROCKBOX_C_LIBRARY */
/* Common */
#ifndef BOOTLOADER
common/ap_int.c
#endif
common/version.c
common/config.c
common/crc32.c