From d4f3fdd4bbd99f6d307a4a86f0773597bd287ef7 Mon Sep 17 00:00:00 2001 From: jvangrin Date: Mon, 4 Jul 2011 13:07:32 -0500 Subject: [PATCH] fix sign of fractional part in printFloat --- wiring_serial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wiring_serial.c b/wiring_serial.c index 62c4be4..92da993 100644 --- a/wiring_serial.c +++ b/wiring_serial.c @@ -24,6 +24,7 @@ //#include "wiring_private.h" #include +#include #include #include @@ -176,7 +177,7 @@ void printFloat(double n) fractional_part = modf(n, &integer_part); printInteger(integer_part); printByte('.'); - printInteger(round(fractional_part*1000)); + printInteger(labs(round(fractional_part*1000))); } // void printHex(unsigned long n)