|
|
`
Arbitrary precision package:
Last update on:
06/07/2008
Visitors:
 |

|
| Arbitrary precision for integer, floating point, complex numbers etc. Nearly everything is
here!. A collections of 4 C++ header files. One for arbitrary integer
precision, one for arbitrary floating point precision, a
portable complex template<class T> and finally a portable interval
arithmetic template<class T>. All standard C++ operators are
supported plus all trigonometric and logarithm functions like exp(),log(), log10(), exp(), pow(), sin(), cos(), tan(), atan(),
asin()(, acos(), atan2(). Furthermore for each floating precision
numbers the working rounding mode for arithmetic operations can be
controlled. Four rounding modes are supported. Round to nearest, Round
up, round down and round towards zero, makes it easy to implement interval
arithmetic, which mean you can now get a precise bound of the error for
every floating point calculations! Universal constant like π, Ln 2 and Ln 10 exist in arbitrary
precision. |
Why use this package instead of Gnu's GMP?
1) It has less restrictive permission rules.
2) It support all relevant trigonometric, logarithms and exponential functions like exp(), log(),
sin(), cos() etc. which GMP does not
3) It's born as a
C++ class and not a C library with a C++ wrapper.
4) You also have rounding controls which GMP does not have.
5) π, Ln 2, Ln 10 is available in arbitrary precision |
Why use Gnu's GMP
1) Because it's GNU!
2) Faster and more choices on basic functions and algorithms
3) Gnu's GMP can be located at:
www.gnu.org/software/gmp |
|
Please note that I did not developed this package to
compete with Gnu's GMP but rather because I was missing features not found
in GMP, however since I get a lot of questions why? I have tried to answer
it above. Have fun. |

|
|
Arbitrary
Precision Math C++ Package. Include C++ header file & pdf documentation.
The current
version is:
integer precision: 1.08
float precision: 1.08
complex Precision: 1.01
interval Precision: 1.02
A special thanks to Stephen Gertsch who improve
the documentation dramatically. |
|
Examples:
{
int_precision a(11111111), d;
float_precision f1(10,64); // Initialized to zero and set precision to 64
digits
float_precision f2(2.0), f3(3), f4("0.12345678901234567890" );
d = a * a * a; // a^3
cout << "11111111^3=" << d << endl;
d /= a;
cout << "11111111^2=" << d << endl;
f1 = log( f1 );
f1 *= f2 + f3 / f4;
f1 = _float_table( _PI, 48 ); // Get PI with 48 decimals
cout << "PI with 48 digits:" << f1 << endl;
f1 = float_precision( 2 );
f1 = sqrt( f1 );
cout << "Sqrt(2) with 48 digits:" << f1 << endl;
}
|
| |
| |
|
|