cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

"If" statement

wkhalid
1-Visitor

"If" statement

Hi

Can anyone tell me why tp > (e-2mm) where:

tp=20mm

e=22mm

It should be equal to each other!!!

Thanks

Best regards

Waleed Khalid

ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald III
(To:wkhalid)

To see the difference,  you need to set the results format to show 17 digits.

The simplest workaround for the values you are dealing with its to go to Worksheet Options in the Tools menu,  got to the Calculations tab and then deselect the "Use exact equality for Boolean and Truncation functions" option.  This let's Mathcad regard n numbers with an absolute difference of 10^-12 as being the same.

Stuart

View solution in original post

4 REPLIES 4

Computers carry arithmetic to ridiculous levels and generate small errors at each step. So 22-2 is rarely (if ever) precisely 20, and your equality test says it's not.  Ask Mathcad to evaluate

tp - (e-2mm) =

And see how far apart the two values are.

Hi Fred, thanks for reply

tp - (e-2mm) = 0.00000mm

StuartBruff
23-Emerald III
(To:wkhalid)

To see the difference,  you need to set the results format to show 17 digits.

The simplest workaround for the values you are dealing with its to go to Worksheet Options in the Tools menu,  got to the Calculations tab and then deselect the "Use exact equality for Boolean and Truncation functions" option.  This let's Mathcad regard n numbers with an absolute difference of 10^-12 as being the same.

Stuart

Many thanks. It works now 🙂

Announcements

Top Tags