Function cpf_ilogb

Function Documentation

static inline int cpf_ilogb(int *exp, const double *A, const size_t numelem, optstruct *fpopts)

Compute integral part of the logarithm of the absolute value.

If the function executes without errors, the integer \( \exp_i \) is the exponent used internally to express the floating-point value \( A_i \) rounded to a lower-precision target format. In other words, \( X_i \) is equal to \( \mathrm{trunc}(\log_b^{\lvert A_i \rvert}) \) where \( b = \mathrm{FLT\_RADIX} \) is typically 2. The parameters of the target format and the rounding mode to be used are encoded in fpopts.

If OpenMP support is specified at compile time, several OpenMP threads are used if numelem is large enough. This parameter is machine dependent.

Parameters:
  • exp[out] Array of floating-point values in \( (-1, 1) \).

  • A[in] Input array.

  • numelem[in] Number of elements in X, A, B, and C.

  • 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 if fptops->emin is smaller than -1022 or fpopts->emax is larger than 1023 , and 0 otherwise.