2 base - set default output base
13 The base function allows one to specify how numbers should be
14 printed. The base function provides a numeric shorthand to the
15 config("mode") interface. With no args, base() will return the
16 current mode. With 1 arg, base(val) will set the mode according to
17 the arg and return the previous mode.
19 The following convention is used to declare modes:
24 2 "binary" base 2 fractions
27 8 "octal" base 8 fractions
30 10 "real" base 10 floating point
34 -10 "integer" base 10 integers
37 16 "hexadecimal" base 16 fractions
40 1/3 "fraction" base 10 fractions
43 1e20 "scientific" base 10 scientific notation
47 For convenience, any non-integer value is assumed to mean base 10
48 fractions and any integer >= 2^64 is assumed to mean base 10
51 These base() calls have the same meaning as config("mode", "fraction"):
53 base(1/3) base(0.1415) base(16/37)
55 These base() calls have the same meaning as config("mode", "scientific"):
57 base(1e20) base(2^64) base(2^8191-1)
59 However the base() function will only return one of the base values
60 listed in the table above.
76 int math_setmode(int newmode)
78 NOTE: newmode must be one of MODE_DEFAULT, MODE_FRAC, MODE_INT,
79 MODE_REAL, MODE_EXP, MODE_HEX, MODE_OCTAL, MODE_BINARY