Skip to main content
1-Visitor
April 26, 2023
Question

Mathcad Prime 8.0 Comparison Rounding Error?

  • April 26, 2023
  • 2 replies
  • 1322 views

I'm trying to check the flange thickness ratio, b/2t, with b=18 and t=0.75. Therefore b/2t=12. 18/(2*0.75)≤12 returns true, of course, but b/2t≤12 returns false. This does not happen with most other values of b and t. What's going on here and is there any way for me to fix it?

dennisds314_1-1682545135447.png

 

 

2 replies

25-Diamond I
April 26, 2023

I tried with Prime 6 and also with Prime 9 and did not experience the problem you describe!

Werner_E_0-1682548494020.png

 

Chances are that in your sheet the values for b and/or t are not simply assigned as in my example but rather are the results of some further calculations. So maybe b ist something like 18.00000001 or t is around 0.74999999999 which both would explain the effect you experience.

Given from the subject for this thread  I guess you already had that suspicion yourself.

Let display the two values with a max of decimals and let also the symbolic display the content of these variables.

A fix/workaround could be to use something like 12+10^-10 instead of 12.

 

For further analysis you would have to attach your sheet here

 

21-Topaz II
April 26, 2023

Hi,

The situation is reproduceable if units of "in" are applied to the dimensions.

Capture2.JPG

The solution is to set the calculation option to approximately equal

Capture.JPG

Cheers

Terry

25-Diamond I
April 27, 2023

Prime is not able to show as many decimals as would be necessary.

But you can let Prime display the difference from the desired and expected value to see the problem.

Werner_E_0-1682577458671.png

 

Turning on "Approximate Equality" gives you no control over the range within values are to be considered equal, but its sure convenient and most of the time sufficient.

Prime chooses an approach where the percentage difference to the value to be compared is decisive. This percentage of value approach may be appropriate in many cases, but I could think of cases where an absolute value is more desirable.

 

BTW, symbolic evaluation does not suffer from this (independent from the "Appoiximate Equality" setting:

Werner_E_1-1682577545605.png