![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| 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 10:06 PM |
| Simple C question... Hopefully it's simple | Xeed | High Level Programming | 6 | 12-15-2006 02:29 PM |
| Shell script fundamental Questions | pankajkrmishra | Shell Programming and Scripting | 2 | 07-21-2006 02:14 AM |
| Simple if | GNMIKE | Shell Programming and Scripting | 2 | 12-04-2005 06:54 AM |
| Ok simple question for simple knowledge... | Corrail | UNIX for Dummies Questions & Answers | 1 | 11-28-2005 01:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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 |
|
|||||
|
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 |
|
|||||
|
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! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|