Skip to main content

Limit Distribution Support

Name

UxHwDoubleLimitDistributionSupport, UxHwFloatLimitDistributionSupport — Truncate the support of a distribution to within a specified range.

Synopsis

#include <uxhw.h>

double UxHwDoubleLimitDistributionSupport(double value, double supportMin, double supportMax);
float UxHwFloatLimitDistributionSupport(float value, float supportMin, float supportMax);

Description

The UxHwDoubleLimitDistributionSupport() function truncates the support of the distribution associated with value to the range [supportMin, supportMax], on architectures that associate distributional information with floating-point values. The function truncates the distribution so that all probability mass outside the specified range is removed, and the remaining distribution is renormalized to integrate to one over the interval [supportMin, supportMax].

Parameters

  • value — The distributional value to apply the distribution limits to.
  • supportMin — The lower limit of the specified support range.
  • supportMax — The upper limit of the specified support range.

Return Values

The UxHwDoubleLimitDistributionSupport() function returns a distributional value whose support is limited to the range [supportMin, supportMax].

If the value of value falls outside [supportMin, supportMax], the function returns NaN. If supportMin > supportMax, the function returns NaN. If there is no distribution associated with value and the value of value falls within [supportMin, supportMax], the function returns value.

✏️   Examples

#include <stdio.h>
#include <uxhw.h>

int
main(void)
{
double a = UxHwDoubleGaussDist(0.0, 1.0);
double limited = UxHwDoubleLimitDistributionSupport(a, 0.0, 1.0);

printf("Limited distribution is %lf.\n", limited);

return 0;
}