Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Wenlong
Posts:
51
Registered:
3/2/12


How to get binary representation of a decimal number
Posted:
Nov 30, 2012 5:43 PM


Hi, all
I am looking for a method that can convert a decimal number to binary vector. I know there are many answers that I can google it, but seems there's nothing fits my problem.
I need to convert a decimal number (can be both positive or negative, and has a long string after decimal point) into binary. And at some point, I have to convert the binary strings back to decimal numbers.
I've found a function ?dec2bin?, but seems it just convert the integer part, for instance, the result of dec2bin(1.87) is 1.
May I know if there's any functions that can help me?
Thank you very much.
Best regards Wenlong



