Our great sponsors
-
rust-decimal
Decimal number implementation written in pure Rust suitable for financial and fixed-precision calculations.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
For mine, I switch the default floating type from f64 to decimal using https://docs.rs/rust_decimal/.
There are many optimisations to be done here. Perhaps most importantly, modulo can be implemented performantly using techniques such as those used by libdivide. You may use machine integers to represent such variables when their bound is such that an intermediate value would never overflow; and static analysis may identify opportunities to perform many calculations in sequence before reducing (but when operating on wide or extended-precision integers, this may hurt more than it helps).
Related posts
- Some f32 numbers refuse to round to decimal places properly.
- ETH: $23m transaction fee sent to a miner
- Learn Anything – Organize knowledge, explore connections, curate learning paths
- ATAC: A simple API client (postman like) in your terminal
- Show HN: A minimal workflow orchestrator for Python written in Rust