|
Geogram Version 1.9.7
A programming library of geometric algorithms
|
Represents numbers in arbitrary precision with a low-level API. More...
#include <geogram/numerics/multi_precision.h>
Public Member Functions | |
| index_t | length () const |
| Gets the length of this expansion. | |
| index_t | capacity () const |
| Gets the capacity of this expansion. | |
| void | set_length (index_t new_length) |
| Changes the length of an expansion. | |
| const double & | operator[] (index_t i) const |
| Low level access to a component. | |
| double & | operator[] (index_t i) |
| Low level access to a component. | |
| double * | data () |
| Low level access to the array of components. | |
| const double * | data () const |
| Low level access to the array of components. | |
| expansion (index_t capa) | |
| Client code should not use this constructor. | |
| expansion & | assign (double a) |
| Assigns a number to this expansion. | |
| expansion & | assign (const expansion &rhs) |
| Copies an expansion to this expansion. | |
| expansion & | assign_abs (const expansion &rhs) |
| Copies the absolute value of an expansion to this expansion. | |
| expansion & | assign_sum (double a, double b) |
| Assigns the sum of two doubles to this expansion (should not be used by client code). | |
| expansion & | assign_diff (double a, double b) |
| Assigns the difference of two doubles to this expansion (should not be used by client code). | |
| expansion & | assign_product (double a, double b) |
| Assigns the product of two doubles to this expansion (should not be used by client code). | |
| expansion & | assign_square (double a) |
| Assigns the square of a double to this expansion (should not be used by client code). | |
| expansion & | assign_sum (const expansion &a, double b) |
| Assigns the sum of an expansion and a double to this expansion (should not be used by client code). | |
| expansion & | assign_diff (const expansion &a, double b) |
| Assigns the difference between an expansion and a double to this expansion (should not be used by client code). | |
| expansion & | assign_product (const expansion &a, double b) |
| Assigns the product between an expansion and a double to this expansion (should not be used by client code). | |
| expansion & | assign_sum (const expansion &a, const expansion &b) |
| Assigns the sum of two expansions to this expansion (should not be used by client code). | |
| expansion & | assign_sum (const expansion &a, const expansion &b, const expansion &c) |
| Assigns the sum of three expansions to this expansion (should not be used by client code). | |
| expansion & | assign_sum (const expansion &a, const expansion &b, const expansion &c, const expansion &d) |
| Assigns the sum of four expansions to this expansion (should not be used by client code). | |
| expansion & | assign_diff (const expansion &a, const expansion &b) |
| Assigns the difference between two expansions to this expansion (should not be used by client code). | |
| expansion & | assign_product (const expansion &a, const expansion &b) |
| Assigns the product of two expansions to this expansion (should not be used by client code). | |
| expansion & | assign_product (const expansion &a, const expansion &b, const expansion &c) |
| Assigns the product of three expansions to this expansion (should not be used by client code). | |
| expansion & | assign_square (const expansion &a) |
| Assigns the product of an expansions to this expansion (should not be used by client code). | |
| expansion & | assign_det2x2 (const expansion &a11, const expansion &a12, const expansion &a21, const expansion &a22) |
| Assigns a 2x2 determinant to this expansion (should not be used by client code). | |
| expansion & | assign_det3x3 (const expansion &a11, const expansion &a12, const expansion &a13, const expansion &a21, const expansion &a22, const expansion &a23, const expansion &a31, const expansion &a32, const expansion &a33) |
| Assigns a 3x3 determinant to this expansion (should not be used by client code). | |
| expansion & | assign_det_111_2x3 (const expansion &a21, const expansion &a22, const expansion &a23, const expansion &a31, const expansion &a32, const expansion &a33) |
| Assigns a 3x3 determinant to this expansion where the first row is 1 1 1(should not be used by client code). | |
| expansion & | assign_sq_dist (const double *p1, const double *p2, coord_index_t dim) |
| Assigns the squared distance between two points to this expansion (should not be used by client code). | |
| expansion & | assign_dot_at (const double *p1, const double *p2, const double *p0, coord_index_t dim) |
| Assigns the dot product of two vectors to this expansion (should not be used by client code). | |
| expansion & | assign_length2 (const expansion &x, const expansion &y, const expansion &z) |
| Assigns the length of a vector to this expansion (should not be used by client code). Do not call this function directly, use expansion_length2() macro instead. | |
| expansion & | negate () |
| Changes the sign of an expansion. | |
| expansion & | scale_fast (double s) |
| Multiplies this expansion by a power of two. | |
| double | estimate () const |
| Computes an approximation of the stored value in this expansion. | |
| Sign | sign () const |
| Gets the sign of the expansion. | |
| bool | is_same_as (const expansion &rhs) const |
| Compares two expansions bit-by-bit. | |
| bool | is_same_as (double rhs) const |
| Compares an expansion and a double bit-by-bit. | |
| Sign | compare (const expansion &rhs) const |
| Compares two expansions. | |
| Sign | compare (double rhs) const |
| Compares two expansions. | |
| bool | equals (const expansion &rhs) const |
| Compares two expansions. | |
| bool | equals (double rhs) const |
| Compares an expansion and a double. | |
| std::ostream & | show (std::ostream &out) const |
| Displays all the components of this expansion (for debugging purposes). | |
| std::string | to_string () const |
| Gets a string representation of this expansion. | |
| void | optimize () |
| Optimizes the internal representation without changing the represented value. | |
Static Public Member Functions | |
| static size_t | bytes (index_t capa) |
| Computes the amount of memory required to store an expansion. | |
| static size_t | bytes_on_stack (index_t capa) |
| Computes the amount of memory required to store an expansion on the stack. | |
| static expansion * | new_expansion_on_heap (index_t capa) |
| Allocates an expansion on the heap. | |
| static void | delete_expansion_on_heap (expansion *e) |
| Deallocates an expansion on the heap. | |
| static index_t | sum_capacity (double a, double b) |
| Computes the required capacity to store the sum of two doubles. | |
| static index_t | diff_capacity (double a, double b) |
| Computes the required capacity of an expansion to store the exact difference of two doubles. | |
| static index_t | product_capacity (double a, double b) |
| Computes the required capacity of an expansion to store the exact product of two doubles. | |
| static index_t | square_capacity (double a) |
| Computes the required capacity of an expansion to store the exact square of a double. | |
| static index_t | sum_capacity (const expansion &a, double b) |
| Computes the required capacity of an expansion to store the exact sum of an expansion and a double. | |
| static index_t | diff_capacity (const expansion &a, double b) |
| Computes the required capacity of an expansion to store the exact difference between an expansion and a double. | |
| static index_t | product_capacity (const expansion &a, double b) |
| Computes the required capacity of an expansion to store the exact product between an expansion and a double. | |
| static index_t | sum_capacity (const expansion &a, const expansion &b) |
| Computes the required capacity of an expansion to store the exact sum of two expansions. | |
| static index_t | sum_capacity (const expansion &a, const expansion &b, const expansion &c) |
| Computes the required capacity of an expansion to store the exact sum of three expansions. | |
| static index_t | sum_capacity (const expansion &a, const expansion &b, const expansion &c, const expansion &d) |
| Computes the required capacity of an expansion to store the exact sum of four expansions. | |
| static index_t | diff_capacity (const expansion &a, const expansion &b) |
| Computes the required capacity of an expansion to store the exact difference of two expansions. | |
| static index_t | product_capacity (const expansion &a, const expansion &b) |
| Computes the required capacity of an expansion to store the exact product of two expansions. | |
| static index_t | product_capacity (const expansion &a, const expansion &b, const expansion &c) |
| Computes the required capacity of an expansion to store the exact product of three expansions. | |
| static index_t | square_capacity (const expansion &a) |
| Computes the required capacity of an expansion to store the exact square of an expansion. | |
| static index_t | det2x2_capacity (const expansion &a11, const expansion &a12, const expansion &a21, const expansion &a22) |
| Computes the required capacity of an expansion to store an exact 2x2 determinant. | |
| static index_t | det3x3_capacity (const expansion &a11, const expansion &a12, const expansion &a13, const expansion &a21, const expansion &a22, const expansion &a23, const expansion &a31, const expansion &a32, const expansion &a33) |
| Computes the required capacity of an expansion to store an exact 3x3 determinant. | |
| static index_t | det_111_2x3_capacity (const expansion &a21, const expansion &a22, const expansion &a23, const expansion &a31, const expansion &a32, const expansion &a33) |
| Computes the required capacity of an expansion to store an exact 3x3 determinant where the first row is 1 1 1. | |
| static index_t | sq_dist_capacity (coord_index_t dim) |
| Computes the required capacity of an expansion to store the exact squared distance between two points of specified dimension. | |
| static index_t | dot_at_capacity (coord_index_t dim) |
| Computes the required capacity of an expansion to store the exact dot product between two vectors. | |
| static index_t | length2_capacity (const expansion &x, const expansion &y, const expansion &z) |
| Computes the required capacity to store the length of a 3d vector. | |
| static void | initialize () |
| Initializes the expansion class. | |
| static void | show_all_stats () |
| Show global statistics. | |
Protected Member Functions | |
| expansion & | assign_sub_product (const double *a, index_t a_length, const expansion &b) |
| Assigns a sub-product to this expansion. | |
| expansion (const expansion &rhs)=delete | |
| Expansions cannot be copied. | |
| expansion & | operator= (const expansion &rhs)=delete |
| Expansions cannot be copied. | |
Static Protected Member Functions | |
| static index_t | sub_product_capacity (index_t a_length, index_t b_length) |
| Computes the required capacity of an expansion to store an exact sub-product. | |
Friends | |
| class | expansion_nt |
Related Symbols | |
(Note that these are not member symbols.) | |
| void | two_sum (double a, double b, double &x, double &y) |
| Sums two doubles into a length 2 expansion. | |
| void | two_diff (double a, double b, double &x, double &y) |
| Subtracts two doubles into a length 2 expansion. | |
| void | split (double a, double &ahi, double &alo) |
| Splits a number into two components, ready for computing a product. | |
| void | two_product (double a, double b, double &x, double &y) |
| Multiplies two doubles into a length 2 expansion. | |
| void | square (double a, double &x, double &y) |
| Squares a number into a length 2 expansion. | |
| #define | new_expansion_on_stack(capa) (new (alloca(expansion::bytes_on_stack(capa)))expansion(capa)) |
| Allocates an expansion on the stack. | |
| #define | expansion_create(a) new_expansion_on_stack(1)->assign(a) |
| Creates an expansion from a double. | |
| #define | expansion_abs(e) new_expansion_on_stack(e.length())->assign_abs(e) |
| Creates an expansion from the absolute value of another expansion. | |
| #define | expansion_sum(a, b) |
| Computes an expansion that represents the exact sum of its arguments. | |
| #define | expansion_sum3(a, b, c) |
| Computes an expansion that represents the exact sum of its arguments. | |
| #define | expansion_sum4(a, b, c, d) |
| Computes an expansion that represents the exact sum of its arguments. | |
| #define | expansion_diff(a, b) |
| Computes an expansion that represents the exact difference of its arguments. | |
| #define | expansion_product(a, b) |
| Computes an expansion that represents the exact product of its arguments. | |
| #define | expansion_product3(a, b, c) |
| Computes an expansion that represents the exact product of its arguments. | |
| #define | expansion_square(a) |
| Computes an expansion that represents the exact square of its argument. | |
| #define | expansion_det2x2(a11, a12, a21, a22) |
| Computes an expansion that represents the exact 2x2 determinant of its arguments. | |
| #define | expansion_det3x3(a11, a12, a13, a21, a22, a23, a31, a32, a33) |
| Computes an expansion that represents the exact 3x3 determinant of its arguments. | |
| #define | expansion_det_111_2x3(a21, a22, a23, a31, a32, a33) |
| Computes an expansion that represents the exact 3x3 determinant of its arguments where the first row is 1 1 1. | |
| #define | expansion_sq_dist(a, b, dim) |
| Computes an expansion that represents the exact squared distance between its argument. | |
| #define | expansion_dot_at(a, b, c, dim) |
| Computes an expansion that represents the exact dot product dot(a-c,b-c) | |
| #define | expansion_length2(x, y, z) |
| Computes an expansion that represents the exact squared length of a 3d vector. | |
Represents numbers in arbitrary precision with a low-level API.
The three basic operations sum, difference and product are implemented, as well as some geometric functions (squared distance and dot product). The sign of an expansion can be exactly computed. expansion is useful to implement exact geometric predicates. Some of Jonathan Shewchuk's expansion manipulation functions are used. A higher-level (but less efficient) interface is available through the expansion_nt class (expansion number type, that overloads operators).
Definition at line 227 of file multi_precision.h.
|
inline |
Client code should not use this constructor.
This constructor should not be used by client code, use new_expansion_on_stack() and new_expansion_on_heap() instead. This constructor initializes this expansion's length and capacity. Note that it should be created with enough space, using placement syntax of operator new.
| [in] | capa | the capacity |
Definition at line 353 of file multi_precision.h.
Copies an expansion to this expansion.
| [in] | rhs | the expansion to be copied |
rhs) Definition at line 409 of file multi_precision.h.
|
inline |
Assigns a number to this expansion.
| [in] | a | the number |
a) Definition at line 398 of file multi_precision.h.
Copies the absolute value of an expansion to this expansion.
| [in] | rhs | the expansion to be copied |
rhs) Definition at line 423 of file multi_precision.h.
| expansion & GEO::expansion::assign_det2x2 | ( | const expansion & | a11, |
| const expansion & | a12, | ||
| const expansion & | a21, | ||
| const expansion & | a22 | ||
| ) |
Assigns a 2x2 determinant to this expansion (should not be used by client code).
Do not use directly, use expansion_det2x2() macro instead.
| [in] | a11,a12,a21,a22 | coefficients of the determinant |
a11 * a22 - a21 * a12 | expansion & GEO::expansion::assign_det3x3 | ( | const expansion & | a11, |
| const expansion & | a12, | ||
| const expansion & | a13, | ||
| const expansion & | a21, | ||
| const expansion & | a22, | ||
| const expansion & | a23, | ||
| const expansion & | a31, | ||
| const expansion & | a32, | ||
| const expansion & | a33 | ||
| ) |
Assigns a 3x3 determinant to this expansion (should not be used by client code).
Do not use directly, use expansion_det3x3() macro instead.
| [in] | a11,a12,a13,a21,a22,a23,a31,a32,a33 | coefficients of the determinant |
| expansion & GEO::expansion::assign_det_111_2x3 | ( | const expansion & | a21, |
| const expansion & | a22, | ||
| const expansion & | a23, | ||
| const expansion & | a31, | ||
| const expansion & | a32, | ||
| const expansion & | a33 | ||
| ) |
Assigns a 3x3 determinant to this expansion where the first row is 1 1 1(should not be used by client code).
Do not use directly, use expansion_det_111_3x3() macro instead.
| [in] | a21,a22,a23,a31,a32,a33 | coefficients of the determinant |
Assigns the difference between two expansions to this expansion (should not be used by client code).
Do not use directly, use expansion_diff() macro instead.
| [in] | a | first expansion |
| [in] | b | second expansion |
a - b) Assigns the difference between an expansion and a double to this expansion (should not be used by client code).
Do not use directly, use expansion_diff() macro instead.
| [in] | a | the expansion |
| [in] | b | the double |
a - b)
|
inline |
Assigns the difference of two doubles to this expansion (should not be used by client code).
Do not use directly, use expansion_diff() macro instead.
| [in] | a | first number |
| [in] | b | second number |
a - b) Definition at line 489 of file multi_precision.h.
| expansion & GEO::expansion::assign_dot_at | ( | const double * | p1, |
| const double * | p2, | ||
| const double * | p0, | ||
| coord_index_t | dim | ||
| ) |
Assigns the dot product of two vectors to this expansion (should not be used by client code).
Do not use directly, use expansion_dot_at() macro instead.
| [in] | p1 | pointer to the coordinates of a point |
| [in] | p2 | pointer to the coordinates of a point |
| [in] | p0 | pointer to the coordinates of a point |
| [in] | dim | dimension of the points |
| expansion & GEO::expansion::assign_length2 | ( | const expansion & | x, |
| const expansion & | y, | ||
| const expansion & | z | ||
| ) |
Assigns the length of a vector to this expansion (should not be used by client code). Do not call this function directly, use expansion_length2() macro instead.
| [in] | x,y,z | coordinates of the vector |
Assigns the product of two expansions to this expansion (should not be used by client code).
Do not use directly, use expansion_product() macro instead.
| [in] | a | first expansion |
| [in] | b | second expansion |
a * b) | expansion & GEO::expansion::assign_product | ( | const expansion & | a, |
| const expansion & | b, | ||
| const expansion & | c | ||
| ) |
Assigns the product of three expansions to this expansion (should not be used by client code).
Do not use directly, use expansion_product3() macro instead.
| [in] | a | first expansion |
| [in] | b | second expansion |
| [in] | c | third expansion |
a * b * c) Assigns the product between an expansion and a double to this expansion (should not be used by client code).
Do not use directly, use expansion_product() macro instead.
| [in] | a | the expansion |
| [in] | b | the double |
a * b)
|
inline |
Assigns the product of two doubles to this expansion (should not be used by client code).
Do not use directly, use expansion_product() macro instead.
| [in] | a | first number |
| [in] | b | second number |
a * b) Definition at line 521 of file multi_precision.h.
| expansion & GEO::expansion::assign_sq_dist | ( | const double * | p1, |
| const double * | p2, | ||
| coord_index_t | dim | ||
| ) |
Assigns the squared distance between two points to this expansion (should not be used by client code).
Do not use directly, use expansion_sq_dist() macro instead.
| [in] | p1 | pointer to the coordinates of the first point |
| [in] | p2 | pointer to the coordinates of the second point |
| [in] | dim | dimension of the points |
p1 and p2 Assigns the product of an expansions to this expansion (should not be used by client code).
Do not use directly, use expansion_square() macro instead.
| [in] | a | the expansion to be squared |
a * a )
|
inline |
Assigns the square of a double to this expansion (should not be used by client code).
Do not use directly, use expansion_square() macro instead.
| [in] | a | the number to be squared |
a * a) Definition at line 550 of file multi_precision.h.
|
protected |
Assigns a sub-product to this expansion.
Used by assign_product() when operating in balanced distillation mode. Recursively assembles sub-sums.
| [in] | a | a pointer to the first component of the first term |
| [in] | a_length | number of components in first term |
| [in] | b | second term |
Assigns the sum of two expansions to this expansion (should not be used by client code).
Do not use directly, use expansion_sum() macro instead.
| [in] | a | first expansion |
| [in] | b | second expansion |
a + b) | expansion & GEO::expansion::assign_sum | ( | const expansion & | a, |
| const expansion & | b, | ||
| const expansion & | c | ||
| ) |
Assigns the sum of three expansions to this expansion (should not be used by client code).
Do not use directly, use expansion_sum3() macro instead.
| [in] | a | first expansion |
| [in] | b | second expansion |
| [in] | c | third expansion |
a + b + c) | expansion & GEO::expansion::assign_sum | ( | const expansion & | a, |
| const expansion & | b, | ||
| const expansion & | c, | ||
| const expansion & | d | ||
| ) |
Assigns the sum of four expansions to this expansion (should not be used by client code).
Do not use directly, use expansion_sum4() macro instead.
| [in] | a | first expansion |
| [in] | b | second expansion |
| [in] | c | third expansion |
| [in] | d | fourth expansion |
a + b + c + d) Assigns the sum of an expansion and a double to this expansion (should not be used by client code).
Do not use directly, use expansion_sum() macro instead.
| [in] | a | the expansion |
| [in] | b | the double |
a + b)
|
inline |
Assigns the sum of two doubles to this expansion (should not be used by client code).
Do not use directly, use expansion_sum() macro instead.
| [in] | a | first number to sum |
| [in] | b | second number to sum |
a + b) Definition at line 457 of file multi_precision.h.
|
inlinestatic |
Computes the amount of memory required to store an expansion.
| [in] | capa | the required capacity |
capa. Definition at line 309 of file multi_precision.h.
|
inlinestatic |
Computes the amount of memory required to store an expansion on the stack.
Behaves like bytes() but in debug mode checks that this will fit on the stack.
| [in] | capa | the required capacity |
capa. Definition at line 329 of file multi_precision.h.
|
inline |
Gets the capacity of this expansion.
Definition at line 242 of file multi_precision.h.
Compares two expansions.
| Sign GEO::expansion::compare | ( | double | rhs | ) | const |
Compares two expansions.
|
inline |
Low level access to the array of components.
Definition at line 289 of file multi_precision.h.
|
inline |
Low level access to the array of components.
Definition at line 298 of file multi_precision.h.
|
static |
Deallocates an expansion on the heap.
| [in] | e | the expansion |
e should have been previously allocated by new_expansion_on_heap()
|
inlinestatic |
Computes the required capacity of an expansion to store an exact 2x2 determinant.
| [in] | a11,a12,a21,a22 | coefficients of the determinant |
a11 * a22 - a21 * a12 Definition at line 845 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store an exact 3x3 determinant.
| [in] | a11,a12,a13,a21,a22,a23,a31,a32,a33 | coefficients of the determinant |
Definition at line 877 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store an exact 3x3 determinant where the first row is 1 1 1.
| [in] | a21,a22,a23,a31,a32,a33 | coefficients of the determinant |
Definition at line 920 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact difference of two expansions.
| [in] | a | first expansion |
| [in] | b | second expansion |
a and b Definition at line 739 of file multi_precision.h.
Computes the required capacity of an expansion to store the exact difference between an expansion and a double.
| [in] | a | first number as an expansion |
| [in] | b | second number as a double |
a and b b. Definition at line 595 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact difference of two doubles.
| [in] | a | first number |
| [in] | b | second number |
Definition at line 473 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact dot product between two vectors.
| [in] | dim | dimension of the vectors |
dim%-dimensional vectors specified by differences of doubles. Definition at line 984 of file multi_precision.h.
|
inline |
Compares two expansions.
| true | if the two expansions represent the same number |
| false | otherwise |
Definition at line 1129 of file multi_precision.h.
|
inline |
Compares an expansion and a double.
| true | if the expansion and rhs represent the same number |
| false | otherwise |
Definition at line 1139 of file multi_precision.h.
|
inline |
Computes an approximation of the stored value in this expansion.
Definition at line 1072 of file multi_precision.h.
|
static |
Initializes the expansion class.
This function needs to be called once in the program, before using any expansion object and operation (it computes some internally-used constants).
| bool GEO::expansion::is_same_as | ( | const expansion & | rhs | ) | const |
Compares two expansions bit-by-bit.
This function may return false even if the expansion and rhs represent the same number
| true | if the two expansions are the same |
| false | otherwise |
| bool GEO::expansion::is_same_as | ( | double | rhs | ) | const |
Compares an expansion and a double bit-by-bit.
This function may return false even if the expansion and rhs represent the same number
| true | if the expansion has a single component with value rhs |
| false | otherwise |
|
inline |
Gets the length of this expansion.
Definition at line 233 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity to store the length of a 3d vector.
| [in] | x,y,z | coordinates of the vector |
Definition at line 1013 of file multi_precision.h.
|
inline |
Changes the sign of an expansion.
Definition at line 1045 of file multi_precision.h.
Allocates an expansion on the heap.
Allocates also some space for the reference counter.
| [in] | capa | capacity (i.e. maximum length) of the expansion. |
|
inline |
Low level access to a component.
ith component of this expansion Definition at line 275 of file multi_precision.h.
|
inline |
Low level access to a component.
ith component of this expansion Definition at line 261 of file multi_precision.h.
| void GEO::expansion::optimize | ( | ) |
Optimizes the internal representation without changing the represented value.
this function can reduce the length of an expansion
|
inlinestatic |
Computes the required capacity of an expansion to store the exact product of two expansions.
| [in] | a | first expansion |
| [in] | b | second expansion |
a and b Definition at line 763 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact product of three expansions.
| [in] | a | first expansion |
| [in] | b | second expansion |
| [in] | c | third expansion |
a, b and c Definition at line 790 of file multi_precision.h.
Computes the required capacity of an expansion to store the exact product between an expansion and a double.
| [in] | a | the expansion |
| [in] | b | the double |
a and b b. Definition at line 622 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact product of two doubles.
| [in] | a | first number |
| [in] | b | second number |
Definition at line 505 of file multi_precision.h.
|
inline |
Multiplies this expansion by a power of two.
| [in] | s | the factor to be used to scale this expansion. |
s should be a (possibly negative) power of two. Definition at line 1059 of file multi_precision.h.
|
inline |
Changes the length of an expansion.
| [in] | new_length | new length of the expansion |
Definition at line 251 of file multi_precision.h.
|
inline |
Displays all the components of this expansion (for debugging purposes).
| [out] | out | an output stream used to print the components |
Definition at line 1148 of file multi_precision.h.
|
inline |
Gets the sign of the expansion.
Definition at line 1084 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact squared distance between two points of specified dimension.
| [in] | dim | dimension of the points |
dim Definition at line 956 of file multi_precision.h.
Computes the required capacity of an expansion to store the exact square of an expansion.
| [in] | a | the expansion to be squared |
a * a Definition at line 818 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact square of a double.
| [in] | a | the number to be squared |
a. Definition at line 536 of file multi_precision.h.
|
inlinestaticprotected |
Computes the required capacity of an expansion to store an exact sub-product.
| [in] | a_length | number of components in first sub-expansion |
| [in] | b_length | number of components in second sub-expansion |
a_length and b_length Definition at line 1189 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact sum of two expansions.
| [in] | a | first expansion |
| [in] | b | second expansion |
a and b Definition at line 651 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact sum of three expansions.
| [in] | a | first expansion |
| [in] | b | second expansion |
| [in] | c | third expansion |
a, b and c Definition at line 676 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity of an expansion to store the exact sum of four expansions.
| [in] | a | first expansion |
| [in] | b | second expansion |
| [in] | c | third expansion |
| [in] | d | fourth expansion |
a, b, c and d Definition at line 707 of file multi_precision.h.
Computes the required capacity of an expansion to store the exact sum of an expansion and a double.
| [in] | a | first number as an expansion |
| [in] | b | second number as a double |
a and b b. Definition at line 568 of file multi_precision.h.
|
inlinestatic |
Computes the required capacity to store the sum of two doubles.
| [in] | a | first number |
| [in] | b | second number |
Definition at line 441 of file multi_precision.h.
|
inline |
Gets a string representation of this expansion.
Definition at line 1161 of file multi_precision.h.
|
related |
Creates an expansion from the absolute value of another expansion.
| [in] | e | the expansion |
Definition at line 1268 of file multi_precision.h.
|
related |
Creates an expansion from a double.
| [in] | a | the double |
Definition at line 1251 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact 2x2 determinant of its arguments.
Definition at line 1441 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact 3x3 determinant of its arguments.
Definition at line 1462 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact 3x3 determinant of its arguments where the first row is 1 1 1.
Definition at line 1484 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact difference of its arguments.
| [in] | a | a double or an expansion |
| [in] | b | a double or an expansion |
Definition at line 1357 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact dot product dot(a-c,b-c)
| [in] | a | first point (specified as a const double*) |
| [in] | b | second point (specified as a const double*) |
| [in] | c | third point (specified as a const double*) |
| [in] | dim | dimension of the points |
Definition at line 1530 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact squared length of a 3d vector.
| [in] | x,y,z | coordinates of the vector (specified as expansion) |
Definition at line 1551 of file multi_precision.h.
|
friend |
Definition at line 1234 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact product of its arguments.
| [in] | a | a double or an expansion |
| [in] | b | a double or an expansion |
Definition at line 1379 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact product of its arguments.
| [in] | a | an expansion |
| [in] | b | an expansion |
| [in] | c | an expansion |
Definition at line 1401 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact squared distance between its argument.
| [in] | a | first point (specified as a const double*) |
| [in] | b | second point (specified as a const double*) |
| [in] | dim | dimension of the points |
Definition at line 1507 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact square of its argument.
| [in] | a | a double or an expansion |
Definition at line 1421 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact sum of its arguments.
| [in] | a | a double or an expansion |
| [in] | b | a double or an expansion |
Definition at line 1288 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact sum of its arguments.
| [in] | a | an expansion |
| [in] | b | an expansion |
| [in] | c | an expansion |
Definition at line 1310 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact sum of its arguments.
| [in] | a | an expansion |
| [in] | b | an expansion |
| [in] | c | an expansion |
| [in] | d | an expansion |
Definition at line 1335 of file multi_precision.h.
|
related |
Allocates an expansion on the stack.
It can only be a macro (and not an inline function) since alloca() cannot be called from inline functions.
Definition at line 371 of file multi_precision.h.
|
related |
Splits a number into two components, ready for computing a product.
By Jonathan Shewchuk.
| [in] | a | input number. |
| [out] | ahi | split number, high-magnitude part. |
| [out] | alo | split number, low-magnitude part. |
Definition at line 143 of file multi_precision.h.
|
related |
Squares a number into a length 2 expansion.
By Jonathan Shewchuk.
| [in] | a | number to square. |
| [out] | x | high-magnitude component of the result. |
| [out] | y | low-magnitude component of the result. |
Definition at line 191 of file multi_precision.h.
|
related |
Subtracts two doubles into a length 2 expansion.
By Jonathan Shewchuk.
| [in] | a | first number. |
| [in] | b | the number to subtract from a. |
| [out] | x | high-magnitude component of the result. |
| [out] | y | low-magnitude component of the result. |
Definition at line 95 of file multi_precision.h.
|
related |
Multiplies two doubles into a length 2 expansion.
By Jonathan Shewchuk.
| [in] | a | first number to multiply. |
| [in] | b | second number to multiply. |
| [out] | x | high-magnitude component of the result. |
| [out] | y | low-magnitude component of the result. |
Definition at line 159 of file multi_precision.h.
|
related |
Sums two doubles into a length 2 expansion.
By Jonathan Shewchuk.
| [in] | a | one of the numbers to sum. |
| [in] | b | the other numbers to sum. |
| [out] | x | high-magnitude component of the result. |
| [out] | y | low-magnitude component of the result. |
Definition at line 77 of file multi_precision.h.