mirror of https://github.com/Icinga/icinga2.git
parent
f48a6b429b
commit
9defdd74d9
|
@ -130,7 +130,8 @@ static char *print_number(cJSON *item)
|
||||||
str=(char*)cJSON_malloc(64); /* This is a nice tradeoff. */
|
str=(char*)cJSON_malloc(64); /* This is a nice tradeoff. */
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
if (fabs(floor(d)-d)<=DBL_EPSILON) sprintf(str,"%.0f",d);
|
if (d != d) strcpy(str, "0");
|
||||||
|
else if (fabs(floor(d)-d)<=DBL_EPSILON) sprintf(str,"%.0f",d);
|
||||||
else sprintf(str,"%.*e",(int)log10(d) + 6,d);
|
else sprintf(str,"%.*e",(int)log10(d) + 6,d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue