bitstring
A string giving the literal bit representation of a number
Syntax
str = bitstring(x)
Arguments
- x
a matrix of integers, real doubles or booleans
- str
a matrix of strings
Description
bitstring returns a string giving the literal bit representation of a number.
Examples
// IEEE_754 Floating point number str = bitstring(%pi) mprintf("sign bit = %s\n",part(str,1)) mprintf("exponent = %s\n",part(str,2:12)) mprintf("mantissa = %s\n",part(str,13:$)) // see periodic pattern in mantissa bitstring([1/3; 1/5; 1/7]) // see last bit of mantissa bitstring([1; 1+%eps]) // special IEEE_754 values bitstring([0 -0]) bitstring([%inf; -%inf; %nan; -%nan]) // integer types bitstring([%t %f]) bitstring(int8(-1)) bitstring(uint16(65535)) bitstring(int32(-65535)) bitstring(uint64(-1))
See also
References
Implementation of IEEE Standard for Floating-Point Arithmetic can be found at https://en.wikipedia.org/wiki/IEEE_754History
Version | Description |
6.1 | Function bitstring added |
Report an issue | ||
<< bitset | Bitwise operations | bitxor >> |