fix sign of fractional part in printFloat
This commit is contained in:
parent
2be3a6cc61
commit
d4f3fdd4bb
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user