List Archives > 
Mathcad List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[mathcad] Re: Rounding up/down error
| [mathcad] Re: Rounding up/down error |
|
Author: Chris Whitford
Posted: Tue, 15 Jul 2003 09:04:29 +0100
|
I suspect the reason is this: numbers are represented internally by a
normalised mantissa (52 bits) times a power of 2. Most decimal fractions
cannot be represented exactly, so some rounding takes place. Then when you
display the number, it is converted back to decimal, and it gets rounded
again. The first rounding could take it up or down, by a very tiny amount.
The actual IEEE floating point format specifies that if the number ends in
exactly 0.5, it is rounded to the nearest even integer. So 1.5 and 2.5 are
both rounded to 2. This is so that, statistically, 0.5 is rounded up or
down with equal probablility.
Chris
At 09:12 15/07/2003 +0200, you wrote:
>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...)
+------------------------------------------------------------------+
+ 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:
/>
|
[View Complete Thread]
Previous by date: [mathcad] Rounding up/down error, Sander Lablans
Next by date: [mathcad] [mathcad]Re: Rounding up/down error, Markos E Psarros
Previous thread: [mathcad] Axum function princomp, Bruff, Stuart
Next thread: [mathcad] [mathcad]Re: Rounding up/down error, Markos E Psarros
|