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)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay