Internal functions and functionality

Constants

PrecisionCarriers.EpsMaxConstant
EpsMax

The maximum representable number of epsilons. typemax(EpsT) by default. If an epsilon would be larger than this value, it is shown as "infinite" epsilons.

source

Types

PrecisionCarriers.EpsilonBenchmarkResultType
EpsilonBenchmarkResult

Result object returned by the @bench_epsilons macro. When displayed, it prints a summary of the results, containing the minimum, median, mean, and maximum observed epsilons, and a terminal-styled histogram.

Fields:

  • epsilons: A vector of all non-infinite collected epsilon samples. Infinite epsilons are excluded so that statistical measures do not get skewed.
  • total_samples: The total number of collected samples.
  • worst_arguments: Descending list of the top worst epsilons together with the respective arguments. Helpful for closer inspection of precision problems.
  • epsilon_limit: The minimum number of epsilons a result must have to be considered for the worst arguments list.
  • call_string: The call string of the function being benchmarked, with format specifiers to string-interpolate the values.
  • no_inf_epsilons: Number of collected samples that gave infinite epsilons.
source

Functions

PrecisionCarriers._grid_samplesFunction
_grid_samples(ranges::Tuple{Vararg{Tuple{<:Real, <:Real}}}, n::Integer)

Return an iterator generating approximately n evenly spaced samples over the Cartesian grid defined by ranges. Each element of ranges must be a (lo, hi) tuple.

Note

The actual number of samples generated is

\[ \lfloor n^{\frac{1}{m}} \rfloor ^ m\]

where m is the dimensionality, i.e., number of ranges given.

source
PrecisionCarriers._random_samplesFunction
_random_samples(ranges::Tuple{Vararg{Tuple{<:Real, <:Real}}}, n::Integer)

Return an iterator generating n uniform randomly generated samples over the Cartesian grid defined by ranges. Each element of ranges must be a (lo, hi) tuple.

source
PrecisionCarriers._pseudo_random_samplesFunction
_pseudo_random_samples(ranges::Tuple{Vararg{Tuple{<:Real, <:Real}}}, n::Integer)

Return an iterator generating n pseudo-randomly generated samples over the Cartesian grid defined by ranges. Each element of ranges must be a (lo, hi) tuple. This uses the package Sobol.jl to produce pseudorandom numbers within the given hypercube. The resulting numbers are more predictable and evenly spaced than real randomness, which can be better to sample a high dimensional space. Also, the generated samples are reproducible.

source
PrecisionCarriers.make_binsFunction
make_bins(
    vec::Vector{EpsT},
    min_val::EpsT,
    max_val::EpsT,
    mean_val::AbstractFloat,
    median_val::AbstractFloat,
    histogram_width::Int
)

Helper function for printing EpsilonBenchmarkResult. Returns a tuple (hist, mean_bin, median_bin), where hist is a vector of length histogram_width. The elements represent the number of results (from the given vec) in the bin. mean_bin and median_bin contain the bins that the given mean_val and median_val fall in. min_val and max_val are used to scale the histogram appropriately. The histogram bins are sized logarithmically, which also means that 0 values are ignored. This function errors when the difference between min_val and max_val is 1 or less, or when min_val is 0 or less.

source
PrecisionCarriers.ascii_histFunction
ascii_hist(io::IO, bins::Vector{Int}, mean_bin::Int, median_bin::Int)

Prints the given histogram (bins) to the given io. The mean and median bins are colored in their respective colors.

Note

The implementation is copied and slightly adapted from BenchmarkTools.jl.

source
PrecisionCarriers._special_epsilonFunction
_special_epsilon(p::P{T})

Returns:

  • _NORM_EPS if neither p.x nor p.big need special treatment
  • _INF_EPS if p.x or p.big have special values and the epsilon should be considered infinite
  • _ZERO_EPS if p.x or p.big have special values and the epsilon should be considered zero
source