Geogram
Version 1.9.1
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. More... | |
index_t | capacity () const |
Gets the capacity of this expansion. More... | |
void | set_length (index_t new_length) |
Changes the length of an expansion. More... | |
const double & | operator[] (index_t i) const |
Low level access to a component. More... | |
double & | operator[] (index_t i) |
Low level access to a component. More... | |
double * | data () |
Low level access to the array of components. More... | |
const double * | data () const |
Low level access to the array of components. More... | |
expansion (index_t capa) | |
Client code should not use this constructor. More... | |
expansion & | assign (double a) |
Assigns a number to this expansion. More... | |
expansion & | assign (const expansion &rhs) |
Copies an expansion to this expansion. More... | |
expansion & | assign_abs (const expansion &rhs) |
Copies the absolute value of an expansion to this expansion. More... | |
expansion & | assign_sum (double a, double b) |
Assigns the sum of two doubles to this expansion (should not be used by client code). More... | |
expansion & | assign_diff (double a, double b) |
Assigns the difference of two doubles to this expansion (should not be used by client code). More... | |
expansion & | assign_product (double a, double b) |
Assigns the product of two doubles to this expansion (should not be used by client code). More... | |
expansion & | assign_square (double a) |
Assigns the square of a double to this expansion (should not be used by client code). More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
expansion & | assign_square (const expansion &a) |
Assigns the product of an expansions to this expansion (should not be used by client code). More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
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. More... | |
expansion & | negate () |
Changes the sign of an expansion. More... | |
expansion & | scale_fast (double s) |
Multiplies this expansion by a power of two. More... | |
double | estimate () const |
Computes an approximation of the stored value in this expansion. More... | |
Sign | sign () const |
Gets the sign of the expansion. More... | |
bool | is_same_as (const expansion &rhs) const |
Compares two expansions bit-by-bit. More... | |
bool | is_same_as (double rhs) const |
Compares an expansion and a double bit-by-bit. More... | |
Sign | compare (const expansion &rhs) const |
Compares two expansions. More... | |
Sign | compare (double rhs) const |
Compares two expansions. More... | |
bool | equals (const expansion &rhs) const |
Compares two expansions. More... | |
bool | equals (double rhs) const |
Compares an expansion and a double. More... | |
std::ostream & | show (std::ostream &out) const |
Displays all the components of this expansion (for debugging purposes). More... | |
std::string | to_string () const |
Gets a string representation of this expansion. More... | |
void | optimize () |
Optimizes the internal representation without changing the represented value. More... | |
Static Public Member Functions | |
static size_t | bytes (index_t capa) |
Computes the amount of memory required to store an expansion. More... | |
static size_t | bytes_on_stack (index_t capa) |
Computes the amount of memory required to store an expansion on the stack. More... | |
static expansion * | new_expansion_on_heap (index_t capa) |
Allocates an expansion on the heap. More... | |
static void | delete_expansion_on_heap (expansion *e) |
Deallocates an expansion on the heap. More... | |
static index_t | sum_capacity (double a, double b) |
Computes the required capacity to store the sum of two doubles. More... | |
static index_t | diff_capacity (double a, double b) |
Computes the required capacity of an expansion to store the exact difference of two doubles. More... | |
static index_t | product_capacity (double a, double b) |
Computes the required capacity of an expansion to store the exact product of two doubles. More... | |
static index_t | square_capacity (double a) |
Computes the required capacity of an expansion to store the exact square of a double. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
static index_t | square_capacity (const expansion &a) |
Computes the required capacity of an expansion to store the exact square of an expansion. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
static void | initialize () |
Initializes the expansion class. More... | |
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. More... | |
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. More... | |
Friends | |
class | expansion_nt |
Related Functions | |
(Note that these are not member functions.) | |
void | two_sum (double a, double b, double &x, double &y) |
Sums two doubles into a length 2 expansion. More... | |
void | two_diff (double a, double b, double &x, double &y) |
Subtracts two doubles into a length 2 expansion. More... | |
void | split (double a, double &ahi, double &alo) |
Splits a number into two components, ready for computing a product. More... | |
void | two_product (double a, double b, double &x, double &y) |
Multiplies two doubles into a length 2 expansion. More... | |
void | square (double a, double &x, double &y) |
Squares a number into a length 2 expansion. More... | |
#define | new_expansion_on_stack(capa) (new (alloca(expansion::bytes_on_stack(capa)))expansion(capa)) |
Allocates an expansion on the stack. More... | |
#define | expansion_create(a) new_expansion_on_stack(1)->assign(a) |
Creates an expansion from a double. More... | |
#define | expansion_abs(e) new_expansion_on_stack(e.length())->assign_abs(e) |
Creates an expansion from the absolute value of another expansion. More... | |
#define | expansion_sum(a, b) |
Computes an expansion that represents the exact sum of its arguments. More... | |
#define | expansion_sum3(a, b, c) |
Computes an expansion that represents the exact sum of its arguments. More... | |
#define | expansion_sum4(a, b, c, d) |
Computes an expansion that represents the exact sum of its arguments. More... | |
#define | expansion_diff(a, b) |
Computes an expansion that represents the exact difference of its arguments. More... | |
#define | expansion_product(a, b) |
Computes an expansion that represents the exact product of its arguments. More... | |
#define | expansion_product3(a, b, c) |
Computes an expansion that represents the exact product of its arguments. More... | |
#define | expansion_square(a) |
Computes an expansion that represents the exact square of its argument. More... | |
#define | expansion_det2x2(a11, a12, a21, a22) |
Computes an expansion that represents the exact 2x2 determinant of its arguments. More... | |
#define | expansion_det3x3(a11, a12, a13, a21, a22, a23, a31, a32, a33) |
Computes an expansion that represents the exact 3x3 determinant of its arguments. More... | |
#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. More... | |
#define | expansion_sq_dist(a, b, dim) |
Computes an expansion that represents the exact squared distance between its argument. More... | |
#define | expansion_dot_at(a, b, c, dim) |
Computes an expansion that represents the exact dot product dot(a-c,b-c) More... | |
#define | expansion_length2(x, y, z) |
Computes an expansion that represents the exact squared length of a 3d vector. More... | |
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 197 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 323 of file multi_precision.h.
Copies an expansion to this expansion.
[in] | rhs | the expansion to be copied |
rhs
) Definition at line 379 of file multi_precision.h.
|
inline |
Assigns a number to this expansion.
[in] | a | the number |
a
) Definition at line 368 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 393 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 459 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 491 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 520 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 427 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 279 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 299 of file multi_precision.h.
|
inline |
Gets the capacity of this expansion.
Definition at line 212 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 259 of file multi_precision.h.
|
inline |
Low level access to the array of components.
Definition at line 268 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 815 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 847 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 890 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 709 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 565 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 443 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 954 of file multi_precision.h.
|
inline |
Compares two expansions.
true | if the two expansions represent the same number |
false | otherwise |
Definition at line 1099 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 1109 of file multi_precision.h.
|
inline |
Computes an approximation of the stored value in this expansion.
Definition at line 1042 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 203 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 983 of file multi_precision.h.
|
inline |
Changes the sign of an expansion.
Definition at line 1015 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 245 of file multi_precision.h.
|
inline |
Low level access to a component.
ith
component of this expansion Definition at line 231 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 733 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 760 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 592 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 475 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 1029 of file multi_precision.h.
|
inline |
Changes the length of an expansion.
[in] | new_length | new length of the expansion |
Definition at line 221 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 1118 of file multi_precision.h.
|
inline |
Gets the sign of the expansion.
Definition at line 1054 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 926 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 788 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 506 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 1159 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 621 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 646 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 677 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 538 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 411 of file multi_precision.h.
|
inline |
Gets a string representation of this expansion.
Definition at line 1131 of file multi_precision.h.
|
related |
Creates an expansion from the absolute value of another expansion.
[in] | e | the expansion |
Definition at line 1238 of file multi_precision.h.
|
related |
Creates an expansion from a double.
[in] | a | the double |
Definition at line 1221 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact 2x2 determinant of its arguments.
Definition at line 1411 of file multi_precision.h.
|
related |
Computes an expansion that represents the exact 3x3 determinant of its arguments.
Definition at line 1432 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 1454 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 1327 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 1500 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 1521 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 1349 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 1371 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 1477 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 1391 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 1258 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 1280 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 1305 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 341 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 113 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 161 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 129 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.