Geogram  Version 1.8.9-rc
A programming library of geometric algorithms
GEO::expansion Class Reference

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...
 
expansionassign (double a)
 Assigns a number to this expansion. More...
 
expansionassign (const expansion &rhs)
 Copies an expansion to this expansion. More...
 
expansionassign_abs (const expansion &rhs)
 Copies the absolute value of an expansion to this expansion. More...
 
expansionassign_sum (double a, double b)
 Assigns the sum of two doubles to this expansion (should not be used by client code). More...
 
expansionassign_diff (double a, double b)
 Assigns the difference of two doubles to this expansion (should not be used by client code). More...
 
expansionassign_product (double a, double b)
 Assigns the product of two doubles to this expansion (should not be used by client code). More...
 
expansionassign_square (double a)
 Assigns the square of a double to this expansion (should not be used by client code). More...
 
expansionassign_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...
 
expansionassign_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...
 
expansionassign_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...
 
expansionassign_sum (const expansion &a, const expansion &b)
 Assigns the sum of two expansions to this expansion (should not be used by client code). More...
 
expansionassign_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...
 
expansionassign_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...
 
expansionassign_diff (const expansion &a, const expansion &b)
 Assigns the difference between two expansions to this expansion (should not be used by client code). More...
 
expansionassign_product (const expansion &a, const expansion &b)
 Assigns the product of two expansions to this expansion (should not be used by client code). More...
 
expansionassign_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...
 
expansionassign_square (const expansion &a)
 Assigns the product of an expansions to this expansion (should not be used by client code). More...
 
expansionassign_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...
 
expansionassign_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...
 
expansionassign_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...
 
expansionassign_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...
 
expansionassign_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...
 
expansionassign_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...
 
expansionnegate ()
 Changes the sign of an expansion. More...
 
expansionscale_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 expansionnew_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

expansionassign_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.
 
expansionoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ expansion()

GEO::expansion::expansion ( index_t  capa)
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.

Parameters
[in]capathe capacity

Definition at line 323 of file multi_precision.h.

Member Function Documentation

◆ assign() [1/2]

expansion& GEO::expansion::assign ( const expansion rhs)
inline

Copies an expansion to this expansion.

Parameters
[in]rhsthe expansion to be copied
Returns
the new value of this expansion (rhs)

Definition at line 379 of file multi_precision.h.

◆ assign() [2/2]

expansion& GEO::expansion::assign ( double  a)
inline

Assigns a number to this expansion.

Parameters
[in]athe number
Returns
the new value of this expansion (a)

Definition at line 368 of file multi_precision.h.

◆ assign_abs()

expansion& GEO::expansion::assign_abs ( const expansion rhs)
inline

Copies the absolute value of an expansion to this expansion.

Parameters
[in]rhsthe expansion to be copied
Returns
the new value of this expansion that is, abs(rhs)

Definition at line 393 of file multi_precision.h.

◆ assign_det2x2()

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.

Parameters
[in]a11,a12,a21,a22coefficients of the determinant
Returns
the new value of this expansion, with the exact determinant a11 * a22 - a21 * a12
Precondition
capacity() >= det_2x2_capacity(a11,a12,,a21,a22)

◆ assign_det3x3()

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.

Parameters
[in]a11,a12,a13,a21,a22,a23,a31,a32,a33coefficients of the determinant
Returns
the new value of this expansion, with the exact 3x3 determinant
Precondition
capacity() >= det_3x3_capacity(a11,a12,a13,a21,a22,a23,a31,a32,a33)

◆ assign_det_111_2x3()

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.

Parameters
[in]a21,a22,a23,a31,a32,a33coefficients of the determinant
Returns
the new value of this expansion, with the exact 3x3 determinant
Precondition
capacity() >= det__111_2x3capacity(a21,a22,a23,a31,a32,a33)

◆ assign_diff() [1/3]

expansion& GEO::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).

Do not use directly, use expansion_diff() macro instead.

Parameters
[in]afirst expansion
[in]bsecond expansion
Returns
the new value of this expansion (a - b)
Precondition
capacity() >= diff_capacity(a,b)

◆ assign_diff() [2/3]

expansion& GEO::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).

Do not use directly, use expansion_diff() macro instead.

Parameters
[in]athe expansion
[in]bthe double
Returns
the new value of this expansion (a - b)
Precondition
capacity() >= diff_capacity(a,b)

