Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for minimal-printf when printing sign of double between 0.0 and -1.0 #13872

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions platform/source/minimal-printf/mbed_printf_implementation.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ static void mbed_minimal_formatted_string_double(char *buffer, size_t length, in
/* get integer part */
MBED_SIGNED_STORAGE integer = value;

/* write sign if integer part is zero and value is negative */
if ((value < 0.0) && (integer == 0)) {
/* write sign */
mbed_minimal_putchar(buffer, length, result, '-', stream);
}

/* write integer part */
mbed_minimal_formatted_string_signed(buffer, length, result, integer, stream);

Expand Down