Turn on suggestions

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

Showing results for

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

Showing results for

** Community Tip** - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts!
X

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

Oct 12, 2019
06:42 PM

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

Oct 12, 2019
06:42 PM

Prime 6.0 - Ceil and Floor function error

Hello everyone,

I am experiencing the same rounding error from previous versions in Mathcad Prime 6.0. Have an explanation? Or, where can I report effectively this error?

Thanks!

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Oct 13, 2019
02:39 PM

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

Oct 13, 2019
02:39 PM

The solution is simple.

Check "Approximate Equality" ("Calculation" ribbon, "Calculation Options") and you should get the correct result:

15 REPLIES 15

Oct 12, 2019
08:50 PM

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

Oct 12, 2019
08:50 PM

@Alvaro_95 wrote:

Hello everyone,

I am experiencing the same rounding error from previous versions in Mathcad Prime 6.0. Have an explanation? Or, where can I report effectively this error?

Effectively? Nowhere! Don't forget - we are dealing with PTC and they have proven their ... "efficiency" in program development and bug fixing quite effective if you look at the way they "develop" Prime.

If you really go through the hassle of reporting this effect you can open a support case, but only if you have paid them and are under maintenance. The lack of a channel in which everybody can report bugs already tells the whole story about PTCs interest in making their software more bug-free.

BTW, AFAIR this bug has already been reported here in the forum a few times (its also present in real Mathcad, so its rather old) and also shows up without using units:

Oct 12, 2019
09:32 PM

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

Oct 12, 2019
09:32 PM

Thank you Werner. I will try to report via support contact.

And yes, it will be useful to have a label "report" just as "tips" or "ideas" in the community.

And yes, it will be useful to have a label "report" just as "tips" or "ideas" in the community.

Oct 13, 2019
04:26 AM

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

Oct 13, 2019
04:26 AM

@Alvaro_95 wrote:

Thank you Werner. I will try to report via support contact.

And yes, it will be useful to have a label "report" just as "tips" or "ideas" in the community.

This label would only make sense, if relevant PTC-staff would scan a subforum like this on a regular basis and act accordingly. I guess this never will happen. Good luck with your support case.

BTW, in MC15 we can set the number of decimal places to 17 and that way we can see whats happening. This at least partially explains the effect - internal round-off errors - possibly due to conversion from decimal in IEEE binary format. The effect also shows if we set the result to 15 decimal numbers. If we do that in Prime (15 is the max possible here), we are not shown that round-off error but obviously its there as we still have the bug in "floor" etc.

Oct 13, 2019
05:03 AM

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

Oct 13, 2019
05:03 AM

Mathcad 11 gives:

Luc

Oct 13, 2019
05:14 AM

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

Oct 13, 2019
05:14 AM

@LucMeekes wrote:

Mathcad 11 gives:

With 17 decimal places?

Thats interesting. I know that MC11 has the better symbolics (with Maple) but was not aware that pure numeric functions also were implemented in a better way and wonder why this changed in later versions.

Basically there is nothing which could be done against the round-off errors themselves as this is a natural conversion effect (0,1 in binary is periodic and has to be cut off somewhere) and a limitation of the IEEE format used to save numbers in numeric mode.

But functions like "Floor" could be written in way so they are aware of this effect and could internally do some clever rounding to avoid it. At least in cases like the one shown here. I guess no matter how clever the function is implemented, it would always be possible to find examples where some error shows up, but it would not be examples with numbers that simple as 2.9 and 0.1.

Here are some more even simpler examples of round-offs. Again in MC15 set to 17 decimal places.

Oct 13, 2019
07:03 AM

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

Oct 13, 2019
07:03 AM

Hmm, it appears that I cannot request 17 decimal places. 15 is the maximum.

But the examples with the (lowecase) floor() functions do show a difference with what you've shown.

Note that the result of the floor() function must be an integer by definition.if the result of 2.9/0.1 would be just below 29, its floor would be 28, not 29.

This:

shows that the quotients are spot-on. Or is there something that I'm missing?

Luc

Oct 13, 2019
02:00 PM

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

Oct 13, 2019
02:00 PM

So it looks like MC11 does correct in every respect.

Guess the "improvements" made on the way from MC11 to MC15 were larger than I thought.

So you cant demand 17 decimals places but just 15 like we can in Prime.

Oct 13, 2019
09:35 AM

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

Oct 13, 2019
09:35 AM

Hi,

It is not really a bug, but a matter of internal precision representation of 0.07 / 0.01 being greater than 7.0000000000000000.

Cheers

Oct 13, 2019
02:19 PM

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

Oct 13, 2019
02:19 PM

@terryhendicott wrote:

Hi,

It is not really a bug, but a matter of internal precision representation

Guess thats exactly what I wrote above when I mentioned the round-off errors due to conversion from decimal to binary and back (in conjunction with the IEEE format used for internal storage).

The bug is not the lack of precision but the fact, that functions like "Floor" should nonetheless give the correct results with the values shown.

I agree its not a bug as in both versions, real Mathcad and Prime, we have the options to turn off "exact" comparison (as shown in my other answers) and that way get the correct results.

Oct 13, 2019
02:37 PM

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

Oct 13, 2019
02:37 PM

It gets even more crazy!

I open the MC11 file which Luc had attached and opened it with MC15.

As you can see in the screen shot - all calculations are correct now!

Even if I retype from scratch one of the expressions which formerly gave a wrong result, the result now is correct!!

When I open an new sheet and copy the region with the correct result from Luc's sheet to the new one, I get the wrong result again.

My test expression was floor(2.9/0.1) which gives 29 in Luc's sheet and 28 in a sheet created with MC15.

I also saved Luc's sheet with MC15 in xmcdz format and then reloaded it, but the results still are correct!

EDIT: Found it!! Silly me - I really should have thought on that from the very beginning!

In real Mathcad one can influence the calculation behavior and in Lucs Sheet in the Worksheet Options the option "Use exact equality for comparison and truncation" was unchecked, while in my sheet this by default was checked.

Unchecking this options makes sense, I guess.

Oct 14, 2019
05:59 PM

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

Oct 14, 2019
05:59 PM

Mathcad 11 gives me these options:

The setting that comes closest to Mathcad 15's "Use exact equality for comparison and truncation" is the last box: "Use exact equality foor boolean comparisons"

Of course I've tried it. There's no difference in any of the results. Checked or unchecked, I get:

I've saved the file now with the box checked. Please check how it translates to Mathcad 15..

Luc

Oct 15, 2019
04:53 AM

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

Oct 15, 2019
04:53 AM

Here is what I see when I open your new sheet.

The box is still checked and some results of course are wrong. Unchecking the box talks Mathcad into delivering correct results.

Oct 13, 2019
02:39 PM

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

Oct 13, 2019
02:39 PM

The solution is simple.

Check "Approximate Equality" ("Calculation" ribbon, "Calculation Options") and you should get the correct result:

Oct 15, 2019
10:26 AM

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

Oct 15, 2019
10:26 AM

Very helpful! Thank you Werner. This at least hide the precision error from Mathcad.

Oct 14, 2019
05:18 PM

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

Oct 14, 2019
05:18 PM