From d24178aa3471faeeb023f321061c79c1813d97d0 Mon Sep 17 00:00:00 2001 From: David Harris Date: Fri, 4 Mar 2022 05:16:20 +0000 Subject: [PATCH] Prettied up softfloat_demo --- examples/fp/softfloat_demo/softfloat_demo.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/examples/fp/softfloat_demo/softfloat_demo.c b/examples/fp/softfloat_demo/softfloat_demo.c index 111847a4f..918682ba2 100644 --- a/examples/fp/softfloat_demo/softfloat_demo.c +++ b/examples/fp/softfloat_demo/softfloat_demo.c @@ -16,13 +16,8 @@ void printF32 (char *msg, float32_t f) { sp conv; int i, j; conv.v = f.v; // use union to convert between hexadecimal and floating-point views - // Print out nicely - printf("%s: ", msg); - printf("0x%04x", (conv.v >> 16)); - printf("_"); - printf("%04x", (conv.v & 0xFFFF)); - printf(" = %g\n", conv.f); - //printf ("%s: 0x%08x = %g\n", msg, conv.v, conv.f); + printf("%s: ", msg); // print out nicely + printf("0x%04x_%04x = %g\n", (conv.v >> 16),(conv.v & 0xFFFF), conv.f); } void printFlags(void) { @@ -31,7 +26,7 @@ void printFlags(void) { int OF = (softfloat_exceptionFlags >> 2) % 2; int DZ = (softfloat_exceptionFlags >> 3) % 2; int NV = (softfloat_exceptionFlags >> 4) % 2; - printf ("exceptions: Inexact %d Underflow %d Overflow %d DivideZero %d Invalid %d\n", + printf ("Flags: Inexact %d Underflow %d Overflow %d DivideZero %d Invalid %d\n", NX, UF, OF, DZ, NV); }