develooper Front page | perl.beginners | Postings from September 2009

Re: decimal to binary?

Thread Previous | Thread Next
From:
Bryan R Harris
Date:
September 23, 2009 12:16
Subject:
Re: decimal to binary?
Message ID:
C6DFDE08.367CA%Bryan_R_Harris@raytheon.com


>> 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?
> 
> The sprintf() family is your friend.


I see %x (unsigned integer, in hexadecimal) and %f (floating-point number,
in fixed decimal notation), but nothing about doubles, endianness, etc.

I checked both my perl bookshelf and perldoc on this so far with no luck...

- Bryan



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About