It seems that the numerical calculation in Mathcad only can process 16 significant figures, such as 123.4567890123456 or 123456789.0123456, and when the number have more significant figures, MC will round it to 16 or 17.
I knew that symbolic calculation could process up to 250 decimal. But I need use it in the programming, and the result of the symbolic calculation can't use in programming.
When I use:
x:=x-trunc(x)
x:=x*10^8-trunc(x*10^8)
to get the number after 10^-8, I get a lot of number irrelevant! Look at the picture below:
In my opinion, the result must be 98765432.11234568, but MC return a unacountable number! Is it another bug of MC15?
And how should I do to increase the computational accuracy?
In Mathcad Prime 2.0, the result is same:
You wrote yourself that Mathcads numerics is limited to 16 significant digits. Then you define a number with 27 significant digits and you really are surprised that the last 10 or so digits don't show up correctly? I would have been surprised if you would have got the result you expected as this would mean that Mathcads numeric accuracy is much better than what they state in the docs.
What kind of real world calculations requires you to have more than 16 significant digits?
BTW, you may be able to use symbolics in a program too (at least you can copy a symbolic eval in a program in MC15). Furthermore you can evalaute your programm symbolically which may give you the accuracy you'd like to have.
I want to create a program that could translate arbitrary decimal to fraction. When the significant figure of the decimal less or equal than 16, my program work well, but when it large than 16, it will return a wrong result.
Eh, this program can't use x-trunc(x) to get the decimal part of the number, and I have try 20.12355, and when use x-trunc(x), the decimal part has been returned 0.123550000000016. So I translate it to string and process it.
But, Just like you have seen, when the significant figure of the number is large than 16, the result is wrong.
That's the limit of the precision of double precision floating point numbers, which is what Mathcad uses for all numerical calculations. You have 16 significant digits.
Nice, and symbolic evaluation fails at the match command (not sure why).
But the question remains - what would you need that rather big number of significant digits for? How many significant digits would be enough (and why) - 100, 250, 1000?
If you really need that precision you may have to chose specialized programs suitable for number theory or you will have to program your arithmetic yourself using Mathcads strings and matrices facilities. This sure would be quite some work. It would be similar to the routines you may have to write if you want to calculate pi for more than 16 or the few hundreds places the symbolics would give you.
Its your decision if you think its worth the effort or not.
Thanks Richard and Werner. Yes, the double precision floating point number is enough to ues in a general way in engineering calculation. Sometimes I just only want to expand the application range of my program, for example to any number.
Werner Exinger 编写:
If you really need that precision you may have to chose specialized programs suitable for number theory or you will have to program your arithmetic yourself using Mathcads strings and matrices facilities. This sure would be quite some work.
I haven't learned number theory in college, and I never thought it would be so much great useful in programming! I have ever seen an example program to get arbitrary precision of PI by matrix programming in Mathcad, and the arithmatic of it is a bit difficult to understand.
Thank you again
zhu laojianke wrote:
I have ever seen an example program to get arbitrary precision of PI by matrix programming in Mathcad, and the arithmatic of it is a bit difficult to understand.
I have posted a Mathcad (15 and Prime) program several times on this forum to calculate pi to an arbitrary precision. The math basically mimics manual arithmatic operations. It starts to bog down around 3,000 digits or so.
You should be able to find it under the topic "Happy Pi Day!"
I have posted a Mathcad (15 and Prime) program several times on this forum to calculate pi to an arbitrary precision. The math basically mimics manual arithmatic operations. It starts to bog down around 3,000 digits or so.
The last post was here, I guess: http://communities.ptc.com/message/199560#199560
Well spotted, sir!