Python-divmod digital processing function python daily function-pmod digital processing function
Pmod (a, B) function
Chinese description:
The pmod (a, B) method returns a // B (division is an integer) and the remainder of a on B.
The returned result type is tuple.
Parameters:
A and B can be numbers (including plural numbers)
Version:
Complex numbers cannot be processed before python2.3.
English description:
Take two (non complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using long pision. with mixed operand types, the rules for binary arithmetic operators apply. for plain and long integers, the result is the same as (a // B, a % B ). for floating point numbers the result is (q, a % B), where q is usually math. floor (a/B) but may be 1 less than that. in any case q * B + a % B is very close to a, if a % B is non-zero it has the same sign as B, and 0 <= abs (a % B) <abs (B ).
Changed in version 2.3: Using pmod () with complex numbers is deprecated.
Python code example:
>>> pmod(9,2)(4, 1)>>> pmod(11,3)(3, 2)>>> pmod(1+2j,1+0.5j)((1+0j), 1.5j)