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 from unbalanced ternary === Unbalanced ternary can be converted to balanced ternary notation in two ways: *Add 1 trit-by-trit from the first non-zero trit with carry, and then subtract 1 trit-by-trit from the same trit without borrow. For example, *: 021<sub>3</sub> + 11<sub>3</sub> = 102<sub>3</sub>, 102<sub>3</sub> β 11<sub>3</sub> = 1T1<sub>bal3</sub> = 7<sub>dec</sub>. *If a 2 is present in ternary, turn it into 1T. For example, *: 0212<sub>3</sub> = 0010<sub>bal3</sub> + 1T00<sub>bal3</sub> + 001T<sub>bal3</sub> = 10TT<sub>bal3</sub> = 23<sub>dec</sub> {| class="wikitable floatright" style=" text-align: center" |- ! Balanced || Logic || Unsigned |- | 1 || True || 2 |- | 0 || Unknown || 1 |- | T || False || 0 |} If the three values of [[Three-valued logic#Kleene logic|ternary logic]] are ''false'', ''unknown'' and ''true'', and these are mapped to balanced ternary as T, 0 and 1 and to conventional unsigned ternary values as 0, 1 and 2, then balanced ternary can be viewed as a biased number system analogous to the [[offset binary]] system. If the ternary number has ''n'' trits, then the bias ''b'' is :<math>b=\left\lfloor \frac{3^n}{2} \right\rfloor</math> which is represented as all ones in either conventional or biased form.<ref>Douglas W. Jones, [http://www.cs.uiowa.edu/~jones/ternary/numbers.shtml Ternary Number Systems], October 15, 2013.</ref> As a result, if these two representations are used for balanced and unsigned ternary numbers, an unsigned ''n''-trit positive ternary value can be converted to balanced form by adding the bias ''b'' and a positive balanced number can be converted to unsigned form by subtracting the bias ''b''. Furthermore, if ''x'' and ''y'' are balanced numbers, their balanced sum is {{nowrap|''x'' + ''y'' β ''b''}} when computed using conventional unsigned ternary arithmetic. Similarly, if ''x'' and ''y'' are conventional unsigned ternary numbers, their sum is {{nowrap|''x'' + ''y'' + ''b''}} when computed using balanced ternary arithmetic.
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)