is it at all possible to calculate numbers to n decimal places in vb, (as it seems to be limited to 14)?
thanks
grippa
Printable View
is it at all possible to calculate numbers to n decimal places in vb, (as it seems to be limited to 14)?
thanks
grippa
For increased precision look at the decimal data type.
I have a solution for C++.
Which is?... :)Quote:
Originally posted by TB
I have a solution for C++.
There is a class called FLINT, which can handle with long numbers (up to 1000 digits), I can send it to you.
If have the tutorial in a book, but i can send you a short version of it.
The class' contents are simple mathematial functions, like additon, comparison, square root..)
It's better to post it as an attachment in case of some one wants it too. Yes, I'm interested. I'm beginning in C and it would be a good exercise for me to see it.
Why do you want more precision than that provided by a VB Double? What is your application?
Programming extra precision arithmetic is tedious, but not difficult. You treat Longs as if they were digits in a long number, and use an Integer to kept track of the Radix point. Do not try to use Singles or Doubles as digits in a long number. The CPU normalization will create confusion.
With rare exceptions, more precision than a double is just not necessary.
In many cases, poor (or no) numerical analysis results in an apparent need for extra precision, when better computational algorithms are what is really required.
An example of the above type of problem is the evaluation of high order polynomials. Naive programmers often write a program which computes all the individual terms and then adds them up. The correct algorithm never explicitly calculates any of the individual terms.
There are chaotic physical problems which create fierce computational problems and seem to be solvable using extra precision arithmetic. Further analysis often indicates that any results obtainable via extra precision methods are unusable because the system being modeled by the math is inherently unstable or chaotic.
An example of the latter type of problem is flutter stability analysis in the aircraft design industry. Sometimes the air frame represented by the equations is inherently unstable. For such an airframe, a minor dent or a slight change in the arrangement of cargo can result in the aircraft being unflyable. The requirement for extra precision is actually an indication that you do not want to build the airframe, and should be making major design changes instead of attempting to get an accurate solution of the equations.