SPUG: The bit pattern of a number (was sum-of-squares)

Mathew D. Watson matw at eclipse-optics.com
Sun Oct 5 11:03:56 CDT 2003


I would like to determine the bit pattern of a Perl floating point number.
In C I would do something like:
1. start by assigning the address of a double to a pointer-to-char;
2. then I'd look at the char value (i.e. determine its bit pattern);
3. increment the char pointer;
4. repeat steps 2 & 3 until I've reached the end of the double.

How do I do this in Perl? Maybe this is really simple, but I'm stumped.

--Mat

Mathew D. Watson, Ph.D.
Eclipse Optics Corporation
10439 NE 28th Pl.
Bellevue, WA 98004
425 827 0427 phn, 801 751 2369 fax
matw at eclipse-optics.com





More information about the spug-list mailing list