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 6, 2020
1 parent 77638f9 commit 105c39e
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 105c39e

Please sign in to comment.