diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-09 14:19:16 +1200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-09 14:19:16 +1200 |
commit | 0f9d1757a4590f554bcfc87f79c7a72baa5ad95d (patch) | |
tree | a7bab69bebb9d08a23bc29ee9ead6adcb42afd88 /save-xml.c | |
parent | 4c6f142e85969708983e2ffd7d413e01ac84b176 (diff) | |
download | subsurface-0f9d1757a4590f554bcfc87f79c7a72baa5ad95d.tar.gz |
Don't drop precision from floating point GP coordinates
Using '%f' limits the precision to 6 decimals, which may well be
perfectly ok. But at least in theory you *could* have higher precision,
and gps units will report it, so don't mindlessly limit us to what %f
shows.
This arbitrarily uses '%.12g' instead. %g will drop excess zeroes at
the end, so it actually results in the same (or shorter) ascii
representation unless you have the extra precision.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r-- | save-xml.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/save-xml.c b/save-xml.c index d6774b5c7..4183b1c51 100644 --- a/save-xml.c +++ b/save-xml.c @@ -162,7 +162,7 @@ static void show_location(FILE *f, struct dive *dive) */ if (latitude || longitude) { int len = snprintf(buffer, sizeof(buffer)-4, - " <location gps='%f %f'>", + " <location gps='%.12g %.12g'>", latitude, longitude); if (!dive->location) { memcpy(&buffer[len-1], "/>\n", 4); |