Becimal Calculator

[See Repeating Decimal Expansions in Different Bases published in EJMT for more background.]

The application below will perform basic arithmetic operations on rational numbers. Numbers can be entered and displayed is various bases. This app also handles repeating becimal and $p$-adic expansions. Detailed instructions are displayed below the app.

Note: The "dec" in "decimal number" refers to our native base 10, so we will refer to our arbitrary base expansions as becimal numbers. Likewise, instead of "digit" we will say "bigit".

Notes & Instructions

Bigit Dictionary:

"0" = 0 "1" = 1 "2" = 2 "3" = 3 "4" = 4 "5" = 5
"6" = 6 "7" = 7 "8" = 8 "9" = 9 "A" = 10 "B" = 11
"C" = 12 "D" = 13 "E" = 14 "F" = 15 "G" = 16 "H" = 17
"I" = 18 "J" = 19 "K" = 20 "L" = 21 "M" = 22 "N" = 23
"O" = 24 "P" = 25 "Q" = 26 "R" = 27 "S" = 28 "T" = 29
"U" = 30 "V" = 31 "W" = 32 "X" = 33 "Y" = 34 "Z" = 35

Operations: This calculator will handle addition, subtraction, multiplication, division, and exponentiation (i.e., +,-,*,/, and ^) on numbers represented as (repeated) becimals (base $b$ decimals). The computed answer is then displayed in terms of the original input base and the new output base.

Inputting Bigits: A becimal number of base 36 or less, can be entered as a alphanumeric string. For example, "9A30F" is a valid hexidecimal (i.e., base 16) input. For larger bases, each bigit is entered in our native base 10 and separated by a comma. For example, "98,76,54,32,10" is a 5 bigit base 100 number whose third bigit is "54". There is some flexibility allowed for lower base numbers. For example, "9A30F" could also be entered as "9,10,3,0,15".

Repeating Becimals: General becimal numbers are entered in the form "XXX.YYY[ZZZ]" where "XXX" is its whole part, "YYY" is its delay (i.e., non-repeating becimal) part, and "ZZZ" is its cycle (i.e., repeating becimal) part. For example, "9A.78[ABC4]" is a valid hexidecimal number with repeating part "ABC4" so this represents "9A.78ABC4ABC4ABC4...".

$p$-Adics: This app allows for $p$-adic number inputs and outputs. While the fields of $p$-adic and real numbers are distinct, they do share the rational numbers in common (which is the domain for this app). A $p$-adic number is rational if and only if its $p$-adic expansion repeats. We enter such expansions as "[XXX]YYY.ZZZ" which represents the $p$-adic expansion "...XXX XXX XXX YYY.ZZZ". Note that while we allow $p$-adic expansions for arbitrary bases, $p$-adic expansion outputs require the output basis to be a prime number.

Mixed Bases: Inputs are by default interpreted according to the specified "Input Base". However, if one wishes to enter an input using several other bases, an underscore can be used to override our default input base. For example, no matter what "Input Base" is specified, "ABC.DEF[123]_16" will be interpreted as the hexidecimal number whose whole part is "ABC", delay (i.e., non-repeating part) is "DEF", and cycle (i.e., repeating part) is "123".

Order of Operations: The calculator uses standard order of operations (moving left to right): exponentiations first, then multiplications and divisions, then additions and subtractions. Do keep in mind that an underscore to override the default input base is bound before all else. For example, if the "Input Base" was 2, then "10^10_3" would be interpreted as the number "2^3" (i.e., 8).

Outputs: The bases themselves are displayed in our usual base ten. Numbers are displayed as a list of alphanumeric digits (up to base 36) and as boxed digits for larger bases. There are check boxes at the bottom of the app to switch on and off various kinds of outputs.

Truncations: Some numbers have absurdly long repeating becimal or $p$-adic expansions. For becimal expansions exceeding 10000 bigits or $p$-adic expansions exceeding 1000 bigits, the app's code terminates early and truncated outputs are displayed. If such a truncation occurs, a note of warning will be displayed.




The computation above is powered by SageMath. The Sage code is embedded in this webpage's html file. To view the code instruct your browser to show you this page's source. For example, in Chrome, right-click and choose "View page source".