Skip to content

Commit

Permalink
Merge pull request #8 from dual-balanced-ternary/update
Browse files Browse the repository at this point in the history
random updates
  • Loading branch information
NoEgAm authored Jun 5, 2024
2 parents d0d0d83 + c0e8f6f commit 6ca2988
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ jobs:
name: Publish to cargo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- uses: Swatinem/rust-cache@v2

- run: cargo test

- uses: katyo/publish-crates@v1
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- uses: Swatinem/rust-cache@v2

- run: cargo test
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dual_balanced_ternary"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
license = "MIT"
description = "Dual Balanced Ternary Arithmetic"
Expand Down
6 changes: 3 additions & 3 deletions src/primes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ impl TryFrom<f64> for DualBalancedTernary {
let left = fractional_part.floor();
if left == 0.0 {
// nothing
} else if (left - 1.0).abs() < std::f64::EPSILON {
} else if (left - 1.0).abs() < f64::EPSILON {
result = result.add_at(f_idx, Dbt3);
} else if (left - 2.0).abs() < std::f64::EPSILON {
} else if (left - 2.0).abs() < f64::EPSILON {
result = result.add_at(f_idx + 1, Dbt3);
result = result.add_at(f_idx, Dbt7);
} else {
Expand Down Expand Up @@ -240,7 +240,7 @@ impl TryFrom<&Vec<u8>> for DualBalancedTernary {
continue;
}
// println!("reading: {} {}", idx, x);
if idx < (int_range + 1) as usize {
if idx < int_range + 1 {
integral.push(DualBalancedTernaryDigit::try_from((x & 0b11110000) >> 4)?);
integral.push(DualBalancedTernaryDigit::try_from(x & 0b00001111)?);
} else {
Expand Down

0 comments on commit 6ca2988

Please sign in to comment.