From c84a96dabc4bea70c2d85af853b9c8f72ac06484 Mon Sep 17 00:00:00 2001 From: Guilhem Bonnefille Date: Mon, 25 Aug 2008 20:47:23 +0000 Subject: [PATCH] QA: use standard function instead of viking specific --- src/coords.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/coords.c b/src/coords.c index 03f8fdf3..c7ce8d61 100644 --- a/src/coords.c +++ b/src/coords.c @@ -54,19 +54,9 @@ renaming functions and defining LatLon and UTM structs. */ char *a_coords_dtostr ( double d ) { - /* In order to ignore locale, we do all the stuff manually */ - double integer, decimal; - integer = trunc(d); - - /* 6 decimals are sufficient (~0,1m) */ - /* Cf. http://www.tbs-sct.gc.ca/rpm-gbi/guides/Latlong_f.asp */ - decimal = d - integer; - decimal = decimal * 1000000; - decimal = trunc ( decimal ); - decimal = fabs ( decimal ); - - /* Format */ - return g_strdup_printf ( "%g.%06g", integer, decimal ); + gchar *buffer = g_malloc(G_ASCII_DTOSTR_BUF_SIZE*sizeof(gchar)); + g_ascii_dtostr (buffer, G_ASCII_DTOSTR_BUF_SIZE, (gdouble) d); + return buffer; } #define PIOVER180 0.01745329252 -- 2.39.5