Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Multiplying a variable by "ft" changes the value -...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-02-2015
09:19 AM

06-02-2015
09:19 AM

Multiplying a variable by "ft" changes the value - MathCAD bug

I am having an issue with variables changing value from an integer to an integer +/- a very small value like 0.0000000000000002 when I assign the variable a unit. I've changed the default units to U.S. thinking that there was some small conversion being done incorrectly, but the issue is still there. Does anyone have any idea what could be causing this? This is really putting a kink in my work day. I have to subtract these values from other values and then test that result. If that result is < 0 instead of exactly 0, the MathCAD sheet doesn't work correctly. To me, this is a major issue, and I'm not sure why MathCAD would have a bug like this. I've included a screenshot for clarity on what I'm talking about.

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-02-2015
10:15 AM

06-02-2015
10:15 AM

Re: Multiplying a variable by "ft" changes the value - MathCAD bug

It's not a bug. It's inherent to numerical computing. All numbers in Mathcad are stored as double precision floats, which gives you about 15-16 digits of precision. What you are looking at are numerical round-off errors, and it's why you should never do an exact comparison of two floating point numbers (a rule that is universal, not just for Mathcad). Go to "Tools", "Worksheet options", and select the "Calculation" tab. Uncheck "Use exact equality for comparisons and truncation". Unfortunately, the default is for this to be checked, which may not be a bug, but it's a very bad choice for the default.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-02-2015
10:45 AM

06-02-2015
10:45 AM

Re: Multiplying a variable by "ft" changes the value - MathCAD bug

I unchecked the box you described and it doesn't solve my problem. The spreadsheet still says that 0.00000000000000002 is greater than 0 and my sheet still doesn't get the correct answer. I tried rounding the value that is being compared to 0 and apparently you can't round a value with units.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-02-2015
01:25 PM

06-02-2015
01:25 PM

Re: Multiplying a variable by "ft" changes the value - MathCAD bug

Please post the worksheet (Click on "Use advanced editor" at the top right of the edit dialog").

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-02-2015
09:17 PM

06-02-2015
09:17 PM

Re: Multiplying a variable by "ft" changes the value - MathCAD bug

Perhaps this will help: