- b = 110001001111 is not a binary number, it's a decimal number whose binary representation would be '1100110011100100100100001001010010111'.
- str2double converts a string representation of a decimal number into its decimal value.
- a double can store exactly all integers up to 2^53 (see flintmax). So your b is stored exactly. The way matlab displays numbers is independent of their storage. You can change your display settings with format. Regardless, you can still get your lsb with:
- if all you want to get is the lsb of a number, then just ask matlab with bitget. It'll be a lot faster than the conversion to string with dec2bin + conversion to number + mod.