Nth Mode of a Distribution
Name
UxHwDoubleNthMode, UxHwFloatNthMode — Return the th most-frequently occurring value of a distribution.
Synopsis
#include <stddef.h>
#include <uxhw.h>
double UxHwDoubleNthMode(double value, size_t n);
float UxHwFloatNthMode(float value, size_t n);
Description
The UxHwDoubleNthMode() function returns the th mode of the distribution associated with value, on architectures that associate distributional information with floating-point values.
The th mode of a distribution in statistics, is defined as the th most frequently occuring value in the set distribution.
Parameters
value— The distributional value to take the nth mode from.n— The order of the mode.
Return values
The UxHwDoubleNthMode() function returns the nth mode of the distribution associated with value. If there is no distribution associated with value, the function returns value.
If value is NaN with no associated distribution, the function returns -NaN. See Handling of NaN.
✏️ Examples
#include <stddef.h>
#include <stdio.h>
#include <uxhw.h>
int
main(void)
{
double a = UxHwDoubleUniformDist(10.0, 20.0);
double secondMode = UxHwDoubleNthMode(a, 2);
printf("Second mode is %lf.\n", secondMode);
return 0;
}