v2.1.0: Round-to-nearest accuracy fixes and release automation#9
Merged
Conversation
from_i1f63 truncates, biasing every converted angle low by up to one ulp. Circular vectoring's accumulated z is dominated by this table quantization, so a round-to-nearest conversion at the lookup improves asin/acos/atan means 1.2-1.8x with all other functions unchanged. Hyperbolic vectoring keeps the truncating conversion deliberately: rounding its table regresses atanh/ln/acoth, indicating a datapath bias that the truncated angles partially cancel. Documented in the helper for future kernel work.
Two truncation biases fixed. The reduction now computes k = floor(x / ln2) instead of trunc, keeping r in [0, ln2) so exp(r) carries a full significand in [1, 2) into the final scaling. The scaling right-shift for negative k now rounds to nearest instead of truncating toward zero, which matters most where the true result is only a few ulps. Halves mean, median, and P95 relative error for exp and pow2 on both I16F16 and I32F32 (exp I16F16 mean 1.14e-2 -> 5.98e-3, P95 7.88e-2 -> 4.13e-2). The zero-saturation threshold moves accordingly: results now round to one ulp rather than truncating to zero just past the old cutoff (I16F16: ~-11.1 -> ~-11.8; I32F32: ~-22.2 -> ~-22.9; pow2 similar). Docs and threshold tests updated.
Raises MSRV from 1.88 to the current stable and moves the fixed dependency floor to 1.31 (which itself requires rustc 1.93+). No functional changes: fixed 1.31.0 produces byte-identical accuracy results, and the 1.31 additions (unsafe unchecked_* methods) are unused since this crate denies unsafe_code. Updates the MSRV CI job, README requirement line, and the stale install-snippet version.
Closed
The old flow chained auto-tag.yml (tag on merge) into publish.yml (publish on tag). Tags pushed with the default GITHUB_TOKEN deliberately do not trigger other workflows, so the chain never fired and tags had to be deleted and re-pushed by hand to release. Publish now runs on push to main: when Cargo.toml's version is absent from the crates.io sparse index it tests, tags, publishes, and creates the GitHub release in a single run. The tag is an output of the run rather than its trigger, so no PAT is required. All steps are idempotent and a failed run can be retried from the Actions tab.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Adds tests for the two genuinely untested new paths: the exp floor-adjustment band where the truncated quotient sits exactly at -max_shift (x ~ -21.6 at I16F16, ~ -43.7 at I32F32), and the exact i1f63 conversion for types with 63+ fractional bits (I64F64 CORDIC). Collapses exp's three-way scale match into if/else so the shr_rounded(x, 0) identity path is exercised by every scale == 0 call instead of being an unreachable guard. Raises codecov targets to match measured coverage (96.2%): project 80% -> 95%, patch 80% -> 85%, badge range 90...100. The remaining flagged lines are tarpaulin attribution artifacts (inlined const fns, attribute lines, and a block provably executed by exp(-1)).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rounding instead of truncation at two systematic bias points
Circular CORDIC table angles:
from_i1f63truncates, biasing every converted angle low by up to one ulpexp argument reduction and scaling:
Accuracy improvements:
Saturation threshold changes:
Toolchain and dependencies:
Release automation:
No public API changes. Baseline and README regenerated; no-panic verification passes.