summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qapi/string-output-visitor.c2
-rw-r--r--tests/test-string-output-visitor.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c
index b74aa4d44c..5506c933de 100644
--- a/qapi/string-output-visitor.c
+++ b/qapi/string-output-visitor.c
@@ -258,7 +258,7 @@ static bool print_type_number(Visitor *v, const char *name, double *obj,
Error **errp)
{
StringOutputVisitor *sov = to_sov(v);
- string_output_set(sov, g_strdup_printf("%f", *obj));
+ string_output_set(sov, g_strdup_printf("%.17g", *obj));
return true;
}
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index cec20848ea..0dae04b960 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -136,7 +136,7 @@ static void test_visitor_out_number(TestOutputVisitorData *data,
visit_type_number(data->ov, NULL, &value, &error_abort);
str = visitor_get(data);
- g_assert_cmpstr(str, ==, "3.141593");
+ g_assert_cmpstr(str, ==, "3.1415926535897931");
}
static void test_visitor_out_string(TestOutputVisitorData *data,