Skip to content

Commit

Permalink
Fix for minimal-printf when printing sign of double between 0.0 and -1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
helpfulchicken committed Nov 5, 2020
1 parent 77638f9 commit 86fc194
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 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,13 @@ 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

0 comments on commit 86fc194

Please sign in to comment.