◆ assign_diff() [3/3]

expansion& GEO::expansion::assign_diff ( double  a,
double  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.

Parameters
[in]afirst number
[in]bsecond number
Returns
the new value of this expansion (a - b)
Precondition
capacity() >= diff_capacity(a,b)

Definition at line 459 of file multi_precision.h.

◆ assign_dot_at()

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.

Parameters
[in]p1pointer to the coordinates of a point
[in]p2pointer to the coordinates of a point
[in]p0pointer to the coordinates of a point
[in]dimdimension of the points
Returns
the new value of this expansion, with the dot product (p1-p0).(p2-p0)

◆ assign_length2()

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.

Parameters
[in]x,y,zcoordinates of the vector
Returns
the new value of this expansion, with the squared length of [x,y,z]

◆ assign_product() [1/4]

expansion& GEO::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).

Do not use directly, use expansion_product() macro instead.

Parameters
[in]afirst expansion
[in]bsecond expansion
Returns
the new value of this expansion (a * b)
Precondition
capacity() >= product_capacity(a,b)

◆ assign_product() [2/4]

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.

Parameters
[in]afirst expansion
[in]bsecond expansion
[in]cthird expansion
Returns
the new value of this expansion (a * b * c)
Precondition
capacity() >= product_capacity(a,b,c)

◆ assign_product() [3/4]

expansion& GEO::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).

Do not use directly, use expansion_product() macro instead.

Parameters
[in]athe expansion
[in]bthe double
Returns
the new value of this expansion (a * b)
Precondition
capacity() >= product_capacity(a,b)

◆ assign_product() [4/4]

expansion& GEO::expansion::assign_product ( double  a,
double  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.

Parameters
[in]afirst number
[in]bsecond number
Returns
the new value of this expansion (a * b)
Precondition
capacity() >= product_capacity(a,b)

Definition at line 491 of file multi_precision.h.

◆ assign_sq_dist()

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.

Parameters
[in]p1pointer to the coordinates of the first point
[in]p2pointer to the coordinates of the second point
[in]dimdimension of the points
Returns
the new value of this expansion, with the squared distance between p1 and p2
Precondition
capacity() >= sq_dist_capacity(dim)

◆ assign_square() [1/2]

expansion& GEO::expansion::assign_square ( const expansion a)

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.

Parameters
[in]athe expansion to be squared
Returns
the new value of this expansion (a * a )
Precondition
capacity() >= square_capacity(a)

◆ assign_square() [2/2]

expansion& GEO::expansion::assign_square ( double  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.

Parameters
[in]athe number to be squared
Returns
the new value of this expansion (a * a)
Precondition
capacity() >= square_capacity(a)

Definition at line 520 of file multi_precision.h.

◆ assign_sub_product()

expansion& GEO::expansion::assign_sub_product ( const double *  a,
index_t  a_length,
const expansion b 
)
protected

Assigns a sub-product to this expansion.

Used by assign_product() when operating in balanced distillation mode. Recursively assembles sub-sums.

Parameters
[in]aa pointer to the first component of the first term
[in]a_lengthnumber of components in first term
[in]bsecond term
Returns
the new value of this expansion, with [a1...a_length]*b.

◆ assign_sum() [1/5]

expansion& GEO::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).

Do not use directly, use expansion_sum() macro instead.

Parameters
[in]afirst expansion
[in]bsecond expansion
Returns
the new value of this expansion (a + b)
Precondition
capacity() >= sum_capacity(a,b)

◆ assign_sum() [2/5]

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.

Parameters
[in]afirst expansion
[in]bsecond expansion
[in]cthird expansion
Returns
the new value of this expansion (a + b + c)
Precondition
capacity() >= sum_capacity(a,b,c)

◆ assign_sum() [3/5]

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.

Parameters
[in]afirst expansion
[in]bsecond expansion
[in]cthird expansion
[in]dfourth expansion
Returns
the new value of this expansion (a + b + c + d)
Precondition
capacity() >= sum_capacity(a,b,c,d)

◆ assign_sum() [4/5]

expansion& GEO::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).

Do not use directly, use expansion_sum() macro instead.

Parameters
[in]athe expansion
[in]bthe double
Returns
the new value of this expansion (a + b)
Precondition
capacity() >= sum_capacity(a,b)

◆ assign_sum() [5/5]

