in reply to Re^2: Unpacking extended-double precision floats
in thread Unpacking extended-double precision floats

My question was about 12.5's format. You implied (in a private message) that the lost of precision is of no concern, so I'm deducing that you want an NV (double).

Have you tried unpack 'D' yet?

Replies are listed 'Best First'.
Re^4: Unpacking extended-double precision floats
by Anonymous Monk on Nov 29, 2006 at 20:31 UTC
    If loss of precision is of no concern, and the number of bits of exponent and sign is the same between d and D formats, you may be able to use unpack d plus two skip bytes, and pack it as a double d followed by two appropriate fill bytes (00 or 88 ?). Bill N1VUX
      Howdy!

      If I recall correctly (and I'll be checking the references before I do anything), "double precision" and "extended double precision" have different numbers of bits in the exponent. It's not quite that simple to smush the precision down. I think I go from 64 bits of mantissa to 53 bits of mantissa (but don't hold me to precise numbers here).

      In the end, I should be able to pick the three components apart and Just Do The Math.

      yours,
      Michael
        According to the wikipedia article on double precision floats it has 1 sign bit 11 exponent bits and 52 mantissa bits

        --
        "WHAT CAN THE HARVEST HOPE FOR IF NOT THE CARE OF THE REAPER MAN"
        -- Terry Pratchett, "Reaper Man"

Re^4: Unpacking extended-double precision floats
by herveus (Prior) on Nov 29, 2006 at 18:48 UTC
    Howdy!

    Yep. I tried that. The Perl on my mac (where I'm actually doing this) told me to pound sand. I'll try Convert::Binary::C when I get home.

    ...so, yes, I want an NV on the Perl side of things.

    yours,
    Michael