Cody

# Problem 42850. Sum two real numbers

Solution 1695540

Submitted on 18 Dec 2018 by HH
• Size: 9
• This is the leading solution.
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; y = 2; assert(abs(operation(x,y)/(x+y)-1)<1e-11) filetext = fileread('operation.m'); assert(isempty(strfind(filetext, '*')),'sign * not allowed') assert(isempty(strfind(filetext, 'prod')),'prod not allowed') assert(isempty(strfind(filetext, 'times')),'times not allowed') assert(isempty(strfind(filetext, 'cross')),'times not allowed') assert(isempty(strfind(filetext, 'dot')),'times not allowed') assert(isempty(strfind(filetext, '+')),'sign + not allowed') assert(isempty(strfind(filetext, '-')),'sign - not allowed') assert(isempty(strfind(filetext, 'sum')),'sum not allowed') assert(isempty(strfind(filetext, 'add')),'sum not allowed') assert(isempty(strfind(filetext, 'diff')),'diff not allowed') assert(isempty(strfind(filetext, 'minus')),'minus not allowed') assert(isempty(strfind(filetext, 'plus')),'plus not allowed') assert(isempty(strfind(filetext, 'sign')),'sign not allowed') assert(isempty(strfind(filetext, 'abs')),'abs not allowed') assert(isempty(strfind(filetext, '''')),'strings are not allowed')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In operation (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)]

2   Pass
x = 2; y = pi; assert(abs(operation(x,y)/(x+y)-1)<1e-11) filetext = fileread('operation.m'); assert(isempty(strfind(filetext, '*')),'sign * not allowed') assert(isempty(strfind(filetext, 'prod')),'prod not allowed') assert(isempty(strfind(filetext, 'times')),'times not allowed') assert(isempty(strfind(filetext, 'cross')),'times not allowed') assert(isempty(strfind(filetext, 'dot')),'times not allowed') assert(isempty(strfind(filetext, '+')),'sign + not allowed') assert(isempty(strfind(filetext, '-')),'sign - not allowed') assert(isempty(strfind(filetext, 'sum')),'sum not allowed') assert(isempty(strfind(filetext, 'add')),'sum not allowed') assert(isempty(strfind(filetext, 'diff')),'diff not allowed') assert(isempty(strfind(filetext, 'minus')),'minus not allowed') assert(isempty(strfind(filetext, 'plus')),'plus not allowed') assert(isempty(strfind(filetext, 'sign')),'sign not allowed') assert(isempty(strfind(filetext, 'abs')),'abs not allowed') assert(isempty(strfind(filetext, '''')),'strings are not allowed')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In operation (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)]

3   Pass
x = -sqrt(13); y = 0.25; assert(abs(operation(x,y)/(x+y)-1)<1e-11) filetext = fileread('operation.m'); assert(isempty(strfind(filetext, '*')),'sign * not allowed') assert(isempty(strfind(filetext, 'prod')),'prod not allowed') assert(isempty(strfind(filetext, 'times')),'times not allowed') assert(isempty(strfind(filetext, 'cross')),'times not allowed') assert(isempty(strfind(filetext, 'dot')),'times not allowed') assert(isempty(strfind(filetext, '+')),'sign + not allowed') assert(isempty(strfind(filetext, '-')),'sign - not allowed') assert(isempty(strfind(filetext, 'sum')),'sum not allowed') assert(isempty(strfind(filetext, 'add')),'sum not allowed') assert(isempty(strfind(filetext, 'diff')),'diff not allowed') assert(isempty(strfind(filetext, 'minus')),'minus not allowed') assert(isempty(strfind(filetext, 'plus')),'plus not allowed') assert(isempty(strfind(filetext, 'sign')),'sign not allowed') assert(isempty(strfind(filetext, 'abs')),'abs not allowed') assert(isempty(strfind(filetext, '''')),'strings are not allowed')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In operation (line 2) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)]

4   Pass
x = 31/8/87; y = 22/8/83; assert(abs(operation(x,y)/(x+y)-1)<1e-11) filetext = fileread('operation.m'); assert(isempty(strfind(filetext, '*')),'sign * not allowed') assert(isempty(strfind(filetext, 'prod')),'prod not allowed') assert(isempty(strfind(filetext, 'times')),'times not allowed') assert(isempty(strfind(filetext, 'cross')),'times not allowed') assert(isempty(strfind(filetext, 'dot')),'times not allowed') assert(isempty(strfind(filetext, '+')),'sign + not allowed') assert(isempty(strfind(filetext, '-')),'sign - not allowed') assert(isempty(strfind(filetext, 'sum')),'sum not allowed') assert(isempty(strfind(filetext, 'add')),'sum not allowed') assert(isempty(strfind(filetext, 'diff')),'diff not allowed') assert(isempty(strfind(filetext, 'minus')),'minus not allowed') assert(isempty(strfind(filetext, 'plus')),'plus not allowed') assert(isempty(strfind(filetext, 'sign')),'sign not allowed') assert(isempty(strfind(filetext, 'abs')),'abs not allowed') assert(isempty(strfind(filetext, '''')),'strings are not allowed')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In operation (line 2) In ScoringEngineTestPoint4 (line 4) In solutionTest (line 9)]