Cody

Solution 260398

Submitted on 12 Jun 2013 by David Gines
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 = [1 2]; y = [5 6]; c = 5; y_correct = 1; assert(abs(getTheRightPosition(x,y,c)-y_correct)<1e-10)
2   Pass
%% x = [1 -2]; y = [1 -2]; c = 50; y_correct = 50; assert(abs(getTheRightPosition(x,y,c)-y_correct)<1e-10)
3   Pass
%% x = [1 -2]; y = [1 2]; c = 50; y_correct = -146; assert(abs(getTheRightPosition(x,y,c)-y_correct)<1e-10)
4   Pass
%% x = [1 1]; y = [1 -2]; c = 50; y_correct = 1; assert(abs(getTheRightPosition(x,y,c)-y_correct)<1e-10)
5   Pass
%% x = [1 1]; y = [1 1]; c = 50; y_correct = NaN; assert(isequal(isnan(getTheRightPosition(x,y,c)),isnan(y_correct)))
6   Pass
%% x = [1 2]; y = [1 1]; c = 50; y_correct = NaN; assert(isequal(isnan(getTheRightPosition(x,y,c)),isnan(y_correct)))
7   Pass
%% x = [1 2]; y = [2 2]; c = 2; y_correct = Inf; assert(isequal(isinf(getTheRightPosition(x,y,c)),isinf(y_correct)))