Main Content

getlsb

Least significant bit

Description

example

c = getlsb(a) returns the value of the least significant bit in a.

Examples

collapse all

Use getlsb to find the least-significnat bit in the fi object a.

a = fi(-26, 1, 6, 0);
c = getlsb(a)
c = 
     0

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Unsigned
            WordLength: 1
        FractionLength: 0

You can verify that the least sigificant bit in the fi object a is 0 by looking at the binary representation of a.

disp(bin(a))
100110

Input Arguments

collapse all

Input fi object, specified as a scalar, vector, matrix, or multidimensional array. getlsb only supports fi object with fixed-point data types.

Data Types: fi

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced in R2007b