Skip to main content
1-Visitor
Jun 18, 2015 11:22 AM UTC
Solved

"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

23-Emerald V
Jun 18, 2015 12:48 PM UTC

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

4 replies

23-Emerald I
Jun 18, 2015 12:26 PM UTC

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.

Translate
wkhalid1-VisitorAuthor
1-Visitor
Jun 18, 2015 12:32 PM UTC

Hi Fred, thanks for reply

tp - (e-2mm) = 0.00000mm

Translate
23-Emerald V
Jun 18, 2015 12:48 PM UTC

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

Translate