function ret = mpfr_can_round (b, err, rnd1, rnd2, prec)
% ret = mpfr_can_round (b, err, rnd1, rnd2, prec)
%
% Assuming B is an approximation of an unknown number X in the
% direction RND1 with error at most two to the power EXP(B) − ERR
% where EXP(B) is the exponent of B, return a non-zero value if one
% is able to round correctly X to precision PREC with the direction
% RND2 assuming an unbounded exponent range, and 0 otherwise
% (including for NaN and Inf).  In other words, if the error on B is
% bounded by two to the power K ulps, and B has precision PREC, you
% should give ERR = PREC − K.  This function *does not modify* its
% arguments.
%
% If RND1 is ‘MPFR_RNDN’ or ‘MPFR_RNDF’, the error is considered to
% be either positive or negative, thus the possible range is twice as
% large as with a directed rounding for RND1 (with the same value of
% ERR).
%
% When RND2 is ‘MPFR_RNDF’, let RND3 be the opposite direction if
% RND1 is a directed rounding, and ‘MPFR_RNDN’ if RND1 is ‘MPFR_RNDN’
% or ‘MPFR_RNDF’.  The returned value of ‘mpfr_can_round (b, err,
% rnd1, MPFR_RNDF, prec)’ is non-zero iff after the call ‘mpfr_set
% (y, b, rnd3)’ with Y of precision PREC, Y is guaranteed to be a
% faithful rounding of X.
%
% Note: The *note ternary value:: cannot be determined in general
% with this function.  However, if it is known that the exact value
% is not exactly representable in precision PREC, then one can use
% the following trick to determine the (non-zero) ternary value in
% any rounding mode RND2 (note that ‘MPFR_RNDZ’ below can be replaced
% by any directed rounding mode):
% Indeed, if RND2 is ‘MPFR_RNDN’, this will check if one can round to
% PREC + 1 bits with a directed rounding: if so, one can surely round
% to nearest to PREC bits, and in addition one can determine the
% correct ternary value, which would not be the case when B is near
% from a value exactly representable on PREC bits.
%
% A detailed example is available in the ‘examples’ subdirectory,
% file ‘can_round.c’.
%

  ret = mex_apa_interface (1164, b, err, rnd1, rnd2, prec);
end

% This function was automatically generated by "generate_m_files".
