2 quo - compute integer quotient of a value by a real number
5 quo(x, y, rnd) or x // y
8 If x is a matrix or list, the returned value is a matrix or list v of
9 the same structure for which each element v[[i]] = quo(x[[i]], y, rnd).
11 If x is an xx-object or x is not an object and y is an xx-object,
12 this function calls the user-defined function xx_quo(x, y, rnd);
13 the types of arguments and returned value are as required by the
14 definition of xx_quo().
16 If neither x nor y is an object, and x is not a matrix or list:
18 x number (real or complex)
20 rnd integer, defaults to config("quo")
25 If x is real or complex and y is zero, quo(x, y, rnd) returns zero.
27 If x is complex, quo(x, y, rnd) returns
28 quo(re(x), y, rnd) + quo(im(x), y, rnd) * 1i.
30 In the following it is assumed that x is real and y is nonzero.
32 If x/y is an integer quo(x, y, rnd) returns x/y.
34 If x is real, y nonzero and x/y is not an integer, x // y returns
35 one of the two integers v for which abs(x/y - v) < 1. Which
36 integer is returned is controlled by rnd as follows:
38 rnd sign of x/y - v Description of rounding
40 0 + down, towards minus infinity
41 1 - up, towards infinity
42 2 sgn(x/y) towards zero
48 8 to nearest even integer
49 9 to nearest odd integer
50 10 even if x/y > 0, otherwise odd
51 11 odd if x/y > 0, otherwise even
52 12 even if y > 0, otherwise odd
53 13 odd if y > 0, otherwise even
54 14 even if x > 0, otherwise odd
55 15 odd if x > 0, otherwise even
57 16-31 to nearest integer when this
58 is uniquely determined;
59 otherwise, when x/y is a
61 rnd replaced by rnd & 15
64 print quo(11,5,0), quo(11,5,1), quo(-11,5,2), quo(-11,-5,3)
67 print quo(12.5,5,16), quo(12.5,5,17), quo(12.5,5,24), quo(-7.5,-5,24)
74 void quovalue(VALUE *x, VALUE *y, VALUE *rnd, VALUE *result)
75 NUMBER *qquo(NUMBER *x, NUMBER *y, long rnd)