ccollins476ad commented on a change in pull request #882: libc: Add support for
float in printf
URL: https://github.com/apache/mynewt-core/pull/882#discussion_r173254548
##########
File path: libc/baselibc/src/tinyprintf.c
##########
@@ -337,6 +339,38 @@ size_t tfp_format(FILE *putp, const char *fmt, va_list va)
written += putchw(putp, &p);
p.bf = bf;
break;
+ case 'f':
+ p.base = 10;
+ d = va_arg(va, double);
+ /* Cast to an int to get the integer part of the number */
+ n = (int)d;
Review comment:
Certainly not a big deal, but the cast is unnecessary (a simple assignment
will provoke a conversion to `int`). Feel free to keep the cast if you prefer.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services