git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7423 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2014-10-26 10:28:11 +00:00
parent 6f20fa7916
commit 26cd37a0b1
1 changed files with 4 additions and 5 deletions

View File

@ -32,7 +32,7 @@
#include "memstreams.h"
#define MAX_FILLER 11
#define FLOAT_PRECISION 5
#define FLOAT_PRECISION 9
static char *long_to_string_with_divisor(char *p,
long num,
@ -73,14 +73,13 @@ static char *ltoa(char *p, long num, unsigned radix) {
}
#if CHPRINTF_USE_FLOAT
static long pow10[] = {10, 100, 1000, 10000, 100000, 1000000, 10000000,
100000000, 1000000000, 10000000000, 100000000000,
1000000000000, 10000000000000};
static long pow10[FLOAT_PRECISION] = {10, 100, 1000, 10000, 100000, 1000000,
10000000, 100000000, 1000000000};
static char *ftoa(char *p, double num, unsigned long precision) {
long l;
if (precision == 0)
if ((precision == 0) || (precision > FLOAT_PRECISION))
precision = FLOAT_PRECISION;
precision = pow10[precision - 1];