mekso, at-most-5-ary operator: a rounding function; ordered input list is (x,n,t,m,b) and the output is sgn(x) bt roundn (b(-t) abs(x)), with rounding preference n and where the fractional part of b(-t) abs(x) being equal to 1/2 causes the roundn ( ) function to map b(-t) abs(x) to the nearest integer of form 2Z+m, for base b (determined by context if not explicitly input) and some integer Z (determined by context).
This function rounds x toward or away from 0; if you want a complementary function which rounds toward positive or negative infinity, then see "ji'i'u'u". x must be a real number; & n must be exactly one of exactly the following: -1, 0, 1; & t must be an integer (contextless default: 0) if defined at all (see infra); & m must be 0 xor 1 if it is defined at all (see infra); & b is a numerical base (if determined by context) or is a nonzero real number (if explicitly specified), see infra; the output is a real (typically: rational) number. n does not have a contextless default value; it determines the type of rounding which is to be used here (see infra). m is defined iff n = 0; if m is/would be undefined, then its slot is automatically and implicitly deleted from this word in that context (so the operator is at-most-4-ary and the the final argument would fill the 't' xor 'b' slot under the condition that three xor four (resp.) arguments are explicitly used). If m is defined, then its contextless default value is m = 0. This function/word first determines the base being used for interpretation of digit strings (determined by context or by explicit specification (JUhAU)) for/as applied to x; this determination takes place even before inputs are accepted after x; let this base be represented by b throughout this description unless b is explicitly specified as an input. In such case, if the base of x is a positional system wherein each digit represents a corresponding multiple of a fixed natural number raised to the power of its position (as determined relative to the radix point) and wherein the overall number is the sum of these results/representands, or if b is explicitly specified as an input, then t is defined; if the base of x is sufficiently bad or unclear and b is not explicitly specified as an input, then t is undefined. Of course, if b is explicitly specified as an input, then that value (if valid) is the meaning of "b" throughout this description. If t is undefined, then its slot is automatically and implicitly deleted from this word in that context (so the operator is at-most-3-ary and its input acceptance is terminated by the 'n' xor 'm' slot, whichever one is later yet defined (because, assumptively, 'b' is not explicitly specified); if 'm' is defined and explicitly uttered when 't' is undefined and the 'x' and 'n' values have been explicitly specified, then the third input is 'm') and "bt" = "b(-t)" = b = 1 formally for the purposes of this definition (but not necessarily for the base for any digit-to-number interpretation/conversion, particularly on x!). If t is defined, then its contextless default value is t = 0. The rounding function, determined by n, is performed on (b(-t))abs(x). If n = 1, then the rounding function is the ceiling function: (b(-t))abs(x) is mapped to the least integer that is greater than or equal to it; in other words, it rounds up. If n = -1, then the rounding function is the floor function: (b(-t))abs(x) is mapped to the greatest integer that is less than or equal to it; in other words, it rounds down. These integers are both determined by the ordering and metric. If n = 0, then the rounding function maps (b(-t))abs(x) to the integer that minimizes the metric distance between itself and (b(-t))abs(x) if a unique such integer exists (id est: (b(-t))abs(x) is mapped to the nearest integer, where "nearest"-ness is determined according to the order and metric); if no such unique integer exists, then (b(-t))abs(x) is mapped to the unique integer among these aforementioned options for which there exists an integer Z such that 2Z+m is the integer in question; if no unique such integer exists, then the function is undefined. Thus, n = 0 produces the commonly used unbiased nearest-integer rounding function. In each of these cases, the output of the rounding function is then multiplied by sgn(x) bt. Thus, it rounds at the tth digit if b matches the base of x and else to the nearest multiple of b in the tth digit of abs(x), so to speak. Notice that rounding up or down always is applied to the absolute value, so it is really rounding (positive or negative) infinity-ward or zeroward respectively. The order on, and the operators and metric endowing, the metric space and field of all real numbers is determined by context or by explicit specification. The absolute value function is denoted as "abs( )" in the definition, and the signum function sgn is such that sgn(z) = z/abs(z) for all real z: abs(z) > 0, and sgn(0) = 0.