0

I did calculation and got the following numbers

0.739128438976901 0.739128438976900

I want MATLAB to consider that they are equal, but MATLAB recognized that the first one was greater than the second. How can I make MATLAB consider them as they are equal ?

Thanks

2 Answers 2

3
x = 42 y = 42.00001 if abs(x-y) < tolerance % do something end 

The setting for tolerance is up to you.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't know a whole lot about Matlab (I'm more of a Mathematica guy myself), but it seems there is a roundn(x,n) function which rounds an element x to the nearest multiple of 10^n. Perhaps this could be used here.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.