Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Balanced ternary
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Conversion to decimal === In the balanced ternary system the value of a digit ''n'' places left of the [[radix point]] is the product of the digit and 3<sup>''n''</sup>. This is useful when converting between decimal and balanced ternary. In the following the strings denoting balanced ternary carry the suffix, ''bal3''. For instance, : 10<sub>bal3</sub> = 1 Γ 3<sup>1</sup> + 0 Γ 3<sup>0</sup> = 3<sub>dec</sub> : 10π³<sub>bal3</sub> = 1 Γ 3<sup>2</sup> + 0 Γ 3<sup>1</sup> + (β1) Γ 3<sup>0</sup> = 8<sub>dec</sub> : β9<sub>dec</sub> = β1 Γ 3<sup>2</sup> + 0 Γ 3<sup>1</sup> + 0 Γ 3<sup>0</sup> = π³00<sub>bal3</sub> : 8<sub>dec</sub> = 1 Γ 3<sup>2</sup> + 0 Γ 3<sup>1</sup> + (β1) Γ 3<sup>0</sup> = 10π³<sub>bal3</sub> Similarly, the first place to the right of the radix point holds 3<sup>β1</sup> = {{sfrac|1|3}}, the second place holds 3<sup>β2</sup> = {{sfrac|1|9}}, and so on. For instance, : β{{sfrac|2|3}}<sub>dec</sub> = β1 + {{sfrac|1|3}} = β1 Γ 3<sup>0</sup> + 1 Γ 3<sup>β1</sup> = π³.1<sub>bal3</sub>. <div style="display: flex; column-gap: 1em; margin-inline-start: 1.5em;"> {| class="wikitable" style="border: none; text-align:right" ! Dec !! Bal3 !! Expansion |- | 0 || 0 || 0 |- | 1 || 1 || +1 |- | 2 || 1π³ || +3β1 |- | 3 || 10 || +3 |- | 4 || 11 || +3+1 |- | 5 || 1π³π³ || +9β3β1 |- | 6 || 1π³0 || +9β3 |- | 7 || 1π³1 || +9β3+1 |- | 8 || 10π³ || +9β1 |- | 9 || 100 || +9 |- | 10 || 101 || +9+1 |- | 11 || 11π³ || +9+3β1 |- | 12 || 110 || +9+3 |- | 13 || 111 || +9+3+1 |} {| class="wikitable" style="border: none; text-align:right" ! Dec !! Bal3 !! Expansion |- | 0 || 0 || 0 |- | β1 || π³ || β1 |- | β2 || π³1 || β3+1 |- | β3 || π³0 || β3 |- | β4 || π³π³ || β3β1 |- | β5 || π³11 || β9+3+1 |- | β6 || π³10 || β9+3 |- | β7 || π³1π³ || β9+3β1 |- | β8 || π³01 || β9+1 |- | β9 || π³00 || β9 |- | β10 || π³0π³ || β9β1 |- | β11 || π³π³1 || β9β3+1 |- | β12 || π³π³0 || β9β3 |- | β13 || π³π³π³ || β9β3β1 |} </div> An integer is divisible by three if and only if the digit in the units place is zero. We may check the [[Parity (mathematics)|parity]] of a balanced ternary integer by checking the parity of the sum of all trits. This sum has the same parity as the integer itself. Balanced ternary can also be extended to fractional numbers similar to how decimal numbers are written to the right of the [[radix point]].<ref>{{cite web |url=http://www.abhijit.info/tristate/tristate.html |title=Balanced ternary |last=Bhattacharjee |first=Abhijit |date=24 July 2006 |archiveurl=https://web.archive.org/web/20090919053547/http://www.abhijit.info/tristate/tristate.html |archivedate=2009-09-19}}</ref> :{| class="wikitable" |- ! Decimal ! style="text-align: right" | β0.9 ! style="text-align: right" | β0.8 ! style="text-align: right" | β0.7 ! style="text-align: right" | β0.6 ! style="text-align: right" | β0.5 ! style="text-align: right" | β0.4 ! style="text-align: right" | β0.3 ! style="text-align: right" | β0.2 ! style="text-align: right" | β0.1 ! style="text-align: right" | 0 |- ! Balanced Ternary | π³.{{overline|010π³}}||π³.{{overline|1π³π³1}}|| π³.{{overline|10π³0}}|| π³.{{overline|11π³π³}}|| 0.{{overline|π³}} or π³.{{overline|1}} || 0.{{overline|π³π³11}} || 0.{{overline|π³010}} || 0.{{overline|π³11π³}} || 0.{{overline|0π³01}} || 0 |- ! Decimal ! style="text-align: right" | 0.9 ! style="text-align: right" | 0.8 ! style="text-align: right" | 0.7 ! style="text-align: right" | 0.6 ! style="text-align: right" | 0.5 ! style="text-align: right" | 0.4 ! style="text-align: right" | 0.3 ! style="text-align: right" | 0.2 ! style="text-align: right" | 0.1 ! style="text-align: right" | 0 |- ! Balanced Ternary | 1.{{overline|0π³01}}||1.{{overline|π³11π³}}|| 1.{{overline|π³010}}|| 1.{{overline|π³π³11}}|| 0.{{overline|1}} or 1.{{overline|π³}} || 0.{{overline|11π³π³}} || 0.{{overline|10π³0}} || 0.{{overline|1π³π³1}} || 0.{{overline|010π³}} || 0 |} In decimal or binary, integer values and terminating fractions have multiple representations. For example, {{sfrac|1|10}} = 0.1 = 0.1{{overline|0}} = 0.0{{overline|9}}. And, {{sfrac|1|2}} = 0.1<sub>2</sub> = 0.1{{overline|0}}<sub>2</sub> = 0.0{{overline|1}}<sub>2</sub>. Some balanced ternary fractions have multiple representations too. For example, {{sfrac|1|6}} = 0.1{{overline|π³}}<sub>bal3</sub> = 0.0{{overline|1}}<sub>bal3</sub>. Certainly, in the decimal and binary, we may omit the rightmost trailing infinite 0s after the radix point and gain a representations of integer or terminating fraction. But, in balanced ternary, we can't omit the rightmost trailing infinite β1s after the radix point in order to gain a representations of integer or terminating fraction. [[Donald Knuth]]<ref name="Knuth">{{Cite book |last=Knuth |first=Donald |authorlink=Donald Knuth |title=The art of Computer Programming |volume=2 |pages=195β213 |publisher=Addison-Wesley |year=1997 |isbn=0-201-89684-2}}</ref> has pointed out that truncation and rounding are the same operation in balanced ternary—they produce exactly the same result (a property shared with other balanced numeral systems). The number {{sfrac|1|2}} is not exceptional; it has two equally valid representations, and two equally valid truncations: 0.{{overline|1}} (round to 0, and truncate to 0) and 1.{{overline|π³}} (round to 1, and truncate to 1). With an odd [[radix]], [[Rounding#Double rounding|double rounding]] is also equivalent to directly rounding to the final precision, unlike with an even radix. The basic operations—addition, subtraction, multiplication, and division—are done as in regular ternary. Multiplication by two can be done by adding a number to itself, or subtracting itself after a-trit-left-shifting. An arithmetic shift left of a balanced ternary number is the equivalent of multiplication by a (positive, integral) power of 3; and an arithmetic shift right of a balanced ternary number is the equivalent of division by a (positive, integral) power of 3.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)