Convert single-precision floating-point number to binary representation - MATLAB Cody - MATLAB Central

Problem 832. Convert single-precision floating-point number to binary representation

Difficulty:Rate

Write a function which takes a scalar single-precision floating-point number as input and returns its binary representation as a string of zeros and ones.

Example 1

x = single( 1.25 );

y = '00111111101000000000000000000000'

Example 2

x = realmax('single'); % = 3.4028235e+038

y = '01111111011111111111111111111111'

Solution Stats

46.23% Correct | 53.77% Incorrect
Last Solution submitted on May 28, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
1
2

Problem Recent Solvers35

Suggested Problems

Problem Tags

Community Treasure Hunt

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

Start Hunting!