Cody

# Problem 511. Converting Decimal to Binary

Solution 63942

Submitted on 21 Mar 2012 by @bmtran (Bryant Tran)
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% d = 1; b = '1'; assert(isequal(dec2bin_fractions(d),b))

{Warning: Warning: FOR loop index is too large. Truncating to 2147483647.} {> In dec2bin_fractions at 2 In verifyCode>evaluateCode at 189 In verifyCode at 37 In fevalJSON at 14}

2   Pass
%% d = 2.5; b = '10.1'; assert(isequal(dec2bin_fractions(d),b))

{Warning: Warning: FOR loop index is too large. Truncating to 2147483647.} {> In dec2bin_fractions at 2 In verifyCode>evaluateCode at 189 In verifyCode at 37 In fevalJSON at 14}

3   Pass
%% d = 34.125; b = '100010.001'; assert(isequal(dec2bin_fractions(d),b))

{Warning: Warning: FOR loop index is too large. Truncating to 2147483647.} {> In dec2bin_fractions at 2 In verifyCode>evaluateCode at 189 In verifyCode at 37 In fevalJSON at 14}

4   Pass
%% d = 452.8125; b = '111000100.1101'; assert(isequal(dec2bin_fractions(d),b))

{Warning: Warning: FOR loop index is too large. Truncating to 2147483647.} {> In dec2bin_fractions at 2 In verifyCode>evaluateCode at 189 In verifyCode at 37 In fevalJSON at 14}