expansion& GEO::expansion::assign_sum ( double  a,
double  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.

Parameters
[in]afirst number to sum
[in]bsecond number to sum
Returns
the new value of this expansion (a + b)
Precondition
capacity() >= sum_capacity(a,b)

Definition at line 427 of file multi_precision.h.

◆ bytes()

static size_t GEO::expansion::bytes ( index_t  capa)
inlinestatic

Computes the amount of memory required to store an expansion.

Parameters
[in]capathe required capacity
Returns
the total number of bytes required to store an expansion of capacity capa.

Definition at line 279 of file multi_precision.h.

◆ bytes_on_stack()

static size_t GEO::expansion::bytes_on_stack ( index_t  capa)
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.

Parameters
[in]capathe required capacity
Returns
the total number of bytes required to store an expansion of capacity capa.

Definition at line 299 of file multi_precision.h.

◆ capacity()

index_t GEO::expansion::capacity ( ) const
inline

Gets the capacity of this expansion.

Returns
the maximum number of components that can be stored in this expansion

Definition at line 212 of file multi_precision.h.

◆ compare() [1/2]

Sign GEO::expansion::compare ( const expansion rhs) const

Compares two expansions.

Returns
the sign of this expansion minus rhs.

◆ compare() [2/2]

Sign GEO::expansion::compare ( double  rhs) const

Compares two expansions.

Returns
the sign of this expansion minus rhs.

◆ data() [1/2]

double* GEO::expansion::data ( )
inline

Low level access to the array of components.

Returns
a pointer to the array that stores the components

Definition at line 259 of file multi_precision.h.

◆ data() [2/2]

const double* GEO::expansion::data ( ) const
inline

Low level access to the array of components.

Returns
a const pointer to the array that stores the components

Definition at line 268 of file multi_precision.h.

◆ delete_expansion_on_heap()

static void GEO::expansion::delete_expansion_on_heap ( expansion e)
static

Deallocates an expansion on the heap.

Parameters
[in]ethe expansion
Precondition
e should have been previously allocated by new_expansion_on_heap()

◆ det2x2_capacity()

static index_t GEO::expansion::det2x2_capacity ( const expansion a11,
const expansion a12,
const expansion a21,
const expansion a22 
)
inlinestatic

Computes the required capacity of an expansion to store an exact 2x2 determinant.

Parameters
[in]a11,a12,a21,a22coefficients of the determinant
Returns
the required capacity of an expansion to store the exact determinant a11 * a22 - a21 * a12

Definition at line 815 of file multi_precision.h.

◆ det3x3_capacity()

static index_t GEO::expansion::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 
)
inlinestatic

Computes the required capacity of an expansion to store an exact 3x3 determinant.

Parameters
[in]a11,a12,a13,a21,a22,a23,a31,a32,a33coefficients of the determinant
Returns
the required capacity of an expansion to store the exact value of the determinant

Definition at line 847 of file multi_precision.h.

◆ det_111_2x3_capacity()

static index_t GEO::expansion::det_111_2x3_capacity ( const expansion a21,
const expansion a22,
const expansion a23,
const expansion a31,
const expansion a32,
const expansion a33 
)
inlinestatic

Computes the required capacity of an expansion to store an exact 3x3 determinant where the first row is 1 1 1.

Parameters
[in]a21,a22,a23,a31,a32,a33coefficients of the determinant
Returns
the required capacity of an expansion to store the exact value of the determinant

Definition at line 890 of file multi_precision.h.

◆ diff_capacity() [1/3]

static index_t GEO::expansion::diff_capacity ( const expansion a,
const expansion b 
)
inlinestatic

Computes the required capacity of an expansion to store the exact difference of two expansions.

Parameters
[in]afirst expansion
[in]bsecond expansion
Returns
the required capacity of an expansion to store the exact difference between a and b

Definition at line 709 of file multi_precision.h.

◆ diff_capacity() [2/3]

static index_t GEO::expansion::diff_capacity ( const expansion a,
double  b 
)
inlinestatic

Computes the required capacity of an expansion to store the exact difference between an expansion and a double.

Parameters
[in]afirst number as an expansion
[in]bsecond number as a double
Returns
the required capacity of an expansion to store the exact difference of a and b
Note
The result does not depend on the value of the double argument b.

Definition at line 565 of file multi_precision.h.

◆ diff_capacity() [3/3]

