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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Translate the entire conversation x

Mathcad Prime 7.0.0.0 Floor and Trunc Errors for Integer Values with Units

KM_10748216
2-Explorer

Mathcad Prime 7.0.0.0 Floor and Trunc Errors for Integer Values with Units

1. How can I correct the highlighted functions so that they return 1.00 ft (see image below)?

2. Are others experiencing similar issues in this version of Mathcad?

3. Is this issue resolved in later versions of the program?

Thanks!

 

KM_10748216_0-1690816991945.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:KM_10748216)

What you experience are (annoying) numerical inaccuracies because Prime and also real Mathcad will internally convert any unit to the corresponding basic SI unit.

 

Trunc and other functions of that kind suffer from numerical inaccuracies like

Werner_E_0-1690821445212.png

which are also shown as

Werner_E_1-1690821476269.png

 

Because of

Werner_E_4-1690821567198.png

when you are asking for 

Werner_E_8-1690822094937.png
Prime is actually calculating

Werner_E_3-1690821539389.png

and so runs into round-off errors even though you are providing and expecting only integer values (in feet).

 

Unfortunately Trunc, etc.  are resistant to the settings of the system variables CTOL and TOL.

 

A workaround could be the definition of your own truncation function

Werner_E_6-1690821954802.png

or

Werner_E_7-1690821967458.png

 

 

View solution in original post

3 REPLIES 3
Werner_E
25-Diamond I
(To:KM_10748216)

What you experience are (annoying) numerical inaccuracies because Prime and also real Mathcad will internally convert any unit to the corresponding basic SI unit.

 

Trunc and other functions of that kind suffer from numerical inaccuracies like

Werner_E_0-1690821445212.png

which are also shown as

Werner_E_1-1690821476269.png

 

Because of

Werner_E_4-1690821567198.png

when you are asking for 

Werner_E_8-1690822094937.png
Prime is actually calculating

Werner_E_3-1690821539389.png

and so runs into round-off errors even though you are providing and expecting only integer values (in feet).

 

Unfortunately Trunc, etc.  are resistant to the settings of the system variables CTOL and TOL.

 

A workaround could be the definition of your own truncation function

Werner_E_6-1690821954802.png

or

Werner_E_7-1690821967458.png

 

 

Thanks for your insight. I will use the workaround you suggested.

Werner_E
25-Diamond I
(To:KM_10748216)

Keep in mind that the workarounds may fail, too.

If, in the first suggestion, a/b should be 1 but because of round-off errors happen to be 0.99999999995675, the function will fail, too, because the floor() function will return 0 instead of 1).

Announcements

Top Tags