DEV Community

HandsomeTan
HandsomeTan

Posted on

Conversion between Decimal and Binary

For integer parts, divide the integer by the k that need to be converted, then obtain the remainder, and so on. Lastly, connect thse reminder together from bottom to top.
For the fraction part, multiply this part by k, then take the integer part of result product and continue to mutiply the remainder of the result by 'k' and so on. Finally, connect these integer parts in order from top to bottom.
The basic principles related to this method are not listed here and you can search the internet for information about it if you want to know.

Top comments (0)