how to convert bytes to some...

Discussion in 'C Programming' started by asazykin@gmail.com, Sep 20, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. In article <>,
    <> wrote:
    >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/EMNET2004/slides/WalkingGPS-EmNetS 2004 Presentation.pdf

    --
    All is vanity. -- Ecclesiastes
    Walter Roberson, Sep 20, 2006
    #2
    1. Advertising

  3. Guest

    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, 2006
    #3
  4. In article <>,
    <> wrote:
    >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
    Walter Roberson, Sep 20, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Collins
    Replies:
    3
    Views:
    6,011
    Jason Collins
    Feb 18, 2004
  2. mrby

    4-bytes or 8-bytes alignment?

    mrby, Nov 2, 2004, in forum: C Programming
    Replies:
    8
    Views:
    417
    Mark McIntyre
    Nov 2, 2004
  3. Replies:
    5
    Views:
    535
    Flash Gordon
    Apr 9, 2006
  4. Yandos
    Replies:
    12
    Views:
    5,114
    Pete Becker
    Sep 15, 2005
  5. Replies:
    8
    Views:
    500
    Bob Hairgrove
    Apr 10, 2006
Loading...

Share This Page