gpst: gpst_entry() truncates numbers instead of rounding
The reason for this is to not mess up grepping through the GPS logs
after some text strings that don't exist because the rounding has
changed it to something else. As previously mentioned on the
"rounding-error" branch:
commit
52c69de2fba0aee6dfea9710aa6b5984f8c1336f
Author: Øyvind A. Holm <sunny@sunbase.org>
Date: 2010-05-17 02:52:18 +0200
run-tests.pl: "Round six decimals correctly in pgwupd format": New test.
This test fails, but it shouldn’t. I assume it’s some floating point
rounding error. What happens, is:
Rounding the number 6.
4778305 to six decimals should result in 6.477831,
but ends up as 6.47783 . A possible explanation of this is at
<http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.misc/2008-09/msg00773.html>.
It’s pretty annoying, but that’s how printf() and sprintf() work, they
sometimes just truncate the number instead of rounding it properly. Have
a look at this:
$ perl -e 'printf("%.3f\n", 0.5555);' # Should return 0.556
0.555
$ perl -e 'printf("%.3f\n", 0.55551);'
0.556
$ perl -e 'printf("%.2f\n", 0.555);' # Strangely enough, this works
0.56
/me hates.
483fcbe8-614f-11df-94ed-
90e6ba3022ac
the floating pound rounding is not exactly up to par neither, so just
truncating it is probably fine.
143e248e-dc2b-11e2-9b34-
001f3b596ec9
6e5d5a4e-dc2f-11e2-bbe0-
001f3b596ec9