1
div(S)
____________________________________________________________
_d_i_v_,_ _l_d_i_v_,_ _l_l_d_i_v_ _-_-_ _c_o_m_p_u_t_e_ _t_h_e_ _q_u_o_t_i_e_n_t_ _a_n_d_ _r_e_m_a_i_n_d_e_r_
Synopsis
#include
div_t div(int _n_u_m_e_r, int _d_e_n_o_m);
ldiv_t ldiv(long int _n_u_m_e_r, long int _d_e_n_o_m);
lldiv_t lldiv(long long _n_u_m_e_r, long long _d_e_n_o_m);
Description
_d_i_v computes the quotient and remainder of the division of the
numerator _n_u_m_e_r by the denominator _d_e_n_o_m. This function provides
a well-defined semantics for the signed integral division and
remainder operations, unlike the implementation-defined semantics
of the built-in operations. The sign of the resulting quotient is
that of the algebraic quotient, and, if the division is inexact,
the magnitude of the resulting quotient is the largest integer
less than the magnitude of the algebraic quotient. If the result
cannot be represented, the behavior is undefined; otherwise,
_q_u_o_t_i_e_n_t * _d_e_n_o_m + _r_e_m_a_i_n_d_e_r will equal _n_u_m_e_r.
_d_i_v returns a structure of type _d_i_v___t, comprising both the
quotient and remainder. Its members are:
int quot; /*quotient*/
int rem; /*remainder*/
_l_d_i_v is similar to _d_i_v, except that the arguments and the members
of the returned structure (which has type _l_d_i_v___t) all have type
_l_o_n_g_ _i_n_t.
_l_l_d_i_v is similar to _d_i_v, except that the arguments and the
members of the returned structure (which has type _l_l_d_i_v___t) all
have type _l_o_n_g_ _l_o_n_g.
____________________________________________________________
((cc)) 22000055 TThhee SSCCOO GGrroouupp,, IInncc.. AAllll rriigghhttss rreesseerrvveedd..
_S_C_O_ _O_p_e_n_S_e_r_v_e_r_ _R_e_l_e_a_s_e_ _6_._0_._0_ _-_ _0_1_ _J_u_n_e_ _2_0_0_5