static index_t GEO::expansion::diff_capacity ( double  a,
double  b 
)
inlinestatic

Computes the required capacity of an expansion to store the exact difference of two doubles.

Parameters
[in]afirst number
[in]bsecond number
Returns
the required capacity of an expansion to store the exact difference of two doubles
Note
The result does not depend on the values of the two numbers.

Definition at line 443 of file multi_precision.h.

◆ dot_at_capacity()

static index_t GEO::expansion::dot_at_capacity ( coord_index_t  dim)
inlinestatic

Computes the required capacity of an expansion to store the exact dot product between two vectors.

Parameters
[in]dimdimension of the vectors
Returns
the required capacity of an expansion to store the dot product between two dim%-dimensional vectors specified by differences of doubles.

Definition at line 954 of file multi_precision.h.

◆ equals() [1/2]

bool GEO::expansion::equals ( const expansion rhs) const
inline

Compares two expansions.

Return values
trueif the two expansions represent the same number
falseotherwise

Definition at line 1099 of file multi_precision.h.

◆ equals() [2/2]

bool GEO::expansion::equals ( double  rhs) const
inline

Compares an expansion and a double.

Return values
trueif the expansion and rhs represent the same number
falseotherwise

Definition at line 1109 of file multi_precision.h.

◆ estimate()

double GEO::expansion::estimate ( ) const
inline

Computes an approximation of the stored value in this expansion.

Returns
an approximation of the stored value.

Definition at line 1042 of file multi_precision.h.

◆ initialize()

static void GEO::expansion::initialize ( )
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).

◆ is_same_as() [1/2]

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

Return values
trueif the two expansions are the same
falseotherwise

◆ is_same_as() [2/2]

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

Return values
trueif the expansion has a single component with value rhs
falseotherwise

◆ length()

index_t GEO::expansion::length ( ) const
inline

Gets the length of this expansion.

Returns
the number of components of this expansion

Definition at line 203 of file multi_precision.h.

◆ length2_capacity()

static index_t GEO::expansion::length2_capacity ( const expansion x,
const expansion y,
const expansion z 
)
inlinestatic

Computes the required capacity to store the length of a 3d vector.

Parameters
[in]x,y,zcoordinates of the vector
Returns
the capacity required to store the squared norm of [x,y,z]

Definition at line 983 of file multi_precision.h.

◆ negate()

expansion& GEO::expansion::negate ( )
inline

Changes the sign of an expansion.

Returns
the new value of this expansion

Definition at line 1015 of file multi_precision.h.

◆ new_expansion_on_heap()

static expansion* GEO::expansion::new_expansion_on_heap ( index_t  capa)
static

Allocates an expansion on the heap.

Allocates also some space for the reference counter.

Parameters
[in]capacapacity (i.e. maximum length) of the expansion.
Returns
a pointer to the newly allocated expansion

◆ operator[]() [1/2]

double& GEO::expansion::operator[] ( index_t  i)
inline

Low level access to a component.

Returns
a reference to the ith component of this expansion

Definition at line 245 of file multi_precision.h.

◆ operator[]() [2/2]

const double& GEO::expansion::operator[] ( index_t  i) const
inline

Low level access to a component.

Returns
a const reference to the ith component of this expansion

Definition at line 231 of file multi_precision.h.

◆ optimize()

void GEO::expansion::optimize ( )

Optimizes the internal representation without changing the represented value.

this function can reduce the length of an expansion

◆ product_capacity() [1/4]

static index_t GEO::expansion::product_capacity ( const expansion a,
const expansion b 
)
inlinestatic

Computes the required capacity of an expansion to store the exact product of two expansions.

Parameters
[in]afirst expansion
[in]bsecond expansion
Returns
the required capacity of an expansion to store the exact product of a and b

Definition at line 733 of file multi_precision.h.

◆ product_capacity() [2/4]

static index_t GEO::expansion::product_capacity ( const expansion a,
const expansion b,
const expansion c 
)
inlinestatic

Computes the required capacity of an expansion to store the exact product of three expansions.

Parameters
[in]afirst expansion
[in]bsecond expansion
[in]cthird expansion
Returns
the required capacity of an expansion to store the exact product of a, b and c

Definition at line 760 of file multi_precision.h.

◆ product_capacity() [3/4]

static index_t GEO::expansion::product_capacity ( const expansion a,
double  b 
)
inlinestatic

Computes the required capacity of an expansion to store the exact product between an expansion and a double.

