forked from len0rd/rockbox
puzzles: fix floating-point formatting
This is pretty ad-hoc, but the only other ways are to rewrite sprintf (which would use too much memory on the c200v2), or implement support for floats in rockbox's formatter, neither of which are acceptable. Change-Id: I70d59fd3e90a16e2db9ae0a84cd8c14807f50b46
This commit is contained in:
parent
bf25f3e6e7
commit
c78ff7f615
6 changed files with 23 additions and 7 deletions
|
|
@ -23,6 +23,12 @@ int puts_wrapper(const char *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ftoa(char *buf, int len, float f)
|
||||
{
|
||||
/* biggest hack ever */
|
||||
return rb->snprintf(buf, len, "%d.%06d", (int)f, (int)((f - (int)f)*1e6));
|
||||
}
|
||||
|
||||
/* fixed-point wrappers */
|
||||
static long lastphase = 0, lastsin = 0, lastcos = 0x7fffffff;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue