MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply TodayGiven 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'

50 correct solutions
64 incorrect solutions

Last solution submitted on Apr 06, 2016

2 Comments