Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> Funções Elementares > Bitwise operations > 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))

See also

  • 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

VersãoDescrição
6.1 Function bitstring added
Report an issue
<< bitset Bitwise operations bitxor >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:35:21 CET 2022