Cody

Solution 1572129

Submitted on 30 Jun 2018
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))

splt = 1×1 cell array {'1'} in = '1' ans = '1'

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

splt = 1×2 cell array {'2'} {'5'} dc = '101' in = '10' ans = '101.10'

Assertion failed.

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

splt = 1×2 cell array {'34'} {'125'} dc = '1111101' in = '100010' ans = '1111101.100010'

Assertion failed.

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

splt = 1×2 cell array {'452'} {'8125'} dc = '1111110111101' in = '111000100' ans = '1111110111101.111000100'

Assertion failed.