Skip to main content
1-Visitor
November 14, 2017
Solved

What am I doing wrong with if statement

  • November 14, 2017
  • 1 reply
  • 2132 views

Hello All,

 

I am using Mathcad Prime 4.0. As seen in the photo below, I am just trying to use a simple if statement. I am wondering what I am doing wrong? The answer I should be receiving in my check is "OK" . Any suggestions?

1.PNG

 

Best answer by LucMeekes

Your running into an accuracy issue. Bear in mind that:

- all united values are ALWAYS internally converted into SI units.

- there is ALWAYS a finite accuracy when dealing with numerics.

Here goes:

LM_20171114_Accuracy.png

So the difference between x-y and z is just above 0.

 

When comparing numerical data, allow for some tolerance.

Success!
Luc

1 reply

LucMeekes23-Emerald IVAnswer
23-Emerald IV
November 14, 2017

Your running into an accuracy issue. Bear in mind that:

- all united values are ALWAYS internally converted into SI units.

- there is ALWAYS a finite accuracy when dealing with numerics.

Here goes:

LM_20171114_Accuracy.png

So the difference between x-y and z is just above 0.

 

When comparing numerical data, allow for some tolerance.

Success!
Luc

mcbedfor11-VisitorAuthor
1-Visitor
November 14, 2017

Makes sense, thank you for your help!