Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 47439

Submitted on 21 Feb 2012 by Bart

Correct

80Size
Leading solution size is 21.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
assert(numCmp('12.3456',12.3456))
dt =
     3
pow =
     5
n1_2 =
              1234560
n2_2 =
              1234560
tf =
     0
tf =
     1
2
Pass
 
%%
assert(numCmp('12.3456',12.3456789))
dt =
     3
pow =
     5
n1_2 =
              1234560
n2_2 =
              1234568
tf =
     0
tf =
     1
3
Pass
 
%%
assert(~numCmp('12.3456',12.345))
dt =
     3
pow =
     5
n1_2 =
              1234560
n2_2 =
              1234500
tf =
     0
4
Pass
 
%%
assert(~numCmp('12.34567890',12.3456))
dt =
     3
pow =
     9
n1_2 =
          12345678900
n2_2 =
          12345600000
tf =
     0
5
Pass
 
%%
assert(numCmp('12e6',12e6))
dt =
     []
tf =
     1
6
Pass
 
%%
assert(~numCmp('54',100))
dt =
     []
tf =
     0