Cody

Solution 186105

Submitted on 4 Jan 2013
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   Fail
%% assert(double2half(2^(-24)) == uint16(1)) % Smallest number

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

2   Fail
%% assert(double2half(2^(-25)) == uint16(1)) % Rounds up to smallest number

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

3   Fail
%% assert(double2half(2^(-26)) == uint16(0)) % Rounds down to zero

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

4   Fail
%% assert(bin2dec('0 01111 0000000000') == double2half(1))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

5   Fail
%% assert(bin2dec('0 01111 0000000001') == double2half(1 + 2^(-10)))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

6   Fail
%% assert(bin2dec('1 10000 0000000000') == double2half(-2))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

7   Fail
%% assert(bin2dec('0 11110 1111111111') == double2half(65504))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

8   Fail
%% assert(bin2dec('0 00001 0000000000') == double2half(2^(-14)))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

9   Fail
%% assert(bin2dec('0 00000 1111111111') == double2half(2^(-14) - 2^(-24)))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

10   Fail
%% assert(bin2dec('0 00000 0000000001') == double2half(2^(-24)))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

11   Fail
%% assert(bin2dec('0 00000 0000000000') == double2half(0))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

12   Fail
%% assert(bin2dec('1 00000 0000000000') == double2half(-0))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

13   Fail
%% assert(bin2dec('0 11111 0000000000') == double2half(inf))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

14   Fail
%% assert(bin2dec('1 11111 0000000000') == double2half(-inf))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".

15   Fail
%% assert(bin2dec('0 01101 0101010101') == double2half(0.33325))

Error: Output argument "H" (and maybe others) not assigned during call to "/users/msssystem17/double2half.m>double2half".