Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - 日本語


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

バージョン記述
6.1 Function bitstring added
Report an issue
<< bitset Bitwise operations bitxor >>

Copyright (c) 2022-2024 (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 Jun 17 17:54:17 CEST 2024