|
|
coherent
div() General Function div()
Perform integer division
#iinncclluuddee <ssttddlliibb.hh>
ddiivv_tt ddiivv(_n_u_m_e_r_a_t_o_r, _d_e_n_o_m_i_n_a_t_o_r)
iinntt _n_u_m_e_r_a_t_o_r, _d_e_n_o_m_i_n_a_t_o_r;
ddiivv divides _n_u_m_e_r_a_t_o_r by _d_e_n_o_m_i_n_a_t_o_r. It returns a structure of
the type ddiivv_tt, which is structured as follows:
typedef struct {
int quot;
int rem;
} div_t;
ddiivv writes the quotient into qquuoott and the remainder into rreemm.
The sign of the quotient is positive if the signs of the
arguments are the same; it is negative if the signs of the
arguments differ. The sign of the remainder is the same as the
sign of the numerator.
If the remainder is non-zero, the magnitude of the quotient is
the largest integer less than the magnitude of the algebraic
quotient. This is not guaranteed by the operators / and %, which
merely do what the machine implements for divide.
***** See Also *****
ggeenneerraall ffuunnccttiioonnss, llddiivv
***** Notes *****
The ANSI Standard includes this function to permit a useful
feature found in most versions of FORTRAN, where the sign of the
remainder will be the same as the sign of the numerator. Also,
on most machines, division produces a remainder. This allows a
quotient and remainder to be returned from one machine-divide
operation.
If the result of division cannot be represented (e.g., because
_d_e_n_o_m_i_n_a_t_o_r is set to zero), the behavior of ddiivv is undefined.
_C_a_v_e_a_t _u_t_i_l_i_t_o_r.
COHERENT Lexicon Page 1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.