Function cpf_rint
Defined in File cpfloat_binary64.h
Function Documentation
-
static inline int cpf_rint(double *X, int *exception, const double *A, const size_t numelem, optstruct *fpopts)
Compute the closest integer with specified rounding mode.
If the function executes without errors, then \( X_i \) is the integral part of \( A_i \) rounded to a lower-precision target format and \( \mathrm{exception}_i \) is set to 0 if \( X_i \) is equal to \( A_i \) and to FE_INEXACT otherwise. The parameters of the target format and the rounding mode to be used are encoded in
fpopts
. If required, the function flips one bit in some of the entries ofX
.If OpenMP support is specified at compile time, several OpenMP threads are used if
numelem
is large enough. This parameter is machine dependent.- Parameters:
X – [out] Array of rounded values.
exception – [out] Array of floating-point exceptions.
A – [in] Input array.
numelem – [in] Number of elements in
X
andA
.fpopts – [in] Parameters describing the target format, the rounding mode, and the probability of soft errors striking the rounded values.
- Returns:
The function returns 1 if
fpopts->precision
is larger than 53 , 2 iffptops->emin
is smaller than -1022 or fpopts->emax is larger than 1023 , and 0 otherwise.