Commit 6b74d7d8 authored by Michael Beck's avatar Michael Beck
Browse files

integer floating point values will be printed witha .0 appended

[r1437]
parent 0b08729e
......@@ -170,11 +170,24 @@ int fc_comp(const void *a, const void *b)
char *fc_print_dec(const void *a, char *buf, int buflen)
{
int n;
#ifdef USE_LONG_DOUBLE
snprintf(buf, buflen, "%1.30Lg", CAST_IN(a));
n = snprintf(buf, buflen, "%1.30Lg", CAST_IN(a));
#else
snprintf(buf, buflen, "%1.30g", CAST_IN(a));
n = snprintf(buf, buflen, "%1.30g", CAST_IN(a));
#endif
if (n > -1 && n < buflen) {
/*
* for some backends we always want to present 0 as 0.0
* as I could not find the best format to express this, add
* a .0 explicitely if not found
*/
if (NULL == strrchr(buf, '.'))
strncat(buf, ".0", buflen);
}
return buf;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment