From 8297daff896ca9d803959edb3c1955977594fab9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 31 Oct 2007 02:41:33 -0400 Subject: [PATCH] [cairo-output-stream] Write out floats to 18 digits after decimal point We write floats using %f as the scientific format used by smarter %g is invalid in PS/PDF. %f however by default rounds to five digits after decimal point. This was causing precision loss and making the newly added degenerate-pen test fail for PDF. We now print up to 18 digits which is as many bits doubles can accomodate. We can be smarter, but that's for another commit. --- src/cairo-output-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c index 5bce0e343..6d9c733c9 100644 --- a/src/cairo-output-stream.c +++ b/src/cairo-output-stream.c @@ -236,7 +236,7 @@ _cairo_dtostr (char *buffer, size_t size, double d) if (d == 0.0) d = 0.0; - snprintf (buffer, size, "%f", d); + snprintf (buffer, size, "%.18f", d); locale_data = localeconv (); decimal_point = locale_data->decimal_point;