 |
|
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: Jean Rosenfeld
Posted: Wed, 16 Jul 2003 20:30:03 +0100
|
As I understand it the correct (all digits) value of a variable is always
carried through in any calculations, however it is displayed. The choice of
significant digits to display is a cosmetic matter that does not affect
calculations. For engineers just as for scientists (of whom I am one), the
cardinal rule is not to show more significant figures than are warranted by,
for example the uncertainty in the data or physical constants used. If this
rounding 'problem' worries anyone, they could show results to one more
figure than are truly significant, then do the final rounding themselves to
suit their taste.
Having said that, it does seem somewhat unfortunate that the convention used
in MathCAD is somewhat obscure when rounding a number whose last significant
digit has been entered as 5.
Some trial and error for numbers ending with the sequence pq5. If p is odd,
it rounds up whether q is even or odd. If p is even it rounds down if q is
even, but up if q is odd.
examples
x= 0.12345 formatted to 4 digits shows 0.1235 rounds up with p odd, q even
x= 0.12335 formatted to 4 digits shows 0.1234 rounds up with p odd, q odd
x= 0.12445 formatted to 4 digits shows 0.1244 rounds down with p even, q
even
x= 0.12235 formatted to 4 digits shows 0.1224 rounds up with p even, q odd
It is just unfortunate that the number that started this discussion was of
the 'anomalous' (p even, q even) type (well if it had not been there would
have been no discussion...). Of course, if you add the sequence 0000001 at
the end of the number, it rounds up also for this type, provided that the 1
is not beyond the number of places carried in MathCAD (e.g. for the 5 digit
numbers discussed here, you can insert up to 11 zeros before the 1 to flip
the result to rounding up). Doing this might be one way of solving the
display problem, without significantly affecting subsequent calculations.
--------------------------------------------------------
Jean L.J. Rosenfeld
Argoed Hall
Bryn-y-Baal
Mold
Flintshire CH7 6SQ
Wales, UK
Tel +44 1352 750566
E-mail />
-----Original Message-----
From: Shiner Adrian
Sent: 16 July 2003 17:36
To: Mathcad Discussion List
Subject: [mathcad] Re: Rounding up/down error
Good point Chris. If the application is in engineering then the precision of
results are sufficient that lead to the physical product being to
requirements. As the engineer said to the mathematician in a certain
competition to win a lady's favour "I can get close enough for all practical
purposes".
I occasionally see building dimensions shown on drawings to decimal parts of
a millimetre! An understanding of the technology that you are working with
is always useful in order to avoid such howlers and sources of mirth.
Now if you are intent on calculating down to quantum dimensions then perhaps
its another matter, antimatter or dark matter as the case may be.
Best wishes
Adrian
-----Original Message-----
From: Chris Whitford
Sent: 16 July 2003 17:21
To: Mathcad Discussion List
Subject: [mathcad] Re: Rounding up/down error
I wonder whether some people are missing the point here. There is no law of
nature which says that 0.5 must round up. The IEEE floating point formats
(which the PC FP processor uses) say that 0.5 rounds to the nearest even
integer - 1.5 will round to 2 while 2.5 will also round to 2. But Mathcad
does numerical calculations with real numbers, which, except for special
cases, like integers, are approximated by floating point numbers. If you
are worried about the missing digits, display more of them! If you really
need 0.5 to mean exactly 1/2, you need to use the symbolic processor.
Chris
+------------------------------------------------------------------+
+ 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:
---
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:
/>
|
[View Complete Thread]
Previous by date: [mathcad] Re: Rounding up/down error, Shiner Adrian
Next by date: [mathcad] Re: Rounding up/down error, Belshan, James E52
Previous thread: [mathcad] [mathcad]Re: Rounding up/down error, Markos E Psarros
Next thread: [mathcad] Re: Rounding up/down error, Chris Whitford
|
|
|