tsv_utils.common.numerics

Numeric related utilities used by TSV Utilities.

Utilities in this file:

  • formatNumber - An alternate print format for numbers, especially useful when doubles are being used to represent integer and float values.
  • rangeMedian - Finds the median value of a range.
  • quantile - Generates quantile values for a data set.

Copyright (c) 2016-2021, eBay Inc. Initially written by Jon Degenhardt

Members

Aliases

AreNaNsEqual
alias AreNaNsEqual = Flag!"areNaNsEqual"

Flag use by the nearEqual template.

Enums

QuantileInterpolation
enum QuantileInterpolation

The different quantile interpolation methods. See: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/quantile.html

Functions

formatNumber
auto formatNumber(T num, size_t floatPrecision)

formatNumber is an alternate way to print numbers. It is especially useful when representing both integral and floating point values with float point data types.

nearEqual
bool nearEqual(T x, T y, T maxRelDiff, T maxAbsDiff)

nearEqual checks if two floating point numbers are "near equal".

quantile
double quantile(ProbType prob, Range data, QuantileInterpolation method)

Returns the quantile in a data vector for a cumulative probability.

rangeMedian
auto rangeMedian(Range r)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta

License

Boost Licence 1.0 (http://boost.org/LICENSE_1_0.txt)