72,7 → 72,7 |
if ((intval2<0.0)) exponent--; |
num = num / ((fmath_dpow(10.0,exponent))); |
|
print_double(num,modifier+1,precision); //modifier+1 = E => F or e => f |
print_double(num,modifier+1,precision); /* modifier+1 = E => F or e => f */ |
putchar(modifier); |
if (exponent<0) { |
putchar('-'); |
82,10 → 82,13 |
return; |
} |
|
//TODO: rounding constant - when we got fraction >= 0.5, we must increment last printed number |
/* TODO: rounding constant - when we got fraction >= 0.5, we must increment last printed number */ |
|
/* Here is problem with cumulative error while printing big double values -> we will divide |
the number with a power of 10, print new number with better method for small numbers and then print decimal point at correct position */ |
/* |
* Here is a problem with cumulative error while printing big double values -> we will divide |
* the number with a power of 10, print new number with better method for small numbers and |
* then print decimal point at correct position. |
*/ |
|
fmath_fint(fmath_get_decimal_exponent(num),&intval); |
|
135,7 → 138,7 |
counter = (counter>=DEFAULT_DOUBLE_BUFFER_SIZE?DEFAULT_DOUBLE_BUFFER_SIZE:counter); |
while (counter>0) { |
putchar(buf[--counter]); |
}; |
} |
return; |
} |
|
236,6 → 239,16 |
* and printed in standard hexadecimal format (only significant |
* digits). |
* X As with 'x', but '0x' is prefixed. |
* . The decimal number following period will be treated as precision |
* for printing floating point numbers. One of 'e', 'E', 'f' or 'F' |
* must follow. |
* e The next variant argument is treated as double precision float |
* and printed in exponent notation with only one digit before decimal point |
* in specified precision. The exponent sign is printed as 'e'. |
* E As with 'e', but the exponent sign is printed as 'E'. |
* f The next variant argument is treated as double precision float |
* and printed in decimal notation in specified precision. |
* F As with 'f'. |
* |
* All other characters from fmt except the formatting directives |
* are printed in verbatim. |
259,11 → 272,8 |
while (c = fmt[i++]) { |
switch (c) { |
|
|
|
/* control character */ |
case '%': |
|
precision = DEFAULT_DOUBLE_PRECISION; |
if (fmt[i]=='.') { |
precision=0; |
272,7 → 282,6 |
precision = precision*10 + c - '0'; |
c=fmt[++i]; |
} |
|
} |
|
switch (c = fmt[i++]) { |
328,7 → 337,6 |
/* |
* Floating point conversions. |
*/ |
|
case 'F': |
print_double(va_arg(ap, double),'F',precision); |
goto loop; |