Parameters
[in]athe expansion
[in]bthe double
Returns
the required capacity of an expansion to store the exact product between a and b
Note
The result does not depend on the value of the double argument b.

Definition at line 592 of file multi_precision.h.

◆ product_capacity() [4/4]

static index_t GEO::expansion::product_capacity ( double  a,
double  b 
)
inlinestatic

Computes the required capacity of an expansion to store the exact product of two doubles.

Parameters
[in]afirst number
[in]bsecond number
Returns
the required capacity of an expansion to store the exact product of two doubles
Note
The result does not depend on the values of the two numbers.

Definition at line 475 of file multi_precision.h.

◆ scale_fast()

expansion& GEO::expansion::scale_fast ( double  s)
inline

Multiplies this expansion by a power of two.

Parameters
[in]sthe factor to be used to scale this expansion.
Returns
the new value of this expansion
Note
Does not check for overflows/underflows
Precondition
s should be a (possibly negative) power of two.

Definition at line 1029 of file multi_precision.h.

◆ set_length()

void GEO::expansion::set_length ( index_t  new_length)
inline

Changes the length of an expansion.

Parameters
[in]new_lengthnew length of the expansion
Precondition
new_length <= capacity()

Definition at line 221 of file multi_precision.h.

◆ show()

std::ostream& GEO::expansion::show ( std::ostream &  out) const
inline

Displays all the components of this expansion (for debugging purposes).

Parameters
[out]outan output stream used to print the components

Definition at line 1118 of file multi_precision.h.

◆ sign()

Sign GEO::expansion::sign ( ) const
inline

Gets the sign of the expansion.

Returns
the sign of this expansion, computed exactly.

Definition at line 1054 of file multi_precision.h.

◆ sq_dist_capacity()

static index_t GEO::expansion::sq_dist_capacity ( coord_index_t  dim)
inlinestatic

Computes the required capacity of an expansion to store the exact squared distance between two points of specified dimension.

Parameters
[in]dimdimension of the points
Returns
the required capacity of an expansion to store the exact squared distance between points of dimension dim

Definition at line 926 of file multi_precision.h.

◆ square_capacity() [1/2]

static index_t GEO::expansion::square_capacity ( const expansion a)
inlinestatic

Computes the required capacity of an expansion to store the exact square of an expansion.

Parameters
[in]athe expansion to be squared
Returns
the required capacity of an expansion to store the exact square a * a

Definition at line 788 of file multi_precision.h.

◆ square_capacity() [2/2]

static index_t GEO::expansion::square_capacity ( double  a)
inlinestatic

Computes the required capacity of an expansion to store the exact square of a double.

Parameters
[in]athe number to be squared
Returns
the required capacity of an expansion to store the exact square of a double.
Note
The result does not depend on the value of the number a.

Definition at line 506 of file multi_precision.h.

◆ sub_product_capacity()

static index_t GEO::expansion::sub_product_capacity ( index_t  a_length,
index_t  b_length 
)
inlinestaticprotected

Computes the required capacity of an expansion to store an exact sub-product.

Parameters
[in]a_lengthnumber of components in first sub-expansion
[in]b_lengthnumber of components in second sub-expansion
Returns
the required capacity of an expansion to store the exact product of two expansions of lengths a_length and b_length

Definition at line 1159 of file multi_precision.h.

◆ sum_capacity() [1/5]

static index_t GEO::expansion::sum_capacity ( const expansion a,
const expansion b 
)
inlinestatic

Computes the required capacity of an expansion to store the exact sum of two expansions.

Parameters
[in]afirst expansion
[in]bsecond expansion
Returns
the required capacity of an expansion to store the exact sum of a and b

Definition at line 621 of file multi_precision.h.

◆ sum_capacity() [2/5]

static index_t GEO::expansion::sum_capacity ( const expansion a,
const expansion b,
const expansion c 
)
inlinestatic

Computes the required capacity of an expansion to store the exact sum of three expansions.

Parameters
[in]afirst expansion
[in]bsecond expansion
[in]cthird expansion
Returns
the required capacity of an expansion to store the exact sum of a, b and c

Definition at line 646 of file multi_precision.h.

◆ sum_capacity() [3/5]

static index_t GEO::expansion::sum_capacity ( const expansion a,
const expansion b,
const expansion c,
const expansion d 
)
inlinestatic

