By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

how to convert bytes to some...

P: n/a
help need.... trying to convert binary file bytes 188-189 hav latitude
values.
how can i get from hex a6d4 - decodec to 217.200000
any ideas????would appreciate.....

Sep 20 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <11**********************@d34g2000cwd.googlegroups .com>,
<as******@gmail.comwrote:
>help need.... trying to convert binary file bytes 188-189 hav latitude
values.
how can i get from hex a6d4 - decodec to 217.200000
any ideas????would appreciate.....
That's probably an algorithms question rather than a C question.
The number you gave is only 16 bits, so if it is a floating point
format then it is an unusual format, possibly a standard within
that particular industry but not widely used.

It may be a coincidence that if you take the first byte, 0xa6,
and subtract off a bias constant of 0x80 (representing the centre
lattitude, 180), then you get a result of 38, which is the round
up of (217.2 - 180).

Are you certain that those bytes alone give the lattitude?
For example if you are working with GPS, then you would use a 2 byte
offset relative to a 4 byte reference lattitude.
http://www.cse.unsw.edu.au/~emnet/EM...esentation.pdf

--
All is vanity. -- Ecclesiastes
Sep 20 '06 #2

P: n/a
thanx for the reply ...
sorry my mistake this is not a latitude this is altitude...
with lat and long i didnt have any problem they were stored in integer
format....
problem is altitude.

Sep 20 '06 #3

P: n/a
In article <11*********************@d34g2000cwd.googlegroups. com>,
<as******@gmail.comwrote:
>thanx for the reply ...
Please quote enough context so that people can follow along.
>>how can i get from hex a6d4 - decodec to 217.200000
>sorry my mistake this is not a latitude this is altitude...
with lat and long i didnt have any problem they were stored in integer
format....
problem is altitude.
We would need a few more examples, and an indication of units
might help. Are there minimums and maximums? Is the maximum
about 333? Or about 262? Any hints on the resolution? Is it
pausible that "nautical" measurements are involved in storage but
not in the display (or the other way around)?

If you take 0xa6d4, swap the bytes around to get 0xd4a6, and
subtract off 0x8000, the result is 21670 which is 99.769797
times the output value you are expecting. A conversion
of units with a value very close to 1.00 could account for the
residue.

But one sample isn't enough to go on. (And this isn't really the
right newsgroup, since the matter is not C specific.)
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
Sep 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.