failed attempts to intercept copy command when the cursor is in the empty text field...
[LeanCalc.git] / help / quo
1 NAME
2     quo - compute integer quotient of a value by a real number
3
4 SYNOPSIS
5     quo(x, y, rnd) or x // y
6
7 TYPES
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).
10
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().
15
16     If neither x nor y is an object, and x is not a matrix or list:
17
18     x           number (real or complex)
19     y           real
20     rnd         integer, defaults to config("quo")
21
22     return      number
23
24 DESCRIPTION
25     If x is real or complex and y is zero, quo(x, y, rnd) returns zero.
26
27     If x is complex, quo(x, y, rnd) returns
28                  quo(re(x), y, rnd) + quo(im(x), y, rnd) * 1i.
29
30     In the following it is assumed that x is real and y is nonzero.
31
32     If x/y is an integer quo(x, y, rnd) returns x/y.
33
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:
37
38                 rnd     sign of x/y - v         Description of rounding
39
40                 0             +                 down, towards minus infinity
41                 1             -                 up, towards infinity
42                 2           sgn(x/y)            towards zero
43                 3          -sgn(x/y)            from zero
44                 4           sgn(y)
45                 5          -sgn(y)
46                 6           sgn(x)
47                 7          -sgn(x)
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
56
57              16-31                              to nearest integer when this
58                                                 is uniquely determined;
59                                                 otherwise, when x/y is a
60                                                 half-integer, as if
61                                                 rnd replaced by rnd & 15
62
63 EXAMPLE
64     print quo(11,5,0), quo(11,5,1), quo(-11,5,2), quo(-11,-5,3)
65     2 3 -2 3
66
67     print quo(12.5,5,16), quo(12.5,5,17), quo(12.5,5,24), quo(-7.5,-5,24)
68     2 3 2 2
69
70 LIMITS
71     none
72
73 LINK LIBRARY
74     void quovalue(VALUE *x, VALUE *y, VALUE *rnd, VALUE *result)
75     NUMBER *qquo(NUMBER *x, NUMBER *y, long rnd)
76
77 SEE ALSO
78     mod, quomod, //, %
79