Computes the required capacity of an expansion to store the exact sum of four expansions.

Parameters
[in]afirst expansion
[in]bsecond expansion
[in]cthird expansion
[in]dfourth expansion
Returns
the required capacity of an expansion to store the exact sum of a, b, c and d

Definition at line 677 of file multi_precision.h.

◆ sum_capacity() [4/5]

static index_t GEO::expansion::sum_capacity ( const expansion a,
double  b 
)
inlinestatic

Computes the required capacity of an expansion to store the exact sum of an expansion and a double.

Parameters
[in]afirst number as an expansion
[in]bsecond number as a double
Returns
the required capacity of an expansion to store the exact sum of a and b
Note
The result does not depend on the value of the double argument b.

Definition at line 538 of file multi_precision.h.

◆ sum_capacity() [5/5]

static index_t GEO::expansion::sum_capacity ( double  a,
double  b 
)
inlinestatic

Computes the required capacity to store the sum of two doubles.

Parameters
[in]afirst number
[in]bsecond number
Returns
the required capacity of an expansion to store the exact sum of two doubles
Note
The result does not depend on the values of the two numbers.

Definition at line 411 of file multi_precision.h.

◆ to_string()

std::string GEO::expansion::to_string ( ) const
inline

Gets a string representation of this expansion.

Returns
a string with the length and components

Definition at line 1131 of file multi_precision.h.

Friends And Related Function Documentation

◆ expansion_abs

#define expansion_abs (   e)     new_expansion_on_stack(e.length())->assign_abs(e)
related

Creates an expansion from the absolute value of another expansion.

Parameters
[in]ethe expansion
Returns
a reference to an expansion, allocated on the stack.
const expansion& e1 = expansion_abs(e);
#define expansion_abs(e)
Creates an expansion from the absolute value of another expansion.
expansion(index_t capa)
Client code should not use this constructor.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1238 of file multi_precision.h.

◆ expansion_create

#define expansion_create (   a)     new_expansion_on_stack(1)->assign(a)
related

Creates an expansion from a double.

Parameters
[in]athe double
Returns
a reference to an expansion, allocated on the stack.
const expansion& e1 = expansion_create(a);
#define expansion_create(a)
Creates an expansion from a double.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1221 of file multi_precision.h.

◆ expansion_det2x2

#define expansion_det2x2 (   a11,
  a12,
  a21,
  a22 
)
related
Value:
expansion::det2x2_capacity(a11, a12, a21, a22) \
)->assign_det2x2(a11, a12, a21, a22)
#define new_expansion_on_stack(capa)
Allocates an expansion on the stack.
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.

Computes an expansion that represents the exact 2x2 determinant of its arguments.

Returns
a reference to an expansion, allocated on the stack.
const expansion& a11 = ...;
const expansion& a12 = ...;
const expansion& a21 = ...;
const expansion& a22 = ...;
expansion& d12 = expansion_set2x2(a11,a12,a21,a22);

Definition at line 1411 of file multi_precision.h.

◆ expansion_det3x3

#define expansion_det3x3 (   a11,
  a12,
  a13,
  a21,
  a22,
  a23,
  a31,
  a32,
  a33 
)
related
Value:
expansion::det3x3_capacity(a11,a12,a13,a21,a22,a23,a31,a32,a33) \
)->assign_det3x3(a11, a12, a13, a21, a22, a23, a31, a32, a33)
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.

Computes an expansion that represents the exact 3x3 determinant of its arguments.

Returns
a reference to an expansion, allocated on the stack.
const expansion& a11 = ...;
...
const expansion& a33 = ...;
a11,a12,a13,a21,a22,a23,a31,a32,a33
);
#define expansion_det3x3(a11, a12, a13, a21, a22, a23, a31, a32, a33)
Computes an expansion that represents the exact 3x3 determinant of its arguments.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1432 of file multi_precision.h.

◆ expansion_det_111_2x3

#define expansion_det_111_2x3 (   a21,
  a22,
  a23,
  a31,
  a32,
  a33 
)
related
Value:
expansion::det_111_2x3_capacity(a21, a22, a23, a31, a32, a33) \
)->assign_det_111_2x3(a21, a22, a23, a31, a32, a33)
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 ...

Computes an expansion that represents the exact 3x3 determinant of its arguments where the first row is 1 1 1.

