prf.c: handle denormals properly

Denormals need to be normalized to be displayed properly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2019-06-19 22:14:03 -04:00 committed by Anas Nashif
commit 3c0cc08657
2 changed files with 13 additions and 0 deletions

View file

@ -322,6 +322,13 @@ void test_sprintf_double(void)
zassert_true((strcmp(buffer, "0.0001505") == 0),
"sprintf(0.0001505) - incorrect "
"output '%s'\n", buffer);
var.u1 = 0x00000001;
var.u2 = 0x00000000; /* smallest denormal value */
sprintf(buffer, "%g", var.d);
zassert_true((strcmp(buffer, "4.94066e-324") == 0),
"sprintf(4.94066e-324) - incorrect "
"output '%s'\n", buffer);
}
/**