Exact math. More...
#include <stdlib.h>
#include <cmath>
#include <vector>
#include <boost/array.hpp>
Go to the source code of this file.
Functions | |
void | fastTwoSum (double a, double b, double &res, double &err) |
Calculates the sum of two numbers. More... | |
void | fastTwoDiff (double a, double b, double &res, double &err) |
Subtracts two numbers. More... | |
void | twoSum (double a, double b, double &res, double &err) |
Calculates the sum of a and b. More... | |
void | twoDiff (double a, double b, double &res, double &err) |
Difference between two numbers. More... | |
void | split (double num, double &high, double &low) |
Splits a given number into two, Used for multiplication. More... | |
void | twoProduct (double a, double b, double &res, double &err) |
Product of two number. More... | |
void | square (double num, double &res, double &err) |
Calculates the square of a number. More... | |
boost::array< double, 3 > | twoOneSum (boost::array< double, 2 > const &a, double b) |
Calculates the sum of a two-expansion and a double. More... | |
boost::array< double, 3 > | twoOneDiff (boost::array< double, 2 > const &a, double b) |
Calculates the difference between a two-expansion and a double. More... | |
vector< double > | twoTwoSum (boost::array< double, 2 > const &a, boost::array< double, 2 > const &b) |
Calculates the sum of two two-expansions. More... | |
vector< double > | twoTwoDiff (boost::array< double, 2 > const &a, boost::array< double, 2 > const &b) |
Calculates the difference between two two-expansions. More... | |
vector< double > | growExpansionZeroElim (vector< double > const &e, double b) |
Adds a scalar to an existing expansion. More... | |
vector< double > | expansionSumZeroElim (vector< double > const &e, vector< double > const &f) |
Adds up two expansions. More... | |
vector< double > | fastExpansionSumZeroElim (vector< double > const &e, vector< double > const &f) |
Adds up two expansions. More... | |
vector< double > | linearExpansionSumZeroElim (vector< double > const &e, vector< double > const &f) |
Adds up two expansions. More... | |
void | scaleExpansionZeroElim (vector< double > const &e, double b, vector< double > &result) |
Multiplies a scalar by an expansion. More... | |
vector< double > | compress (vector< double > const &e) |
Compresses an expansion. More... | |
double | estimate (vector< double > const &e) |
Calculate a double precision approximation of the expansion. More... | |
Exact math.
Definition in file exactmath.hpp.
vector<double> compress | ( | vector< double > const & | e | ) |
Compresses an expansion.
e | Expansion |
Definition at line 450 of file exactmath.cpp.
double estimate | ( | vector< double > const & | e | ) |
Calculate a double precision approximation of the expansion.
e | Expansion |
Definition at line 488 of file exactmath.cpp.
vector<double> expansionSumZeroElim | ( | vector< double > const & | e, |
vector< double > const & | f | ||
) |
Adds up two expansions.
e | First expansion |
f | Second expansion |
Definition at line 173 of file exactmath.cpp.
vector<double> fastExpansionSumZeroElim | ( | vector< double > const & | e, |
vector< double > const & | f | ||
) |
Adds up two expansions.
e | First expansion |
f | Second expansion |
Definition at line 213 of file exactmath.cpp.
void fastTwoDiff | ( | double | a, |
double | b, | ||
double & | res, | ||
double & | err | ||
) |
Subtracts two numbers.
a | First number |
b | Second number |
res | Output |
err | Roundoff error |
Definition at line 26 of file exactmath.cpp.
void fastTwoSum | ( | double | a, |
double | b, | ||
double & | res, | ||
double & | err | ||
) |
Calculates the sum of two numbers.
a | First number |
b | Second number |
res | Output |
err | Roundoff error |
Definition at line 12 of file exactmath.cpp.
vector<double> growExpansionZeroElim | ( | vector< double > const & | e, |
double | b | ||
) |
Adds a scalar to an existing expansion.
e | Expansion |
b | Scalar |
Definition at line 150 of file exactmath.cpp.
vector<double> linearExpansionSumZeroElim | ( | vector< double > const & | e, |
vector< double > const & | f | ||
) |
Adds up two expansions.
e | First expansion |
f | Second expansion |
Definition at line 330 of file exactmath.cpp.
void scaleExpansionZeroElim | ( | vector< double > const & | e, |
double | b, | ||
vector< double > & | result | ||
) |
Multiplies a scalar by an expansion.
e | Expansion |
b | Scalar |
result | Result |
Definition at line 416 of file exactmath.cpp.
void split | ( | double | num, |
double & | high, | ||
double & | low | ||
) |
Splits a given number into two, Used for multiplication.
num | Number |
high | Higher part |
low | Lower part |
Definition at line 66 of file exactmath.cpp.
void square | ( | double | num, |
double & | res, | ||
double & | err | ||
) |
Calculates the square of a number.
num | Number |
res | Result |
err | Roundoff error |
Definition at line 104 of file exactmath.cpp.
void twoDiff | ( | double | a, |
double | b, | ||
double & | res, | ||
double & | err | ||
) |
Difference between two numbers.
a | First number |
b | Second number |
res | Result |
err | Roundoff error |
Definition at line 60 of file exactmath.cpp.
boost::array<double,3> twoOneDiff | ( | boost::array< double, 2 > const & | a, |
double | b | ||
) |
Calculates the difference between a two-expansion and a double.
a | Two expansion |
b | Number |
Definition at line 119 of file exactmath.cpp.
boost::array<double,3> twoOneSum | ( | boost::array< double, 2 > const & | a, |
double | b | ||
) |
Calculates the sum of a two-expansion and a double.
a | Two expansion |
b | A number |
Definition at line 110 of file exactmath.cpp.
void twoProduct | ( | double | a, |
double | b, | ||
double & | res, | ||
double & | err | ||
) |
Product of two number.
a | First number |
b | Second number |
res | Result |
err | Error |
Definition at line 87 of file exactmath.cpp.
void twoSum | ( | double | a, |
double | b, | ||
double & | res, | ||
double & | err | ||
) |
Calculates the sum of a and b.
a | First number |
b | Second number |
res | Result |
err | Roundoff error |
Definition at line 43 of file exactmath.cpp.
vector<double> twoTwoDiff | ( | boost::array< double, 2 > const & | a, |
boost::array< double, 2 > const & | b | ||
) |
Calculates the difference between two two-expansions.
a | First two expansion |
b | Second two expansion |
Definition at line 139 of file exactmath.cpp.
vector<double> twoTwoSum | ( | boost::array< double, 2 > const & | a, |
boost::array< double, 2 > const & | b | ||
) |
Calculates the sum of two two-expansions.
a | First two expansion |
b | Second two expansio |
Definition at line 128 of file exactmath.cpp.