bug fmt_double

[email protected]
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Hi,

fmt_double has problems when formating double values like "[-]0.*".
example:

#include <buffer.h>
#include <fmt.h>
#include <stdio.h>

void print_double(double d);

int main() {
   print_double(-0.610309);
   print_double(1.0);
   print_double(-0.6);
   print_double(-6.123);
   print_double(0.6);
   return 0;
}

void print_double(double d) {
   printf("%f\n", d);
   char dbuf[30];
   size_t dlen = 0;
   dlen = fmt_double(dbuf, d, 30, 10);
   buffer_put(buffer_1, dbuf, dlen);
   buffer_puts(buffer_1, "\n");
   buffer_flush(buffer_1);
}

# output:
-0.610309
-6103089999
1.000000
1.000000000
-0.600000
-5999999999
-6.123000
-6.123000000
0.600000
5999999999

for [-]0.* the decimal point is missing

gcc  4.3.2
libowfat 0.27 / cvs from 22.00 CET
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.