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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Adjust decimal places after explicit operator in Prime 3.1

bbomst�rk
1-Newbie

Adjust decimal places after explicit operator in Prime 3.1

Hey...

Is there a workaround for this?

The "Result" box is greyed out...

Screen Shot 2016-06-03 at 10.00.50.png

8 REPLIES 8
RichardJ
19-Tanzanite
(To:bbomst�rk)

Sorry, but in Mathcad Prime there is no good way to do this.

Please do not post the same question twice.

tselvan
4-Participant
(To:bbomst�rk)

Below screenshot shows possible workaround...

explicit+float.png

RichardJ
19-Tanzanite
(To:tselvan)

Below screenshot shows possible workaround...

Sorry, but no. I'll avoid going into one of my (fairly frequent) rants about this, but the float keyword does not just affect the precision of the displayed result, it affects the precision of the calculations. So it's use, especially with a small number of digits, can lead to wrong answers (well, they are right of course, given the low precision of the calculations, but not what is probably expected). 

MJG
18-Opal
18-Opal
(To:tselvan)

If you're going to consider using this workaround, you could also consider using the "round" or "Round" functions.  Similarly, these would affect the precision of the calculation, not just the display.

With "float" you specify the number of significant digits.  With "round" you specify the number of decimal places (not compatible with units).  With "Round" you specify the rounding interval (e.g. 0.01m^3).  Choose whichever you prefer.

Richard, while I generally agree with your "rants" on this topic, I will say that engineering calculations are often (relative term, I suppose) done by hand where you round each variable as you go.  The final answer is typically rounded up to the next standard size, so the loss of precision does not affect the final answer.  That said, I never use these "workarounds" in my own calculations because I do prefer to maintain precision.  I see no need to show the equation with numeric values substituted for each variable (as provided by "explicit,ALL").

RichardJ
19-Tanzanite
(To:MJG)

Richard, while I generally agree with your "rants" on this topic, I will say that engineering calculations are often (relative term, I suppose) done by hand where you round each variable as you go.  The final answer is typically rounded up to the next standard size, so the loss of precision does not affect the final answer.

Whether the loss of precision affects the final answer depends on how much precision you use and the need for accuracy in the answer. Four significant digits may be enough to calculate the required trajectory to put a basketball through the hoop from the center of the court, but it's not going to be enough to calculate the trajectory of a spacecraft destined for Mars. If the calculations are done by hand the engineer (hopefully!) knows that though, and uses enough precision to solve the problem at hand to the required accuracy. The danger of the float keyword is that the engineer may believe they are using enough precision because they don't realize what it is doing, and that the answer therefore does have the required accuracy, but they are wrong. And so the spaceship crashes into Mars (something that is even more likely if calculations are done outside of Mathcad, with no automatic unit handling Mars Climate Orbiter Team Finds Likely Cause Of Loss ). That's what drives me to try and shut down this suggestion every time I see it come up.

MJG
18-Opal
18-Opal
(To:RichardJ)

Yes, I agree.  My point is simply that some calculations do not need high precision, so if the user chooses to use float, it's quite possibly good enough.  As you noted, what's most important is that the user understands and accepts the loss of precision.

It's cumbersome, but this is likely the only workaround that does not result in loss of precision.  As noted above, you can replace "float" with "round" or "Round":

Obviously, you'd want to put most of these calculations in hidden regions.

Top Tags