fix sign of fractional part in printFloat

This commit is contained in:
jvangrin 2011-07-04 13:07:32 -05:00
parent 2be3a6cc61
commit d4f3fdd4bb

View File

@ -24,6 +24,7 @@
//#include "wiring_private.h" //#include "wiring_private.h"
#include <math.h> #include <math.h>
#include <stdlib.h>
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
@ -176,7 +177,7 @@ void printFloat(double n)
fractional_part = modf(n, &integer_part); fractional_part = modf(n, &integer_part);
printInteger(integer_part); printInteger(integer_part);
printByte('.'); printByte('.');
printInteger(round(fractional_part*1000)); printInteger(labs(round(fractional_part*1000)));
} }
// void printHex(unsigned long n) // void printHex(unsigned long n)