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].
The function returns NaN whenever no distribution remains after the truncation, in each of the following cases:
- No probability mass of the distribution associated with
valuefalls within [supportMin,supportMax], so the truncation removes the whole distribution. supportMin>supportMax, so the range is empty, and hence, holds no probability mass.
If there is no distribution associated with value (i.e. it's a particle), the function treats
value as carrying the whole probability mass at a single point. It returns value when it
falls within [supportMin, supportMax], and NaN otherwise.
If supportMin or supportMax is NaN, or value is NaN with no associated distribution, the
function returns -NaN. See Handling of NaN.
✏️ 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;
}