Front page | perl.beginners |
Postings from September 2009
Re: decimal to binary?
Thread Previous
|
Thread Next
From:
John W. Krahn
Date:
September 23, 2009 12:17
Subject:
Re: decimal to binary?
Message ID:
4ABA7442.8010508@shaw.ca
Bryan R Harris wrote:
>
> I need to convert a number like this: -3205.0569059
> ... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a bc 93
> d3 (I just made up those 8 byte values).
>
> Is this easy in perl? Are long and short ints easy as well?
$ perl -le'print unpack "H*", pack "d", -3205.0569059'
e626c5221d0aa9c0
John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway
Thread Previous
|
Thread Next