Important: The information in this document is obsolete and should not be used for new development.
WideDivide
You can use theWideDivide
function to calculate thelong
quotient andlong
remainder for awide
dividend andlong
divisor.
long WideDivide(const wide *dividend, long divisor, long *remainder);
dividend
- A pointer to the
wide
number to be divided.divisor
- The number by which the dividend is to be divided.
remainder
- A pointer to a location to store the remainder of the division.
- function result
- The quotient of the division.
DESCRIPTION
TheWideDivide
function divides the dividend by the divisor and returns the quotient in the function result and the remainder in thelong
number pointed to by theremainder
parameter. If the dividend is a and the divisor is b, the quotient a / b is returned with a remainder. The operation has a bias of 0 bits; the bias of the result is the difference between the biases of the dividend and the divisor. The bias of the remainder is the same as the bias of the dividend.If an overflow occurs, the result is pinned to the closest infinity and the remainder is set to
gxNegativeInfinity
(an impossible remainder).If the
remainder
parameter isnil
, no remainder is returned and theWideDivide
function returns a rounded quotient. Passing(long *)-1
in theremainder
parameter is the same as passingnil
except in the case of an overflow, in which casegxNegativeInfinity
is returned.