aboutsummaryrefslogtreecommitdiffstats
path: root/src/stdlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib.c')
-rw-r--r--src/stdlib.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/stdlib.c b/src/stdlib.c
index 4714e93..a47fb03 100644
--- a/src/stdlib.c
+++ b/src/stdlib.c
@@ -85,7 +85,6 @@ char *snprintf(char *buf, unsigned int max, const char *format, ...)
float strtof(const char *s, char **endptr)
{
- (void)s;
(void)endptr;
float res = 0.0f;
@@ -139,6 +138,12 @@ char *ftostr(char *buf, float f)
if (buf == 0)
return 0;
+ if (f == 0) {
+ buf[0] = '0';
+ buf[1] = '\0';
+ return buf;
+ }
+
unsigned int i = 0; // offset
// strip decimals, convert in reverse