Cody

Problem 371. Decimal Comparison

Solution 3732438

Submitted on 19 Nov 2020 by Michael Jarboe
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
assert(numCmp('12.3456',12.3456))

n2 = '12.3456' tf = logical 1

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

n2 = '12.34568' n2 = '12.3456' tf = logical 1

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

n2 = '12.345' tf = logical 0

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

n2 = '12.3456' tf = logical 0

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

n2 = '1.2e+07' n2 = '1.2e+0' tf = logical 0 tf = logical 1

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

n2 = '1e+02' n2 = '1e+0' tf = logical 0

Suggested Problems

More from this Author56

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!