![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple to you not simple to me pattern matchin help | aleks001 | Shell Programming and Scripting | 0 | 07-22-2007 07:06 PM |
| Simple C question... Hopefully it's simple | Xeed | High Level Programming | 6 | 12-15-2006 10:29 AM |
| Shell script fundamental Questions | pankajkrmishra | Shell Programming and Scripting | 2 | 07-20-2006 11:14 PM |
| Simple if | GNMIKE | Shell Programming and Scripting | 2 | 12-04-2005 02:54 AM |
| Ok simple question for simple knowledge... | Corrail | UNIX for Dummies Questions & Answers | 1 | 11-28-2005 09:03 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
long double p;
long double q; how could i find and store the sum of p & q ? where p and q might have their maximum value. i hope, i'd get a lot of solutions. -sham
__________________
u help me, He'll help u. |
| Forum Sponsor | ||
|
|
|
||||
|
Hi,
The simplest way i feel is to do this using two arrays. One for p and another for q. Store each digit of p in one array and of q in another. Add every element from the last index of array and put the sum in the same index of a third result array (or u can use one of the two arrays itself as the result array) hold the carry in a temporary variable and use this one to add to the next indices of the array. Well, this in itself is the algorithm. Your way is easy now, i guess. If you are thru with this one, try multiplication of two such numbers
__________________
War doesnt determine who is right, it determines who is left |
|
||||
|
The fastest algorithms for calculating floating point numbers to tens of thousands of digits involve Number Theoretic Transforms. But I thought that only a few special purpose program had been written that use them. But I have just found APFLOAT: A C++ High Performance Arbitrary Precision Arithmetic Package. The claims that the author makes for this package are jaw-dropping:
Quote:
|
|
|||
|
You might also try the GNU MultiPrecision library. I don't know how it compares to the APFLOAT: A C++ High Performance Arbitrary Precision Arithmetic Package that Perderabo mentioned, but it might be worth a shot. The site is http://swox.com/gmp/
Good Luck!
__________________
Regards, casinokev |
|||
| Google UNIX.COM |