 |
|
List Archives > 
Mathcad List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[mathcad] RE: [mathcad]Re: Rounding up/down error
| [mathcad] RE: [mathcad]Re: Rounding up/down error |
|
Author: Sander Lablans
Posted: Tue, 15 Jul 2003 11:01:08 +0200
|
Well, the problem isn't that actually. I know about hidden digits. The fact
is that I DEFINED a variable with:
dp := 0.04425 N/mm^2
Therefore, I know that there are NO other digits after the 5. But for my
report, I have to use 4 digits instead of 5 (due to conformance throughout
the document). It was then that I found out about this strange occurence.
I do have to say that I think Chris does have the answer to this strange
behavior. I am no MathCad specialist, so I have to take his word for it that
MathCad uses a 52-bit normalised mantissa. But it would make sense.
In fact: if I change the value of 0.04425 to 0.05425 it is rounded to
0.0542, changing it to 0.06425, it gets rounded to 0.0643. If I change this
first non-zero digit from 0 to 9, I get a rather arbitrarily behavior of the
last digit, which would point to Chris' explanation.
Sander
-----Original Message-----
From: Markos E. Psarros />
Sent: dinsdag 15 juli 2003 10:28
To: Mathcad Discussion List
Subject: [mathcad] [mathcad]Re: Rounding up/down error
Dear Sander
Have you checked what is the ACTUAL number that underlies 0.04425?
If in 6 decimal points accuracy it was 0.044248 it would round in 5 digits
as 0.04425 (48 turns to 50) but if it was round to 4 digits it would give
0.0442 (because 248 rounds to 200 since it is NOT more than 250)!!
That for, check the result in 6 or even 8 digits accuracy and you'll see!
Markos
*********** REPLY SEPARATOR ***********
On 15/7/2003 at 9:12 pl Sander Lablans wrote:
[Edit] and now with attachment... [Edit]
Hello list,
I have been using a calculation with a number of 0.04425 N/mm^2.
However, I noticed a strange behavior when I modified the properties of a
result to show me 4 digits. Normally, it would then show me 0.0443 as a 5
always rounds up. However, as you can see in the attached mathcad-sheet,
MathCad decides that it does not want to show 0.0443, but 0.0442. I have
been playing with a few other numbers, but this is the only one I have
found. Can someone tell me, whether this is a bug in MathCad, or that there
is an option included in MathCad that makes sure that some results are
rounded to a different value? (Or perhaps someone else has encountered the
same rounding error somewhere else...)
Regards,
Sander Lablans
---------------------------------
NedTech Engineering B.V.
The Netherlands
**********END OF INITIAL MESSAGE******* ---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
Dr. Markos E. Psarros
Ph.D. Civil Engineering
General Manager Software Imports and Sales
MP & Associates
33 Skoufa Str.
ATHENS 106 73
GREECE
Tel: +30-210-3633977
Fax: +30-210-3617108
e-mail: />
http://www.mpassociates.gr
---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
|
| [mathcad] RE: [mathcad]Re: Rounding up/down error |
|
Author: Dan Khoushy Ph D
Posted: Tue, 15 Jul 2003 10:50:02 +0100
|
If it were to be true then any instance of 0.04425 will round incorrectly,
which is not the case. Just write x:=0.0425 and then x= and format the
results to 5 digits and you will get exactly x=0.04425.
52-bit normalised mantissa should be quite enough.
If Sandra will let us have her worksheet maybe we can solve the mystery.
Best Regards,
Dan
-----Original Message-----
From: Sander Lablans
Sent: Tuesday, July 15, 2003 10:01
To: Mathcad Discussion List
Subject: [mathcad] RE: [mathcad]Re: Rounding up/down error
Well, the problem isn't that actually. I know about hidden digits. The fact
is that I DEFINED a variable with:
dp := 0.04425 N/mm^2
Therefore, I know that there are NO other digits after the 5. But for my
report, I have to use 4 digits instead of 5 (due to conformance throughout
the document). It was then that I found out about this strange occurence.
I do have to say that I think Chris does have the answer to this strange
behavior. I am no MathCad specialist, so I have to take his word for it that
MathCad uses a 52-bit normalised mantissa. But it would make sense.
In fact: if I change the value of 0.04425 to 0.05425 it is rounded to
0.0542, changing it to 0.06425, it gets rounded to 0.0643. If I change this
first non-zero digit from 0 to 9, I get a rather arbitrarily behavior of the
last digit, which would point to Chris' explanation.
Sander
-----Original Message-----
From: Markos E. Psarros />
Sent: dinsdag 15 juli 2003 10:28
To: Mathcad Discussion List
Subject: [mathcad] [mathcad]Re: Rounding up/down error
Dear Sander
Have you checked what is the ACTUAL number that underlies 0.04425?
If in 6 decimal points accuracy it was 0.044248 it would round in 5 digits
as 0.04425 (48 turns to 50) but if it was round to 4 digits it would give
0.0442 (because 248 rounds to 200 since it is NOT more than 250)!!
That for, check the result in 6 or even 8 digits accuracy and you'll see!
Markos
*********** REPLY SEPARATOR ***********
On 15/7/2003 at 9:12 pl Sander Lablans wrote:
[Edit] and now with attachment... [Edit]
Hello list,
I have been using a calculation with a number of 0.04425 N/mm^2. However, I
noticed a strange behavior when I modified the properties of a result to
show me 4 digits. Normally, it would then show me 0.0443 as a 5 always
rounds up. However, as you can see in the attached mathcad-sheet, MathCad
decides that it does not want to show 0.0443, but 0.0442. I have been
playing with a few other numbers, but this is the only one I have found. Can
someone tell me, whether this is a bug in MathCad, or that there is an
option included in MathCad that makes sure that some results are rounded to
a different value? (Or perhaps someone else has encountered the same
rounding error somewhere else...)
Regards,
Sander Lablans
---------------------------------
NedTech Engineering B.V.
The Netherlands
**********END OF INITIAL MESSAGE******* ---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
Dr. Markos E. Psarros
Ph.D. Civil Engineering
General Manager Software Imports and Sales
MP & Associates
33 Skoufa Str.
ATHENS 106 73
GREECE
Tel: +30-210-3633977
Fax: +30-210-3617108
e-mail: />
http://www.mpassociates.gr
---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
|
| [mathcad] RE: [mathcad]Re: Rounding up/down error |
|
Author: Chris Whitford
Posted: Tue, 15 Jul 2003 11:19:57 +0100
|
This can lead to unexpected behaviour. Consider if the internal
representation is 0.0442499999... Then to 4 places it will become 0.0442
while for 5 or more places it will become 0.0442500... and Mathcad drops
the trailing zeroes. Try it!
Chris
At 10:50 15/07/2003 +0100, you wrote:
>If it were to be true then any instance of 0.04425 will round incorrectly,
>which is not the case. Just write x:=0.0425 and then x= and format the
>results to 5 digits and you will get exactly x=0.04425.
>
>
>
>52-bit normalised mantissa should be quite enough.
+------------------------------------------------------------------+
+ Chris Whitford University of Leicester +
+ Research Fellow Space Research Centre +
+ Tel: +44 (0)116 252 3496 Physics and Astronomy Department +
+ Fax: +44 (0)116 252 2464 University Road +
+ email: LEICESTER LE1 7RH +
+ http://www.star.le.ac.uk/ UK +
+------------------------------------------------------------------+
---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
|
| [mathcad] RE: [mathcad]Re: Rounding up/down error |
|
Author: Markos E Psarros
Posted: Tue, 15 Jul 2003 13:17:46 +0300
|
Did you check the units that you are using?
What is the Units system that is defined as default in your worksheet?
Maybe there is a roundoff error in transforming numbers from one unit system to the other!
Markos
*********** REPLY SEPARATOR ***********
On 15/7/2003 at 11:01 đě Sander Lablans wrote:
Well, the problem isn't that actually. I know about hidden digits. The fact is that I DEFINED a variable with:
dp := 0.04425 N/mm^2
Therefore, I know that there are NO other digits after the 5. But for my report, I have to use 4 digits instead of 5 (due to conformance throughout the document). It was then that I found out about this strange occurence.
I do have to say that I think Chris does have the answer to this strange behavior. I am no MathCad specialist, so I have to take his word for it that MathCad uses a 52-bit normalised mantissa. But it would make sense.
In fact: if I change the value of 0.04425 to 0.05425 it is rounded to 0.0542, changing it to 0.06425, it gets rounded to 0.0643. If I change this first non-zero digit from 0 to 9, I get a rather arbitrarily behavior of the last digit, which would point to Chris' explanation.
Sander
-----Original Message-----
From: Markos E. Psarros />
Sent: dinsdag 15 juli 2003 10:28
To: Mathcad Discussion List
Subject: [mathcad] [mathcad]Re: Rounding up/down error
Dear Sander
Have you checked what is the ACTUAL number that underlies 0.04425?
If in 6 decimal points accuracy it was 0.044248 it would round in 5 digits as 0.04425 (48 turns to 50) but if it was round to 4 digits it would give 0.0442 (because 248 rounds to 200 since it is NOT more than 250)!!
That for, check the result in 6 or even 8 digits accuracy and you'll see!
Markos
*********** REPLY SEPARATOR ***********
On 15/7/2003 at 9:12 pl Sander Lablans wrote:
[Edit] and now with attachment... [Edit]
Hello list,
I have been using a calculation with a number of 0.04425 N/mm^2. However, I noticed a strange behavior when I modified the properties of a result to show me 4 digits. Normally, it would then show me 0.0443 as a 5 always rounds up. However, as you can see in the attached mathcad-sheet, MathCad decides that it does not want to show 0.0443, but 0.0442. I have been playing with a few other numbers, but this is the only one I have found. Can someone tell me, whether this is a bug in MathCad, or that there is an option included in MathCad that makes sure that some results are rounded to a different value? (Or perhaps someone else has encountered the same rounding error somewhere else...)
Regards,
Sander Lablans
---------------------------------
NedTech Engineering B.V.
The Netherlands
**********END OF INITIAL MESSAGE******* ---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
Dr. Markos E. Psarros
Ph.D. Civil Engineering
General Manager Software Imports and Sales
MP & Associates
33 Skoufa Str.
ATHENS 106 73
GREECE
Tel: +30-210-3633977
Fax: +30-210-3617108
e-mail: />
http://www.mpassociates.gr
---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
**********END OF INITIAL MESSAGE*******
---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
|
| [mathcad] RE: [mathcad]Re: Rounding up/down error |
|
Author: Bruff, Stuart
Posted: Tue, 15 Jul 2003 12:58:53 +0100
|
Sander
Does the attached file help any?
Both Axum and Matlab round the number down. Excel rounds it up.
Stuart
Stuart Bruff
Senior Systems Engineer
Studies Group
Alenia Marconi Systems Limited
Lyon Way, Frimley, Camberley, Surrey.
GU16 7EX
United Kingdom
GNET : 822-5604
Tel No: +44(0)1276-468604
EMAIL:
-----Original Message-----
From: Sander Lablans />
Sent: Tuesday, July 15, 2003 10:01
To: Mathcad Discussion List
Subject: [mathcad] RE: [mathcad]Re: Rounding up/down error
*** WARNING ***
This mail has originated outside your organization,
either from an external partner or the Global Internet.
Keep this in mind if you answer this message.
Well, the problem isn't that actually. I know about hidden digits. The fact
is that I DEFINED a variable with:
dp := 0.04425 N/mm^2
Therefore, I know that there are NO other digits after the 5. But for my
report, I have to use 4 digits instead of 5 (due to conformance throughout
the document). It was then that I found out about this strange occurence.
I do have to say that I think Chris does have the answer to this strange
behavior. I am no MathCad specialist, so I have to take his word for it that
MathCad uses a 52-bit normalised mantissa. But it would make sense.
In fact: if I change the value of 0.04425 to 0.05425 it is rounded to
0.0542, changing it to 0.06425, it gets rounded to 0.0643. If I change this
first non-zero digit from 0 to 9, I get a rather arbitrarily behavior of the
last digit, which would point to Chris' explanation.
Sander
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
|
|
Attachments:
Numeric Roundoff.mcd
|
| [mathcad] RE: [mathcad]Re: Rounding up/down error |
|
Author: Radovan P Omorjan
Posted: Wed, 16 Jul 2003 14:13:56 +0200
|
Hi Sander and others,
I might missing something but consider this (Mcad 2001)
If you define a variable x := 0.32245 and format the result (Format=>Result) with 4
decimal places you will get
x = 0.3224
but if you take y := round(x,4) you will get
y = 0.3225
formating the result with more or equal to 4 decimal places.
I consider this as a Mathcad problem.
Radovan
On 15 Jul 2003 at 11:19, Chris Whitford wrote:
>
> This can lead to unexpected behaviour. Consider if the internal representation is 0.0442499999...
> Then to 4 places it will become 0.0442 while for 5 or more places it will become 0.0442500...
> and Mathcad drops the trailing zeroes. Try it!
>
> Chris
---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
|
| [mathcad] RE: [mathcad]Re: Rounding up/down error |
|
Author: Chris Whitford
Posted: Wed, 16 Jul 2003 14:14:11 +0100
|
It would appear that the algorithm for displaying numbers, and for the
"round" function, are different. As another example, write
x:=0.32245
y:=x.10000
y=3225 (displayed with no decimal places)
y = 3.224 * 10^3 (general format)
However, I don't think this is a bug. One must never assume that any real
number is exact; there is always the possibility of rounding error. These
examples just highlight that in a very direct way.
Chris
At 14:13 16/07/2003 +0200, you wrote:
>I might missing something but consider this (Mcad 2001)
>If you define a variable x := 0.32245 and format the result
>(Format=>Result) with 4
>decimal places you will get
>x = 0.3224
>but if you take y := round(x,4) you will get
>y = 0.3225
>formating the result with more or equal to 4 decimal places.
>I consider this as a Mathcad problem.
+------------------------------------------------------------------+
+ Chris Whitford University of Leicester +
+ Research Fellow Space Research Centre +
+ Tel: +44 (0)116 252 3496 Physics and Astronomy Department +
+ Fax: +44 (0)116 252 2464 University Road +
+ email: LEICESTER LE1 7RH +
+ http://www.star.le.ac.uk/ UK +
+------------------------------------------------------------------+
---
The Mathcad List - Discussion, Support & News
Contributions: />
Hosted by: Adept Scientific http://www.adeptscience.com
List Archive: http://lists.adeptscience.co.uk/
---
Would you like this to come to a different email address?
---
Simply leave the mailing list (see below) and re-join by
sending a blank email from the new address to:
or
---
If you do not want to be on the Mathcad list, simply send a
blank email (no subject or message needed) to:
/>
|
Previous by date: [mathcad] [mathcad]Re: Rounding up/down error, Markos E Psarros
Next by date: [mathcad] RE: [mathcad]Re: Rounding up/down error, Dan Khoushy Ph D
Previous thread: [mathcad] Re: Rounding up/down error, Chris Whitford
Next thread: [mathcad] RE: [mathcad]Re: Rounding up/down error, Sander Lablans
|
|
|