-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
garmin int->float->int fidelity #1134
Comments
Probably worse, that was defined in a Garmin spec in the early 90s when
ints were just always 32 bits in their world. Now with 64 bits being the
(non-embedded) norm, this is probably wrong.
I doubt that the actual bit pattern in the packecrACTUALLY ever had
anything to do with host INTMAX.
So probably a. Saved track on a Garmin II on a 64 bit machine incurs
sadness.
There was a time that our alt was an integer just because sub-meter
precision of altitude is actually still pretty rare.
Of course, our "I don't really have an altitded" value and handling doesn't
have a great story.
I suspect you're right and this never actually worked as intended. Feel
free to replace with values from Garmin specs, intmax-1 (does that work? Is
it right on 64 bit ints?) Or even just palin delete it.
Our pool of Non-gpx garmins is small and only shrinking.
…On Fri, Jun 30, 2023, 12:42 PM tsteven4 ***@***.***> wrote:
clang gives us a warning:
[33/134] Building CXX object CMakeFiles/gpsbabel.dir/garmin.cc.o
/__w/gpsbabel/gpsbabel/garmin.cc:468:25: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
(way[i]->alt == INT_MAX) ||
~~ ^~~~~~~
/usr/lib/llvm-14/lib/clang/14.0.0/include/limits.h:46:19: note: expanded from macro 'INT_MAX'
#define INT_MAX __INT_MAX__
^~~~~~~~~~~
<built-in>:102:21: note: expanded from here
#define __INT_MAX__ 2147483647
^~~~~~~~~~
1 warning generated.
The more interesting part of this doesn't generate a warning,
https://github.com/GPSBabel/gpsbabel/blob/7088c7e47ace23799c0b3477f39af4d158b68b30/jeeps/gpsmem.cc#L216
Here smbl, dspl, colour, prot are all int32, but alt is a float. The
result of this assignment is that smbl, dspl, colour are set to
-2147483648(0x80000000) while prot is set to 2147483647(0x7fffffff), and
alt is 2.14748e+09(0x4f000000). I don't know that this causes any trouble,
but I doubt that was the intent.
—
Reply to this email directly, view it on GitHub
<#1134>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCSD32S3CEJ3IAYMABF6ITXN4FZ3ANCNFSM6AAAAAAZ2EE22Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
clang gives us a warning:
The more interesting part of this doesn't generate a warning,
gpsbabel/jeeps/gpsmem.cc
Line 216 in 7088c7e
Here smbl, dspl, colour, prot are all int32, but alt is a float. The result of this assignment is that smbl, dspl, colour are set to -2147483648(0x80000000) while prot is set to 2147483647(0x7fffffff), and alt is 2.14748e+09(0x4f000000). I don't know that this causes any trouble, but I doubt that was the intent.
The text was updated successfully, but these errors were encountered: