aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-xml-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'e-util/e-xml-utils.c')
-rw-r--r--e-util/e-xml-utils.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c
index fa4f96c1a2..98c089074b 100644
--- a/e-util/e-xml-utils.c
+++ b/e-util/e-xml-utils.c
@@ -343,15 +343,19 @@ void
e_xml_set_double_prop_by_name(xmlNode *parent, const xmlChar *prop_name, gdouble value)
{
char buffer[E_ASCII_DTOSTR_BUF_SIZE];
+ char *format;
g_return_if_fail (parent != NULL);
g_return_if_fail (prop_name != NULL);
if (fabs (value) < 1e9 && fabs (value) > 1e-5) {
- e_ascii_dtostr (buffer, sizeof (buffer), "%.17f", value);
+ format = g_strdup_printf ("%%.%df", DBL_DIG);
} else {
- e_ascii_dtostr (buffer, sizeof (buffer), "%.17g", value);
+ format = g_strdup_printf ("%%.%dg", DBL_DIG);
}
+ e_ascii_dtostr (buffer, sizeof (buffer), format, value);
+ g_free (format);
+
xmlSetProp (parent, prop_name, buffer);
}