Converting Decimal to Binary - MATLAB Cody - MATLAB Central

Problem 511. Converting Decimal to Binary

Difficulty:Rate

Given a decimal number that may include a fractional component, convert it into binary representation. The numbers you are given will always be cleanly representable using positive and negative powers of 2.

As with dec2bin, return your result in a string.

Examples:

 Input  d = 2.5
 Output b is '10.1'
 Input  d = 34.125
 Output b is '100010.001'

Solution Stats

35.12% Correct | 64.88% Incorrect
Last Solution submitted on Mar 05, 2025

Problem Comments

Solution Comments

Show comments
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
3

Group

Card Games Image
Card Games
  • 18 Problems
  • 25 Finishers

Problem Recent Solvers72

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page