Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Extract double in binary file
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bengt Richter  
View profile  
 More options Nov 28 2003, 8:10 pm
Newsgroups: comp.lang.python
From: b...@oz.net (Bengt Richter)
Date: 29 Nov 2003 01:10:09 GMT
Local: Fri, Nov 28 2003 8:10 pm
Subject: Re: Extract double in binary file
On Sat, 29 Nov 2003 00:30:42 GMT, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:

>Francis Avila fed this fish to the penguins on Friday 28 November 2003
>01:45 am:

>> That is a bizarre format, and of course I had to implement it. (Even C
>> is more pleasant in Python!).

>        And I thought /I/ was the masochist...

>        I do have to confess that short tests with struct did reveal that, on
>my system, regular doubles do have the same byte order as the original
>data. I'm just more comfortable with seeing hex representations of
>numbers with the MSB on the left.

>> It works for the cases given, but do find out where the sign bit is
>> for the mantissa. (This code assumes it's the MSB of the mantissa.)

>        I suspect most would consider the format my college computer used to
>be weird... Xerox Sigma 6... Excess 64 (decimal) (as I recall) exponent
>powers of sixteen! A "normalized" mantissa could have up to three
>leading 0 bits, and there were no "hidden" bit.

>        S eeeeeee mmmmmmmmm mmmmmmmm mmmmmmmm ...

Does the OP have the ability ot generate example values at will,
or is it a matter of scrounging through some old recorded data with
no way of making more?

If he can make more, I'd suggest a number with most of the nybbles
of data individually numbered, e.g.,
    0xfedcba987654321
E.g., if it's a 64-bit format, a 64-bit integer converted would probably
tell the a lot about where the bits go (how many get shifted out, hidden,
how they're ordered). And then the same number negative. E.g.,

 >>> 0xfedcba987654321
 1147797409030816545L
 >>> -0xfedcba987654321
 -1147797409030816545L
 >>> hex(0xfedcba987654321)
 '0xFEDCBA987654321L'
 >>> hex(-0xfedcba987654321)
 '-0xFEDCBA987654321L'
 <grr>useless hex representation for looking at bits ...</grr>

 >>> hex(-0xfedcba987654321 +2**80)
 '0xFFFFF0123456789ABCDFL'

Regards,
Bengt Richter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.