Returns
a reference to an expansion, allocated on the stack.
const expansion& a21 = ...;
...
const expansion& a33 = ...;
a21,a22,a23,a31,a32,a33
);
#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 ...
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1454 of file multi_precision.h.

◆ expansion_diff

#define expansion_diff (   a,
 
)
related
Value:
)->assign_diff(a, b)
static index_t diff_capacity(double a, double b)
Computes the required capacity of an expansion to store the exact difference of two doubles.

Computes an expansion that represents the exact difference of its arguments.

Parameters
[in]aa double or an expansion
[in]ba double or an expansion
Returns
a reference to an expansion, allocated on the stack.
expansion& e1 = ...;
expansion& e2 = ...;
double x = ...;
#define expansion_diff(a, b)
Computes an expansion that represents the exact difference of its arguments.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1327 of file multi_precision.h.

◆ expansion_dot_at

#define expansion_dot_at (   a,
  b,
  c,
  dim 
)
related
Value:
)->assign_dot_at(a, b, c, dim)
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.

Computes an expansion that represents the exact dot product dot(a-c,b-c)

Parameters
[in]afirst point (specified as a const double*)
[in]bsecond point (specified as a const double*)
[in]cthird point (specified as a const double*)
[in]dimdimension of the points
Returns
a reference to an expansion, allocated on the stack.
const double* p1 = ...;
const double* p2 = ...;
const double* p0 = ...;
expansion& dot12 = expansion_dot_at(p1,p2,p0,3);
#define expansion_dot_at(a, b, c, dim)
Computes an expansion that represents the exact dot product dot(a-c,b-c)
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1500 of file multi_precision.h.

◆ expansion_length2

#define expansion_length2 (   x,
  y,
 
)
related
Value:
)->assign_length2(x,y,z)
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.

Computes an expansion that represents the exact squared length of a 3d vector.

Parameters
[in]x,y,zcoordinates of the vector (specified as expansion)
Returns
a reference to an expansion, allocated on the stack.
const expansion& x = ...;
const expansion& y = ...;
const expansion& z = ...;
#define expansion_length2(x, y, z)
Computes an expansion that represents the exact squared length of a 3d vector.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1521 of file multi_precision.h.

◆ expansion_product

#define expansion_product (   a,
 
)
related
Value:
)->assign_product(a, b)
static index_t product_capacity(double a, double b)
Computes the required capacity of an expansion to store the exact product of two doubles.

Computes an expansion that represents the exact product of its arguments.

Parameters
[in]aa double or an expansion
[in]ba double or an expansion
Returns
a reference to an expansion, allocated on the stack.
expansion& e1 = ...;
expansion& e2 = ...;
double x = ...;
#define expansion_product(a, b)
Computes an expansion that represents the exact product of its arguments.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1349 of file multi_precision.h.

◆ expansion_product3

#define expansion_product3 (   a,
  b,
 
)
related
Value:
)->assign_product(a, b, c)

Computes an expansion that represents the exact product of its arguments.

Parameters
[in]aan expansion
[in]ban expansion
[in]can expansion
Returns
a reference to an expansion, allocated on the stack.
expansion& e1 = ...;
expansion& e2 = ...;
expansion& e3 = ...;
expansion& e4 = expansion_product3(e1,e2,e3);
#define expansion_product3(a, b, c)
Computes an expansion that represents the exact product of its arguments.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1371 of file multi_precision.h.

◆ expansion_sq_dist

#define expansion_sq_dist (   a,
  b,
  dim 
)
related
Value:
)->assign_sq_dist(a, b, dim)
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...

Computes an expansion that represents the exact squared distance between its argument.

Parameters
[in]afirst point (specified as a const double*)
[in]bsecond point (specified as a const double*)
[in]dimdimension of the points
Returns
a reference to an expansion, allocated on the stack.
const double* p1 = ...;
const double* p2 = ...;
expansion& d12 = expansion_sq_dist(p1,p2,3);
#define expansion_sq_dist(a, b, dim)
Computes an expansion that represents the exact squared distance between its argument.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1477 of file multi_precision.h.

◆ expansion_square

#define expansion_square (   a)
related
Value:
)->assign_square(a)
static index_t square_capacity(double a)
Computes the required capacity of an expansion to store the exact square of a double.

Computes an expansion that represents the exact square of its argument.

