|
|
1.1 ! root 1: ! 2: ! 3: div() General Function div() ! 4: ! 5: ! 6: ! 7: ! 8: Perform integer division ! 9: ! 10: #iinncclluuddee <ssttddlliibb.hh> ! 11: ddiivv_tt ddiivv(_n_u_m_e_r_a_t_o_r, _d_e_n_o_m_i_n_a_t_o_r) ! 12: iinntt _n_u_m_e_r_a_t_o_r, _d_e_n_o_m_i_n_a_t_o_r; ! 13: ! 14: 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 ! 15: the type ddiivv_tt, which is structured as follows: ! 16: ! 17: ! 18: typedef struct { ! 19: int quot; ! 20: int rem; ! 21: } div_t; ! 22: ! 23: ! 24: ddiivv writes the quotient into qquuoott and the remainder into rreemm. ! 25: ! 26: The sign of the quotient is positive if the signs of the ! 27: arguments are the same; it is negative if the signs of the ! 28: arguments differ. The sign of the remainder is the same as the ! 29: sign of the numerator. ! 30: ! 31: If the remainder is non-zero, the magnitude of the quotient is ! 32: the largest integer less than the magnitude of the algebraic ! 33: quotient. This is not guaranteed by the operators / and %, which ! 34: merely do what the machine implements for divide. ! 35: ! 36: ***** See Also ***** ! 37: ! 38: ggeenneerraall ffuunnccttiioonnss, llddiivv ! 39: ! 40: ***** Notes ***** ! 41: ! 42: The ANSI Standard includes this function to permit a useful ! 43: feature found in most versions of FORTRAN, where the sign of the ! 44: remainder will be the same as the sign of the numerator. Also, ! 45: on most machines, division produces a remainder. This allows a ! 46: quotient and remainder to be returned from one machine-divide ! 47: operation. ! 48: ! 49: If the result of division cannot be represented (e.g., because ! 50: _d_e_n_o_m_i_n_a_t_o_r is set to zero), the behavior of ddiivv is undefined. ! 51: _C_a_v_e_a_t _u_t_i_l_i_t_o_r. ! 52: ! 53: ! 54: ! 55: ! 56: ! 57: ! 58: ! 59: ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.