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 the Community Ranking System, a fun gamification element of the PTC Community. X

Odd error when sum is equal to 50ft

ptc-2801946
1-Visitor

Odd error when sum is equal to 50ft

I am working on a Mathcad to distribule a given linear load across an endwall to a specified strut spacing. The initial input warning check I am running is to check if the sum of the spaces is equal to the width of the building. This works in every case except when I have a spacing of 5ft, 20ft, 20ft, 5ft. In this case it says my total spacing is 50ft and so is the width which is correct. The porblem is when I ask mathcad to compare the 2, it says they are not equal. When I check what the width (-) TotalSPacing I get a result of 5.828x10^-15 ft. When trying different spacings that also sum to 50ft there doesn't seem to be any problems. I went through and changed everything to meters from feet and there doesn't seem to be a problem. Has anyone else come across a similiar issue or know of a patch that can fix this? Thanks, Tyler
3 REPLIES 3

Don't use exact equality for comparisons. There is a reason why that is not usually used, it doesn't really work. The problem is that MC14 insists on storing all lengths in meters (internally). One foot cannot be represented exactly in meters, using IEEE binary floating point. One solution is to use MC11 and set the unit system to US. MC11 stores values in terms of the base units for the selected unit system, unlike MC14 which always uses SI units, even if they don't quite fit.
RichardJ
19-Tanzanite
(To:TomGutman)

Go to "tools", "worksheet options", "calculation", and uncheck "use exact equality for comparisons and truncation". Then differences at the level of computer roundoff are ignored. Richard

Problem solved. Thanks a lot guys.
Announcements

Top Tags