Big Floatingpoint NumbersThe data type bigfloat can be used to represent floating point numbers with arbitrary precision. Floating point numbers approximate mathematics' real numbers.Remark: In contrast to Algebraic Real Numbers, computations based on Big Floating Point Numbers are not performed exactly. Like for the built-in types float and double, the results of the arithmetic operations are rounded. However, in contrast to double the rounding precision can be arbitrary large. ExampleThe following program shows how to usebigfloat . It creates
two bigfloats bf1 and bf2, and initializes them with 3.1314
and 23*2117, respectively. Then it computes the bigfloat
bf3 as bf11/3 with relative error <= 2-10.
#include <LEDA/numbers/bigfloat.h> using namespace leda; int main() { bigfloat bf1=3.1414; bigfloat bf2(23,117); bigfloat bf3=sqrt_d(bf1,10,3); std::cout << "bf1=" << bf1 << std::endl; std::cout << "bf2=" << bf2 << std::endl; std::cout << "bf3=" << bf3 << std::endl; return 0; } Strengths
Disadvantages
TipsBig Floating Point Numbers have many interesting features, but are quite difficult to use. They are mainly intended for advanced users. |
See also:Vectors and Matrices with Integer Entries Vectors and Matrices with Double Entries Functions of numerical analysis Manual Entries: |