Univeristy of Alabama in Huntsville

UAH LTG IDL Library

IDL Routines from Phillip Bitzer and UAH Lightning Group

summary     class     fields     routine details     file attributes

misc/

pmb_binary.pro

Misc


This function accepts a numeric type (or array of numeric types) and returns a byte array that contain the binary representation of the number (i.e., the bits).

The name of file does NOT suggest the original author. It is included in the PMB library simply for convenience. The code was retrieved on 20140910 from the Coyote website.

Examples

To get the binary representation of 129.25:

print, PMB_BINARY(129.25)
Print the result in groups of 4 bits:
print, PMB_BINARY(129.25), FORMAT="(7(4I1), ' ', 4I1)"

Author information

Author

Ken Ivory Contact: Phillip M. Bitzer, University of Alabama in Huntsville, pm.bitzer "AT" uah.edu

History

Modification History:

19 Dec 1997 Originally a news posting by David Fanning. (Re: bits from bytes) 20 Dec 1997 "Complete" rewrite: eliminate loops. 22 Dec 1997 Bit shift instead of exponentiation, return byte array, handle input arrays. Think about double and complex types. 22 Sep 1998 Complete rewrite: reduce every numerical type to single bytes. Check that big and little endian machines return exactly the same results (if IEEE). 7 May 2003 Added newish data types, unsigned and long64. BT Added error catcher and added routine to the PMB library 20140910 PMB

Routines

top pmb_binary

result = pmb_binary(number)

This function will find the binary representation (i.e., the bits) of the argument.

Return value

An array of bytes that contain the binary representation of the number. On error, NaN is returned.

Parameters

number in required type=numeric type

The number you want the binary represntation of. Can be an array.

Other attributes

Uses:

None

File attributes

Modification date: Tue Mar 10 17:35:42 2015
Lines: 26
Docformat: rst rst