Adept Scientific - English
The world's best software and hardware for research, science and engineering.
flag arrow
clearclear

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Twitter Adept Scientific on LinkedIn


The Next Steps

• Ask us a question
• Buy Mathcad Now
• View Mathcad Pricing
•  Download a Demo
•  Request a Brochure
• Download a Brochure
• Find out about Training
• Meet Our Team
• Read our RSS Feeds

Learn More

Mathcad Home
Compare Mathcad 15
and Mathcad Prime 1.0

Version Comparison Chart
Mathcad's Mathematical
Functions

Mathcad Enterprise
Mathcad for Education
Rave Reviews
Add-ons

System Requirements

Latest Information

New Features in Mathcad
Prime 1.0

Mathcad Prime 1.0 movie
New Features in Mathcad 15
Using Mathcad and Excel
Engineering Application
Packs

Return on Investment

Service & Support

Patches & Downloads
Frequently Asked Questions
Search the Knowledge Base
Join the Discussion List
Search the List Archive

List Archives >  Mathcad List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[mathcad] Re: Rounding up/down error

Search email archive for  

[mathcad] Re: Rounding up/down error
Author: Bruff, Stuart    Posted: Thu, 17 Jul 2003 12:38:07 +0100

As another example of 'obscure', whilst an Excel 97 worksheet 'rounds' the
display up, the VBA FORMAT statement rounds down.

Worksheet
0.04425 Number as entered
0.0443 Number displayed to 4 decimal places

VBA
Debug.Print Format(0.04425, "0.0000")
0.0442

And, as I mentioned in my earlier email, both Axum 7 and Matlab round this
number down. The method may be obscure, but it's not a 'Mathcad' issue per
se.

If it's of any interest, Mathcad's symbolic processor gives the following
binary representation of 0.04425 to 64 places:
1.01101010011111101111100111011011001000101101000011[1001010110000]*10^-5
(my brackets)

Obviously, any 53 bit mantissa representation of 0.04425 must lose the last
13 digits of this more exact binary representation, and round up or down -
which means 0.04425 may be represented by a number < 0.04425 or > but not
0.04425. Any rounding algorithm will deal with the floating point
representation.

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: Steve Ellison /> Sent: Thursday, July 17, 2003 10:53
To: Mathcad Discussion List
Subject: [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.

To call Mathcad's rounding convention 'obscure' is confusing public
awareness with technical best practice. Round to even is best technical
practice for numerical data handling and pretty well any top-level maths
package should be implementing it. But you;re right - not a lot of people
know that.

>>> 16/07/2003 20:30:03 >>>
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:
/> *******************************************************************
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If
you have received this message in error, please notify the sender
immediately via +44(0)20 8943 7000 or notify
and delete this message and any copies from your computer and network.
LGC Limited. Registered in England 2991879.
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, 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:
/>
********************************************************************
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.
********************************************************************

---
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,  Steve Ellison
Next by date: [mathcad] Re: Rounding up/down error,  Pergande, Albert N
Previous thread: [mathcad] [mathcad]Re: Rounding up/down error,  Markos E Psarros
Next thread: [mathcad] Re: Rounding up/down error, Chris Whitford



Ready to buy?

Mathcad 15 (with 1 year maintenance) - includes FREE Mathcad Prime
Add to shopping basket
£ 970.00
Upgrade to Mathcad 15 individual licence from v14 single user licence - includes FREE Mathcad Prime
Add to shopping basket
£ 220.00
Upgrade to Mathcad 15 individual licence from v11, v12, v13 single user licence - includes FREE Mathcad Prime
Add to shopping basket
£ 290.00

Featured Downloads

Mathcad Prime 1.0 Datasheet
Mathcad Prime 1.0 and Mathcad 15 Comparison Chart
Mathcad Prime 1.0 Demo
Mathcad or Excel?
Mathcad Customer Story: Man B&W Diesel
Mathcad Customer Story: Stork Fokker Aerospace

Latest Downloads

Application Example: Faster Physical Modelling for Mathcad users
Mathcad Case Study - Breakthrough in Water Treatment Technology
Mathcad Whitepaper - Best practices in product development: Design studies & trade-off analyses
Mathcad 15 - New Design of Experiments Demo
Mathcad Prime 2.0 Pre-Launch Interview

Latest News

Mathcad Case Study - Breakthrough in Water Treatment Technology
PTC Recognizes Adept Scientific
PTC recognises Adept Scientific’s Mathcad quality
PTC recognises Adept Scientific’s Mathcad quality
PTC launches Mathcad® Prime 1.0™
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2012, Adept Scientific plc.
Site designed and maintained by Lyndon Ash

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055