Crate dual_balanced_ternary

Source
Expand description
  • Dual Balanced Ternary Arithmetic

Dual balanced ternary(DBT) is an extension to balanced ternary in 2D space. Unit values of DBT is has a layout like a magic square, where 1 is the front direction.

  6 1 8
  7 5 3
  2 9 4

At a bigger scale, the layout of the magic square repeats, which leads to &11 and &19 like in decimals. & in this case is a special mark indicating it’s a DBT value.

There are some interesting features for the basic math:

= (* &1 &1) &1
= (* &1 &9) &9
= (* &9 &9) &1
= (* &3 &3) &9

and:

= (+ &1 &3) &8
= (+ &1 &1) &19
= (* &3 &7) &5

The math is roughly equal to Complex numbers, expect for that its identity value is 1 pointing at at front.

Re-exports§

pub use digit::DualBalancedTernaryDigit;
pub use primes::DualBalancedTernary;
pub use primes::DIV_PRECISION;

Modules§

complex
digit
Digits for DBT, with 9 values, 5 at center, 1 at front
primes

Functions§

dbt_digits
expose internal digits for inspecting
ternary
an alias for quick creating a DualBalancedTernary, might fail