calculator (Linux) - library API 1.1.1
calculator - Libraries
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
Coruh::Utility::MathUtility Class Reference

Provides Math. functions for various operations. More...

#include <mathUtility.h>

Collaboration diagram for Coruh::Utility::MathUtility:

Static Public Member Functions

static double calculateMean (const double fiArray[], int fiArrayLen)
 Calculates the mean (average) of an array of data.
 
static double calculateMedian (const double fiArray[], int fiArrayLen)
 Calculates the median of an array of data.
 
static int compareDouble (const void *fiPtrLhs, const void *fiPtrRhs)
 Compares two double values for sorting purposes.
 
static void calculateMinMax (const double fiArray[], int fiArrayLen, double *foMin, double *foMax)
 Calculates the minimum and maximum values in an array of data.
 

Detailed Description

Provides Math. functions for various operations.

Member Function Documentation

◆ calculateMean()

double MathUtility::calculateMean ( const double  fiArray[],
int  fiArrayLen 
)
static

Calculates the mean (average) of an array of data.

This function calculates the mean (average) of the given array of data. The data array should contain datalen elements.

Parameters
fiArrayThe array of data.
fiArrayLenThe length of the data array.
Returns
The calculated mean.

◆ calculateMedian()

double MathUtility::calculateMedian ( const double  fiArray[],
int  fiArrayLen 
)
static

Calculates the median of an array of data.

This function calculates the median of the given array of data. The data array should contain datalen elements.

Parameters
fiArrayThe array of data.
fiArrayLenThe length of the data array.
Returns
The calculated median.

◆ calculateMinMax()

void MathUtility::calculateMinMax ( const double  fiArray[],
int  fiArrayLen,
double *  foMin,
double *  foMax 
)
static

Calculates the minimum and maximum values in an array of data.

This function calculates the minimum and maximum values in the given array of data. The data array should contain datalen elements.

Parameters
fiArrayThe array of data.
fiArrayLenThe length of the data array.
foMinPointer to store the minimum value.
foMaxPointer to store the maximum value.

◆ compareDouble()

int MathUtility::compareDouble ( const void *  fiPtrLhs,
const void *  fiPtrRhs 
)
static

Compares two double values for sorting purposes.

This function is used as a comparison function for sorting an array of doubles in ascending order.

Parameters
fiPtrLhsPointer to the first double value.
fiPtrRhsPointer to the second double value.
Returns
An integer value indicating the comparison result.
  • -1 if the first value is less than the second value.
  • 0 if the values are equal.
  • 1 if the first value is greater than the second value.

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