github.com/tusf/dozenal (go): This package implements a formatter useful for displaying numbers of arbitrary bases.  A formatter has methods for outputting a number to a string. The base/dozenal package has some default formatters for outputting numbers in base-12, otherwise known as dozenal.  Output:  Notice that when using fmt, you need to use the "s" verb, because the formmater already gives you a string as output.  If you want different numerals, such as if you have your own digits for ten and eleven in Dozenal or even if you want to map 0-9 to something unique as well, you can use NewFormatter() to create a formatter.  Notice in this example that the chosen base is the len of the slice; in this case base 13.  The formatter also has methods for the arbitrarily large numbers implemented in math/big. BigInt() and BigRat() accept a big.Int and big.Rat respectively, calculate it, and output it in the desired base. This allows displaying arbitrarily large integers and fractions.  big.Rat.String() outputs a number in the "a/b" format, however the formatter goes to the effort of evaluating that expression. Thus, the following example:  Output:  Because big.Rat represents a rational number, the fractional form will eventually terminate or loop. In this case, 1/7 is an infinite loop of 6 repeating digits, represented within square-brackets.
Keywords: dozenal|golang-library