Crate balanced_ternary

Source
Expand description

A balanced ternary data structure.

A Ternary object in this module represents a number in the balanced ternary numeral system. Balanced ternary is a non-standard positional numeral system that uses three digits: {-1, 0, +1} represented here as Neg for -1, Zero for 0, and Pos for +1. It is useful in some domains of computer science and mathematics due to its arithmetic properties and representation symmetry.

§Data Structures

  • Digit Enum: Represents a single digit for balanced ternary values, with possible values:
    • Neg for -1
    • Zero for 0
    • Pos for +1

Re-exports§

pub use crate::digit::Digit;
pub use crate::digit::Digit::Neg;
pub use crate::digit::Digit::Pos;
pub use crate::digit::Digit::Zero;
pub use crate::tryte::Tryte;

Modules§

conversions
This module provides conversions between Digit and Ternary types and common Rust types such as char, &str, and String.
digit
Module: Balanced Ternary Digit
operations
This module provides implementations for arithmetic operations on the Ternary type such as addition, subtraction, multiplication, and division. Using Ternary arithmetic:
tryte
A module defining the Tryte structure and its associated functionality.

Structs§

Ternary
Represents a balanced ternary number using a sequence of Digits.

Functions§

ter
Converts a string representation of a balanced ternary number into a Ternary object.
trit
Converts a character into a Digit.
tryte
Creates a Tryte object from a string representation of a balanced ternary number. It contains approximately 9.5 bits of information.