Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Scilab-Branch-6.1-GIT
Change language to: English - Português - 日本語 - Русский
Aide de Scilab >> Fonctions Elémentaires > Opérations binaires > bitstring

# 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))```

• bitget — Extracts from integers bits of given indices
• bitset — Sets bits of given indices in some integers

### References

Implementation of IEEE Standard for Floating-Point Arithmetic can be found at https://en.wikipedia.org/wiki/IEEE_754

### History

 Version Description 6.1 Function bitstring added