 |
|
List Archives > 
Mathcad List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[mathcad] Re: 6 decimal place precision
| [mathcad] Re: 6 decimal place precision |
|
Author: Sven Lindhardt
Posted: Sat, 26 Jul 2003 08:54:43 +0200
|
You can do something like this (2 decimals precision)
f(x) := trunc(x*100)/100
Example f(1/3) = 0.33
Sven Lindhardt
----- Original Message -----
From: "Bill Dumke" />
To: "Mathcad Discussion List" />
Sent: Saturday, July 26, 2003 6:40 AM
Subject: [mathcad] 6 decimal place precision
> How do I limit Mathcad 2001i to only 6 decimal place precision? I am
> trying to simulate a numerical processor doing some complex
> calculations. It only has that precision. When I try to change TOL,
> nothing seems to happen.
>
> Bill
>
|
| [mathcad] Re: 6 decimal place precision |
|
Author: Bill Dumke
Posted: Sat, 26 Jul 2003 03:08:44 -0500
|
Sven,
Thanks for the suggestion, but I am working with complex numbers.
trunc only works for real numbers.
Bill
---
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: 6 decimal place precision |
|
Author: Sven Lindhardt
Posted: Sat, 26 Jul 2003 14:05:05 +0200
|
> Sven,
>
> Thanks for the suggestion, but I am working with complex numbers.
> trunc only works for real numbers.
>
> Bill
Hi Bill,
Maybe the enclosed function can be used
Sven
|
|
Attachments:
ctruncate.mcd
|
| [mathcad] Re: 6 decimal place precision |
|
Author: Stuart Bruff
Posted: Sat, 26 Jul 2003 13:37:47 +0100
|
Bill
Please find attached M2000 format worksheet with complex trunc.
However, I don't think trunc will do the job for lsdigit level calculations.
Mathcad will still calculate the truncated numbers at full 15 digit
precision.
The only way I can think of, off the top of my head, is to write a
vector-based 6 digit calculator in Mathcad ... err, must dash, got a lawn to
mow, kids to get lunch for and the wife'll kill me if I start on that :-)
Stuart
----- Original Message -----
From: "Bill Dumke" />
To: "Mathcad Discussion List" />
Sent: Saturday, July 26, 2003 9:08 AM
Subject: [mathcad] Re: 6 decimal place precision
> Sven,
>
> Thanks for the suggestion, but I am working with complex numbers.
> trunc only works for real numbers.
>
> Bill
>
>
> ---
> 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:
> />
>
|
|
Attachments:
Complex Trunc 2000.mcd
|
| [mathcad] Re: 6 decimal place precision |
|
Author: Bill Dumke
Posted: Sun, 27 Jul 2003 19:05:12 -0500
|
Sven,
I tried your method and thought it might work if I truncated the result
of every piece of the whole function. But I found it will not work for
floating point complex numbers. Any ideas? See attached file.
Bill
|
|
Attachments:
ctruncate2.mcd
|
| [mathcad] Re: 6 decimal place precision |
|
Author: Richard Jackson
Posted: Mon, 28 Jul 2003 10:18:46 -0400
|
What you really need it significant digits, not decimal places.
83333333333333.33333333 to 2 decimal places is
83333333333333.33, whereas to 6 significant digits it is
83333300000000.0
The attached file contains a couple of functions to round to a specified
number of significant digits. I never wrote the one to always round
down, but it shouldn't be hard to adapt the existing ones if this is
needed.
Richard
On 27 Jul 2003 at 19:05, Bill Dumke wrote:
> Sven,
>
> I tried your method and thought it might work if I truncated the result
> of every piece of the whole function. But I found it will not work for
> floating point complex numbers. Any ideas? See attached file.
>
> Bill
>
|
|
Attachments:
Significant Digits 2000.mcd
|
| [mathcad] Re: 6 decimal place precision |
|
Author: Jean Rosenfeld
Posted: Mon, 28 Jul 2003 16:33:00 +0100
|
For floating point numbers greater than 10 the proposed truncation method
will not reduce the number of carried decimal places to 6, which is what I
understand you want. You need first to divide |z| by factors of 10 until its
less than 10, then truncate, then multiply back by the factors of 10 that
you divided by. Try the attached.
--------------------------------------------------------
Jean L.J. Rosenfeld
Argoed Hall
Bryn-y-Baal
Mold
Flintshire CH7 6SQ
Wales, UK
Tel +44 1352 750566
E-mail />
-----Original Message-----
From: Bill Dumke
Sent: 28 July 2003 01:05
To: Mathcad Discussion List
Subject: [mathcad] Re: 6 decimal place precision
Sven,
I tried your method and thought it might work if I truncated the result of
every piece of the whole function. But I found it will not work for
floating point complex numbers. Any ideas? See attached file.
Bill
|
|
Attachments:
ctruncate3.mcd
|
| [mathcad] Re: 6 decimal place precision addendum |
|
Author: Jean Rosenfeld
Posted: Mon, 28 Jul 2003 19:42:23 +0100
|
Further to my previous note with attachment to truncate to 6 decimal places.
You might consider rounding to six instead. This depends on how the system
you are trying to simulate handles numbers less than 10^-6.
Also, for floating numbers less than 1, if the system you are trying to
simulate always has numbers in the form 1.123456 x10^n, you should extend as
shown under dround in the attached. There is probably a more elegant way of
programming that (I had to set the trap for x = 0 or y = 0).
I just want to make the point that it really depends on how the system you
are simulating works:
Fixed decimal point numbers to 6 decimal places, 1.123456 x 10^-7 =
0.0000001123456 carries through as 0
Floating point decimal number to 6 decimal places 1.123456 x 10^-7 is
preserved, etc.
Dtrunc would be analogous to dround, but I did not do it.
I hope this carries things a little further..it needs checking out more
thoroughly for other operands.
--------------------------------------------------------
Jean L.J. Rosenfeld
Argoed Hall
Bryn-y-Baal
Mold
Flintshire CH7 6SQ
Wales, UK
Tel +44 1352 750566
E-mail />
-----Original Message-----
From: Bill Dumke
Sent: 28 July 2003 01:05
To: Mathcad Discussion List
Subject: [mathcad] Re: 6 decimal place precision
Sven,
I tried your method and thought it might work if I truncated the result of
every piece of the whole function. But I found it will not work for
floating point complex numbers. Any ideas? See attached file.
Bill
|
|
Attachments:
ctrunc or round.mcd
|
| [mathcad] Re: 6 decimal place precision |
|
Author: Sven Lindhardt
Posted: Tue, 29 Jul 2003 17:51:47 +0200
|
Here is another example inspired by Jean, it can handle very small numbers
too,
Sven
----- Original Message -----
From: "Jean Rosenfeld" />
To: "Mathcad Discussion List" />
Sent: Monday, July 28, 2003 5:33 PM
Subject: [mathcad] Re: 6 decimal place precision
For floating point numbers greater than 10 the proposed truncation method
will not reduce the number of carried decimal places to 6, which is what I
understand you want. You need first to divide |z| by factors of 10 until its
less than 10, then truncate, then multiply back by the factors of 10 that
you divided by. Try the attached.
--------------------------------------------------------
Jean L.J. Rosenfeld
Argoed Hall
Bryn-y-Baal
Mold
Flintshire CH7 6SQ
Wales, UK
Tel +44 1352 750566
E-mail />
-----Original Message-----
From: Bill Dumke />
Sent: 28 July 2003 01:05
To: Mathcad Discussion List
Subject: [mathcad] Re: 6 decimal place precision
Sven,
I tried your method and thought it might work if I truncated the result of
every piece of the whole function. But I found it will not work for
floating point complex numbers. Any ideas? See attached file.
Bill
---
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: 6 decimal place precision |
|
Author: Jean Rosenfeld
Posted: Tue, 29 Jul 2003 19:50:44 +0100
|
Sven, No attachment?
--------------------------------------------------------
Jean L.J. Rosenfeld
Argoed Hall
Bryn-y-Baal
Mold
Flintshire CH7 6SQ
Wales, UK
Tel +44 1352 750566
E-mail />
-----Original Message-----
From: Sven Lindhardt
Sent: 29 July 2003 16:52
To: Mathcad Discussion List
Subject: [mathcad] Re: 6 decimal place precision
Here is another example inspired by Jean, it can handle very small numbers
too,
Sven
----- Original Message -----
From: "Jean Rosenfeld" />
To: "Mathcad Discussion List" />
Sent: Monday, July 28, 2003 5:33 PM
Subject: [mathcad] Re: 6 decimal place precision
For floating point numbers greater than 10 the proposed truncation method
will not reduce the number of carried decimal places to 6, which is what I
understand you want. You need first to divide |z| by factors of 10 until its
less than 10, then truncate, then multiply back by the factors of 10 that
you divided by. Try the attached.
--------------------------------------------------------
Jean L.J. Rosenfeld
Argoed Hall
Bryn-y-Baal
Mold
Flintshire CH7 6SQ
Wales, UK
Tel +44 1352 750566
E-mail />
-----Original Message-----
From: Bill Dumke />
Sent: 28 July 2003 01:05
To: Mathcad Discussion List
Subject: [mathcad] Re: 6 decimal place precision
Sven,
I tried your method and thought it might work if I truncated the result of
every piece of the whole function. But I found it will not work for
floating point complex numbers. Any ideas? See attached file.
Bill
---
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: 6 decimal place precision |
|
Author: Sven Lindhardt
Posted: Tue, 29 Jul 2003 21:08:09 +0200
|
Sorry about that -:)
Sven
----- Original Message -----
From: "Jean Rosenfeld" />
To: "Mathcad Discussion List" />
Sent: Tuesday, July 29, 2003 8:50 PM
Subject: [mathcad] Re: 6 decimal place precision
Sven, No attachment?
--------------------------------------------------------
Jean L.J. Rosenfeld
Argoed Hall
Bryn-y-Baal
Mold
Flintshire CH7 6SQ
Wales, UK
Tel +44 1352 750566
E-mail />
-----Original Message-----
From: Sven Lindhardt />
Sent: 29 July 2003 16:52
To: Mathcad Discussion List
Subject: [mathcad] Re: 6 decimal place precision
Here is another example inspired by Jean, it can handle very small numbers
too,
Sven
----- Original Message -----
From: "Jean Rosenfeld" />
To: "Mathcad Discussion List" />
Sent: Monday, July 28, 2003 5:33 PM
Subject: [mathcad] Re: 6 decimal place precision
For floating point numbers greater than 10 the proposed truncation method
will not reduce the number of carried decimal places to 6, which is what I
understand you want. You need first to divide |z| by factors of 10 until its
less than 10, then truncate, then multiply back by the factors of 10 that
you divided by. Try the attached.
--------------------------------------------------------
Jean L.J. Rosenfeld
Argoed Hall
Bryn-y-Baal
Mold
Flintshire CH7 6SQ
Wales, UK
Tel +44 1352 750566
E-mail />
-----Original Message-----
From: Bill Dumke />
Sent: 28 July 2003 01:05
To: Mathcad Discussion List
Subject: [mathcad] Re: 6 decimal place precision
Sven,
I tried your method and thought it might work if I truncated the result of
every piece of the whole function. But I found it will not work for
floating point complex numbers. Any ideas? See attached file.
Bill
---
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:
/>
|
|
Attachments:
ctruncate4.mcd
|
Previous by date: [mathcad] 6 decimal place precision, Bill Dumke
Next by date: [mathcad] Re: 6 decimal place precision, Bill Dumke
Previous thread: [mathcad] RE: [mathcad]Re: Rounding up/down error, Sander Lablans
Next thread: [mathcad] Re: 6 decimal place precision, Sven Lindhardt
|
|
|