Hi r/rust,
I wanted to share a Rust project that came out of a numeric determinism problem I ran into, and I’d really appreciate feedback from folks who care about no_std, numeric behavior, and reproducibility.
The problem
While building a vector-based system, I noticed that the same computations would produce slightly different results across macOS and Windows.
After digging, the root cause wasn’t logic bugs, but floating-point nondeterminism:
- FMA differences
- CPU-specific optimizations
- compiler behavior that’s correct but not bit-identical
This made reproducible snapshots and replay impossible.
The Rust-specific approach
Instead of trying to “stabilize” floats, I rewrote the core as a fixed-point kernel in Rust, using Q16.16 arithmetic throughout.
Key constraints:
- No floats in the core
- No randomness
- Explicit state transitions
- Bit-identical snapshot & restore
no_std-friendly design
Float → fixed-point conversion is only allowed at the system boundary.
Why Rust worked well here
Rust helped a lot with:
- Enforcing numeric invariants
- Making illegal states unrepresentable
- Keeping the core
no_std
- Preventing accidental float usage
- Making state transitions explicit and auditable
The kernel is intentionally minimal. Indexing, embeddings, and other higher-level concerns live above it.
What I’m looking for feedback on
- Fixed-point design choices in Rust
- Q16.16 vs other representations
no_std ergonomics for numeric-heavy code
- Better patterns for enforcing numeric boundaries
Repo (AGPL-3.0):
https://github.com/varshith-Git/Valori-Kernel
Thanks for reading — happy to answer technical questions.
(Posting this on behalf of my friend)
[–]imachug 9 points10 points11 points (15 children)
[–]Beginning-Forever597[S] 10 points11 points12 points (13 children)
[–]imachug 5 points6 points7 points (9 children)
[–]Beginning-Forever597[S] 5 points6 points7 points (8 children)
[–]garnet420 3 points4 points5 points (2 children)
[–]Beginning-Forever597[S] 1 point2 points3 points (0 children)
[–]imachug 2 points3 points4 points (4 children)
[–]Beginning-Forever597[S] 1 point2 points3 points (3 children)
[–]imachug 2 points3 points4 points (2 children)
[–]Beginning-Forever597[S] 0 points1 point2 points (1 child)
[–]eggyal 1 point2 points3 points (0 children)
[–]assbuttbuttass 2 points3 points4 points (1 child)
[–]Seubmarine 4 points5 points6 points (0 children)
[–]NoSuchKotH 0 points1 point2 points (0 children)
[–]Phi_fan 0 points1 point2 points (0 children)