in reply to bizarre number encoding

Based on the fact that it takes 8 bytes to encode each number, I'm guessing that the number is being stored as a floating point data type.

But this forum is for Perl. What does this question have to do with Perl?

--t. alex

"Excellent. Release the hounds." -- Monty Burns.

Replies are listed 'Best First'.
Re: Re: bizarre number encoding
by Anonymous Monk on Dec 30, 2001 at 15:26 UTC
    it's only perl-ish because I've been using unpack to parse these files.

    You're right, it is floating point - if you disregard the 64 and the following 2 bytes and unpack the rest as a double it comes out right.

    fyi this is a classic case of legacy systems, even though the application is only about 5 years old and Windows-based

    (you should see what they run the air traffic control system on. small mercies, it way predates windows...)

    thanks
      Hmmm...it seems like there are an insufficient number of examples to analyze. Can you provide examples for the numbers 0..15?

      If you were to convert your example for the number 2 into binary and reverse the order of the last byte you would get:

      00000010 which is decimal 2.

      Some food for thought.

      I would suggest looking for the code that writes/reads the number to disk and figuring out how it implements this encoding.

      metadoktor

      "The doktor is in."