how to convert bytes to some...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • asazykin@gmail.com

    #1

    how to convert bytes to some...

    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.....

  • Walter Roberson

    #2
    Re: how to convert bytes to some...

    In article <1158738325.256 365.147000@d34g 2000cwd.googleg roups.com>,
    <asazykin@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

    Comment

    • asazykin@gmail.com

      #3
      Re: how to convert bytes to some...

      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.

      Comment

      • Walter Roberson

        #4
        Re: how to convert bytes to some...

        In article <1158782996.671 034.33340@d34g2 000cwd.googlegr oups.com>,
        <asazykin@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

        Comment

        Working...