Cody

Solution 1992684

Submitted on 27 Oct 2019 by Nikolaos Nikolaou
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
x = 10; y_correct = [0.625 4]; assert(isequal(extract(x),y_correct))

l = 10 n = 1 x = 10 b = 4 a = 0.6250 y = 0.6250 4.0000

2   Pass
x = 3.1416; y_correct = [0.7854 2]; assert( abs(sum(extract(x) - y_correct)) < 0.0001)

l = 3.1416 n = 1 x = 3.1416 b = 2 a = 0.7854 y = 0.7854 2.0000

3   Pass
x = -3; y_correct = [-0.7500 2]; assert( abs(sum(extract(x) - y_correct)) < 0.0001)

l = -3 n = -1 x = 3 b = 2 a = 0.7500 y = -0.7500 2.0000

4   Pass
x = realmax('single'); y_correct = [1 128]; assert( abs(sum(extract(x) - y_correct)) < 0.0001)

l = single 3.4028e+38 n = 1 x = single 3.4028e+38 b = 128 a = single 1.0000 y = 1×2 single row vector 1.0000 128.0000

5   Pass
x = 0; y_correct = [0 0]; assert(isequal(extract(x),y_correct))

l = 0 n = 1 x = 0 b = 0 a = 0 y = 0 0