Parameters
[in]aa double or an expansion
Returns
a reference to an expansion, allocated on the stack.
expansion& e1 = ...;
double x = ...;
#define expansion_square(a)
Computes an expansion that represents the exact square of its argument.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1391 of file multi_precision.h.

◆ expansion_sum

#define expansion_sum (   a,
 
)
related
Value:
)->assign_sum(a, b)
static index_t sum_capacity(double a, double b)
Computes the required capacity to store the sum of two doubles.

Computes an expansion that represents the exact sum of its arguments.

Parameters
[in]aa double or an expansion
[in]ba double or an expansion
Returns
a reference to an expansion, allocated on the stack.
expansion& e1 = ...;
expansion& e2 = ...;
expansion& e3 = expansion_sum(e1,e2);
double x = ...;
#define expansion_sum(a, b)
Computes an expansion that represents the exact sum of its arguments.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1258 of file multi_precision.h.

◆ expansion_sum3

#define expansion_sum3 (   a,
  b,
 
)
related
Value:
)->assign_sum(a, b, c)

Computes an expansion that represents the exact sum of its arguments.

Parameters
[in]aan expansion
[in]ban expansion
[in]can expansion
Returns
a reference to an expansion, allocated on the stack.
expansion& e1 = ...;
expansion& e2 = ...;
expansion& e3 = ...;
expansion& e4 = expansion_sum3(e1,e2,e3);
#define expansion_sum3(a, b, c)
Computes an expansion that represents the exact sum of its arguments.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1280 of file multi_precision.h.

◆ expansion_sum4

#define expansion_sum4 (   a,
  b,
  c,
 
)
related
Value:
)->assign_sum(a, b, c, d)

Computes an expansion that represents the exact sum of its arguments.

Parameters
[in]aan expansion
[in]ban expansion
[in]can expansion
[in]dan expansion
Returns
a reference to an expansion, allocated on the stack.
expansion& e1 = ...;
expansion& e2 = ...;
expansion& e3 = ...;
expansion& e4 = ...;
expansion& e5 = expansion_sum4(e1,e2,e3,e4);
#define expansion_sum4(a, b, c, d)
Computes an expansion that represents the exact sum of its arguments.
Warning
Do not return or use the returned reference outside the calling function.

Definition at line 1305 of file multi_precision.h.

◆ new_expansion_on_stack

#define new_expansion_on_stack (   capa)     (new (alloca(expansion::bytes_on_stack(capa)))expansion(capa))
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.

  • capa required capacity of the expansion.

Definition at line 341 of file multi_precision.h.

◆ split()

void split ( double  a,
double &  ahi,
double &  alo 
)
related

Splits a number into two components, ready for computing a product.

By Jonathan Shewchuk.

Parameters
[in]ainput number.
[out]ahisplit number, high-magnitude part.
[out]alosplit number, low-magnitude part.

Definition at line 113 of file multi_precision.h.

◆ square()

void square ( double  a,
double &  x,
double &  y 
)
related

Squares a number into a length 2 expansion.

By Jonathan Shewchuk.

Parameters
[in]anumber to square.
[out]xhigh-magnitude component of the result.
[out]ylow-magnitude component of the result.

Definition at line 161 of file multi_precision.h.

◆ two_diff()

void two_diff ( double  a,
double  b,
double &  x,
double &  y 
)
related

Subtracts two doubles into a length 2 expansion.

By Jonathan Shewchuk.

Parameters
[in]afirst number.
[in]bthe number to subtract from a.
[out]xhigh-magnitude component of the result.
[out]ylow-magnitude component of the result.

Definition at line 95 of file multi_precision.h.

◆ two_product()

void two_product ( double  a,
double  b,
double &  x,
double &  y 
)
related

Multiplies two doubles into a length 2 expansion.

By Jonathan Shewchuk.

Parameters
[in]afirst number to multiply.
[in]bsecond number to multiply.
[out]xhigh-magnitude component of the result.
[out]ylow-magnitude component of the result.

Definition at line 129 of file multi_precision.h.

◆ two_sum()

void two_sum ( double  a,
double  b,
double &  x,
double &  y 
)
related

Sums two doubles into a length 2 expansion.

By Jonathan Shewchuk.

Parameters
[in]aone of the numbers to sum.
[in]bthe other numbers to sum.
[out]xhigh-magnitude component of the result.
[out]ylow-magnitude component of the result.

Definition at line 77 of file multi_precision.h.


The documentation for this class was generated from the following file: