Rhino C++ API  7.21
Public Member Functions | List of all members
ON_Sum Class Reference

#include <opennurbs_math.h>

Public Member Functions

 ON_Sum ()
 
void Begin (double starting_value=0.0)
 
void operator+= (double x)
 
void operator-= (double x)
 
void operator= (double x)
 
void Plus (double x)
 
void Plus (double x, double dx)
 
int SummandCount () const
 
double Total (double *error_estimate=nullptr)
 

Detailed Description

Description: Class for carefully adding long list of numbers.

Constructor & Destructor Documentation

◆ ON_Sum()

ON_Sum::ON_Sum ( )

Description: Creates a sum that is ready to be used.

Member Function Documentation

◆ Begin()

void ON_Sum::Begin ( double  starting_value = 0.0)

Description: If a sum is being used more than once, call Begin() before starting each sum. Parameters: starting_value - [in] Initial value of sum.

◆ operator+=()

void ON_Sum::operator+= ( double  x)

Description: Calls ON_Sum::Plus(x);

◆ operator-=()

void ON_Sum::operator-= ( double  x)

Description: Calls ON_Sum::Plus(-x);

◆ operator=()

void ON_Sum::operator= ( double  x)

Description: Calls ON_Sum::Begin(x)

◆ Plus() [1/2]

void ON_Sum::Plus ( double  x)

Description: Add x to the current sum. Parameters: x - [in] value to add to the current sum.

◆ Plus() [2/2]

void ON_Sum::Plus ( double  x,
double  dx 
)

Description: Add x to the current sum. Parameters: x - [in] value to add to the current sum. dx - [in] symmetric uncertainty in x. (true value is in the range x-dx to x+dx

◆ SummandCount()

int ON_Sum::SummandCount ( ) const

Returns: Number of summands.

◆ Total()

double ON_Sum::Total ( double *  error_estimate = nullptr)

Description: Calculates the total sum.
Parameters: error_estimate - [out] if not nullptr, the returned value of error_estimate is an estimate of the error in the sum. Returns: Total of the sum. Remarks: You can get subtotals by mixing calls to Plus() and Total(). In delicate sums, some precision may be lost in the final total if you call Total() to calculate subtotals.