Skip to main content
1-Visitor
June 18, 2015
Solved

"If" statement

  • June 18, 2015
  • 1 reply
  • 1909 views

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

Best answer by StuartBruff

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

1 reply

23-Emerald I
June 18, 2015

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.

wkhalid1-VisitorAuthor
1-Visitor
June 18, 2015

Hi Fred, thanks for reply

tp - (e-2mm) = 0.00000mm

23-Emerald V
June 18, 2015

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