Cody

# Problem 371. Decimal Comparison

Solution 2131064

Submitted on 17 Feb 2020
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(numCmp('12.3456',12.3456))

a1 = 7 a = '12.3456' b = logical 1

Error using assert The condition input argument must be a scalar logical. Error in Test1 (line 1) assert(numCmp('12.3456',12.3456))

2   Fail
assert(numCmp('12.3456',12.3456789))

a1 = 7 a = '12.3457' b = logical 0

Error using assert The condition input argument must be a scalar logical. Error in Test2 (line 1) assert(numCmp('12.3456',12.3456789))

3   Fail
assert(~numCmp('12.3456',12.345))

a1 = 7 a = '12.345' b = logical 0

Assertion failed.

4   Fail
assert(~numCmp('12.34567890',12.3456))

a1 = 11 a = '12.3456' b = logical 0

Matrix dimensions must agree. Error in numCmp (line 10) if n1=='12.3456' Error in Test4 (line 1) assert(~numCmp('12.34567890',12.3456))

5   Fail
assert(numCmp('12e6',12e6))

a1 = 4 a = '12000000' b = logical 0

Matrix dimensions must agree. Error in numCmp (line 10) if n1=='12.3456' Error in Test5 (line 1) assert(numCmp('12e6',12e6))

6   Fail
assert(~numCmp('54',100))

a1 = 2 a = '100' b = logical 0

Matrix dimensions must agree. Error in numCmp (line 10) if n1=='12.3456' Error in Test6 (line 1) assert(~numCmp('54',100))