fastnum
Fast decimal numbers library
0.7.5
5.7M downloads/mo
#4251 most downloaded on crates.io
neogenie/fastnum
What this package is like to depend on
Last release 2 months ago
11 Jun 2026
Release timing varies
gaps range from 9 days to 6 months
Most releases are documented
notes for 44 of 51 stable releases
7 versions withdrawn
withdrawn after publishing
2 years old
58 releases · first in 2024
5 releases in the last 12 months
see the full history below
Release timeline
58 releases · Oct 2024 to Jun 2026Releases
latest 58-
0.7.511 Jun 2026Release notes
Open source →Fixed
- Hashcode in Decimal violates
the hash contract: #59. - Add
serde-arbitrary-precisionfeature to enable arbitrary precision serialization and deserialization forDecimal
andUnsignedDecimaltypes viaarbitrary-precisionfeature ofserde_json. - bump MSRV to 1.94
- Hashcode in Decimal violates
-
0.7.416 Dec 2025 -
0.7.314 Oct 2025Release notes
Open source →Fixed
- Sign Extension Not Performed in From<i32/i64>, Cast, and TryCast for Signed Integers #52.
Internal
- Refactored integer conversion implementation for better code organization and maintainability.
- Simplified signed integer conversion methods by removing redundant intermediate logic.
- Improved macro handling for literal construction to properly support token concatenation.
- Reorganized test infrastructure with macro-based test generation for comprehensive coverage of integer conversions across different bit widths (64/128/256/512).
- Consolidated test structure by moving conversion tests into dedicated modules with automatic test generation for all supported integer types.
-
0.7.221 Sep 2025Release notes
Open source →Fixed
- Incorrect division result for numbers with large amount of decimal digits #49.
- Fix
no_stdbuild #50.
Changed
- Improve debug formatting of
DecimalandUnsignedDecimal.
Examples
- Add
no_stdwasm example #50.
-
0.7.130 Aug 2025Release notes
Open source →Fixed
- .ln() panic regression (0.2.10 -> 0.7.0) #46.
Changed
- Improve log implementation #38.
Documentation
- Documentation for
Decimal::with_rounding_modeandDecimal::with_ctx:- Clarified that when changing the rounding mode, any existing extra precision (if present) is immediately rounded
using the new rule. - Clarified that applying a new context may trigger traps if the current value already has signaling flags set (
e.g.,INEXACT) and the new context enables traps for those signals; this may result in a panic depending on
build/configuration.
- Clarified that when changing the rounding mode, any existing extra precision (if present) is immediately rounded
- Minor fixes.
-
0.7.021 Aug 2025Release notes
Open source →Added
- Big-integer conversion APIs #44:
-
Parsing from raw bytes:
from_radix_be(buf, radix) -> Option<Self>from_radix_le(buf, radix) -> Option<Self>
-
Encoding to raw bytes:
to_radix_be(radix) -> Vec<u8>to_radix_le(radix) -> Vec<u8>
-
String conversion helpers:
parse_str_radix(s, radix) -> Self(panicking variant)parse_bytes(buf, radix) -> Option<Self>to_str_radix(radix) -> String
-
Documentation
- Conversion documentation expanded with clearer semantics, base handling, and examples.
- Improved doc comments for:
- Base-aware parsing behavior and panic conditions.
- Byte-level import/export helpers.
parse_str(s)andfrom_str(s)for big integers recognize0xand0bprefixes (decimal remains default without a prefix).
Internal
- Conversion code reorganized into focused modules:
bint/convert/{from_bytes,to_bytes,from_str,to_str}.rs
- Macro routing for conversion implementation is simplified and deduplicated.
- Big-integer conversion APIs #44:
-
0.6.217 Aug 2025 -
0.6.116 Aug 2025 -
0.6.015 Aug 2025Release notes
Open source →Breaking changes
- Removed previously deprecated Decimal methods:
from_scale(usequantuminstead).normalized(usereduceinstead).with_scale(userescaleinstead).
Added
- Decimal truncation API (#39):
Decimal::trunc()— truncates to integral with no fractional portion without rounding.Decimal::trunc_with_scale(scale)— truncates to the specified scale without rounding.
Changed
- Internal documentation macro routing for decimal type aliases refined (no public API impact).
Documentation
- Minor fixes.
- Added a dedicated “Truncate” section with behavior details and examples.
Internal
- Introduced an internal truncation implementation integrated with scaling and extra-precision handling to ensure true
truncation semantics (no rounding).
- Removed previously deprecated Decimal methods:
-
0.5.014 Aug 2025Release notes
Open source →Added
- Type conversion traits for integers and decimals:
Cast— type-safe, infallible conversion (e.g., widening or lossless transforms).TryCast— checked conversion returning an error on overflow, sign mismatch, or incompatible scale.- Supported families: unsigned/signed big integers (
U64,U128,U256,U512,U1024, andI64,I128,
I256,I512,I1024) #42 and decimals (UD64,UD128,UD256,UD512,UD1024, andD64,D128,D256,
D512,D1024). - Common scenarios:
- Widening cast for integers — via
Cast. - Checked narrowing cast — via
TryCast, with overflow errors. - Conversions between unsigned and signed integers —
TryCastrejects negative/out-of-range values. - Conversions between
UD*andD*— proper sign/scale propagation with checks inTryCast.
- Widening cast for integers — via
- Const-generic “dimensions” for conversion direction checks:
- Internal
Widen/Narrowmarkers ensureCast/TryCastcorrectness without unstable generic const expressions.
- Internal
Deprecated
- Decimal
.transmute()is now deprecated (since "0.5.0"); removal is planned for a future major release.
Use.resize()or cast viaCastandTryCasttraits instead.
Documentation
- Minor fixes and clarifications; added usage examples for type conversions.
- Type conversion traits for integers and decimals:
-
0.4.512 Aug 2025Nothing published for this version
-
0.4.412 Aug 2025Nothing published for this version
-
0.4.312 Aug 2025Nothing published for this version
-
0.4.211 Aug 2025 withdrawnNothing published for this version
-
0.4.110 Aug 2025 withdrawnNothing published for this version
-
0.4.010 Aug 2025 withdrawnNothing published for this version
-
0.3.222 Jul 2025 -
0.3.120 Jul 2025Release notes
Open source →Changed
This release is mostly focused on fix: #34.
Converting decimal numbers to floating point IEEE 754 was completely redesigned. Implementation is based on LLVM’s libc experience: https://llvm.org/devmtg/2022-11/slides/QuickTalk3-ApproximatingatScale-StringToFloat.pdf Algorithms:
- First pass: Clinger’s Fast Path: Clinger WD. How to Read Floating Point Numbers Accurately.
- Second Pass: Eisel-Lemire fast_float: Number Parsing at a Gigabyte per Second and Noble Mushtak, Daniel Lemire. Fast number parsing without fallback.
- Third Pass: Simple Decimal Conversion Nigel Tao’s description of the Simple Decimal Conversion algorithm.
Documentation
- Add decimal -> f64 conversion benchmarks.
-
0.3.015 Jul 2025Release notes
Open source →Changed
- Bump Rust version to
1.87(stabilize#![feature(integer_sign_cast)]). - Replace big integer's implementation from
bnumtype aliasing to wrapped types. - Some minor performance optimizations.
- Bump Rust version to
-
0.2.1004 Jun 2025 -
0.2.902 Jun 2025 -
0.2.817 May 2025Release notes
Open source →Added
- Add
impl From<UnsignedDecimal> for Decimalconvertion trait implementation.
Fixed
- Fix display rounding error: #24.
- Add
-
0.2.715 May 2025 -
0.2.613 May 2025Release notes
Open source →Fixed
- The comparison function does not correctly implement a total order: #21.
-
0.2.503 May 2025Release notes
Open source →Added
- Examples for compile time environment variables.
Fixed
- Failing to converge the Brent iterative method for calculating reciprocals (infinity loop): #20.
-
0.2.403 May 2025 -
0.2.307 Apr 2025 -
0.2.222 Feb 2025Release notes
Open source →Changed
- Some float2decimal performance optimizations.
Fixed
- Minor fixes in float2decimal conversion.
- Minor fixes with extra precision digits.
-
0.2.118 Feb 2025 -
0.2.017 Feb 2025Release notes
Open source →This release primarily focuses on:
- Increasing the accuracy of approximated mathematical calculations due to the use of
7extra precision digits instead of4. - Performance optimizations.
Expect better performance, precision handling, and expanded documentation covering new methods and examples.
- Bump Rust version to
1.83
Added
floor()andceil()const methods.- Add basic tests for trivial trigonometric functions for 0–360 degree angles.
Changed
- Control block is completely refactored for better performance and more compact memory layout.
- Micro-optimizations in rounding.
- Inline optimizations and better precision handling for mathematical rounding.
- Remove custom const float helpers as they're stabilized as const in rust 1.83.
Fixed
- Incorrect
floor()andceil()methods innum_traitsFloatimplementation.
Documentation
- Minor fixes.
- Increasing the accuracy of approximated mathematical calculations due to the use of
-
0.1.1307 Feb 2025Release notes
Open source →Added
- Add
tokio-postgresfeature which enables serialization and deserialization offastnumdecimals fortokio-postgrescrate #8. - Add
tokio-postgresandsqlx_postgresexamples.
Documentation
- Minor fixes.
- Add
-
0.1.1206 Feb 2025 -
0.1.1104 Feb 2025 -
0.1.1004 Feb 2025Release notes
Open source →This release primarily focuses on:
- Implementing a full range of advanced mathematical functions (exponential, roots, power, logarithmic, and trigonometric functions) for working with exact precision decimal numbers.
- Increasing the accuracy of approximated mathematical calculations due to the use of extra precision digits and the absence of intermediate rounding.
- Fixing and improving conversions between Float and Decimal types.
Expect better performance, precision handling, and expanded documentation covering new methods, constants, and examples. Highlights include removing
libmdependency and major refinements forno-stdenvironments.Added
- Implement exponential
expand binary exponentialexp2functions for decimals. - Implement logarithmic
ln,log10,log2,logfunctions for decimals. - Implement
sqrt,cbrt, andnth_rootroots functions for decimals. - Refactor and extend
powto support non-integer exponents. - Implement base trigonometric functions:
sin,cos,tan,sin_cosfor decimals. - Implement inverse trigonometric functions:
asin,acos,atan,atan2for decimals. - Implement hyperbolic functions:
sinh,cosh,tanhfor decimals. - Implement inverse hyperbolic functions:
asinh,acosh,atanhfor decimals. - Implement hypotenuse calculation
hypotfunction for decimals. - Introduce fused multiply-add
mul_addoperation without intermediate rounding. - Introduce
transmuteoperation for N-to-M bit decimal conversion. - Add integer and unsigned integer conversion utilities (
from_int,from_uint). - Implement
num_traits::float::Floattrait.
Changed
- Improved arithmetic precision of approximated mathematical calculations due to the use of extra precision digits and the absence of intermediate rounding.
- Overhauled mathematical constants. Add
INEXACTflag and extra precision digits. - Mark some methods as
inexactby design. - Micro-optimizations in rounding.
- Inline optimizations and better precision handling for mathematical rounding.
- Re-implement
recipmethod without division. - Improve test coverage for mathematical operations (e.g.,
sqrt,ln,exp). - Remove
libmdependency forno-stdenvironment.
Fixed
- Corrected edge cases for float (
f32/f64) from/toDecimalconversions (fix #5). - Fix long rounding issues with improved context precision.
- General code quality improvements and bug fixes, including better inexact flag handling.
Documentation
- Expanded documentation for all major operations with examples.
- Added comprehensive examples and descriptions to
LIB.md. - Minor fixes.
-
0.1.901 Jan 2025Release notes
Open source →Breaking changes
- Replace
decimal::Categorywithcore::num::FpCategory.
Changed
- Micro-optimizations in rounding.
- Make
.from_parts()constructor public (Way to directly create decimals with scale without dividing? #3).
Added
- Implement
TryFrom<Decimal>forUnsignedDecimalandFrom<UnsignedDecimal>forDecimaltraits.
Fixed
- Fixed minor issues with ceil/floor rounding.
- Replace
-
0.1.829 Dec 2024Release notes
Open source →Fixed
- Fixed a performance issue with parsing and rescaling during arithmetic operations.
Changed
- Replace
ilog10method for integers with faster algorithm. - Replace
x 10multiplication with a faster algorithm (const static lookup table). - Some performance improvements.
-
0.1.725 Dec 2024Release notes
Open source →Fixed
- Division by divisor with non-scalable coefficient.
Changed
- More strict
#[repr]for Decimal type. - Documentation improvements.
Added
- Implement
num_traits::float::FloatCoretrait. - Add
MIN_POSITIVEandEPSILONconstants. - Add
.powi(),.recip(),.to_degrees(),.to_radians()methods.
-
0.1.624 Dec 2024Release notes
Open source →Changed
- Documentation improvements.
Added
- Add basic mathematical constants (
PI,E, etc.). - Implement
num_traits::FloatConsttrait.
-
0.1.522 Dec 2024 -
0.1.422 Dec 2024Release notes
Open source →The main goals of this release are:
- Stabilize API for more stringent compliance with the recommendations of IEEE 754 and IEEE 854 standards.
- Refactor decimal module and simplify context usage.
Breaking changes
- Remove [
Context] from a most methods argument list and put it into decimal control block for better context handling. Now [Context] is a property of any Decimal number instance.
Added
- Extend test coverage.
Changed
- Documentation improvements.
- Deprecate and replace some outdated methods to align with the updated structure and functionality.
- Benchmarks were modularized into separate operations, enhancing clarity and maintainability.
-
0.1.316 Dec 2024Release notes
Open source →Added
- Extend test coverage.
Fixed
sqlxsupport forPostgreSQL.
Changed
- Minor documentation fixes.
- Remove
const_strdependency.
-
0.1.215 Dec 2024Release notes
Open source →Added
- Added
signals!macro. - Extend test coverage.
Changed
- Deprecated
with_scale!in favor ofquantum!. - Documentation improvements.
- Added
-
0.1.111 Dec 2024 -
0.1.011 Dec 2024Release notes
Open source →Breaking changes
- Internal decimal representation for signed and unsigned decimal types.
- Reduce exponent from
64bit to16bit. - Remove
DecimalResultand unwrap methods. - Replace
ArithmeticPolicy,OverflowPolicy,RoundingPolicywithContext.
Added
- Add
NaNand±Infinityspecial values. - Add
FlagsandSignal. - Add
ContextandSignalingTraps. - Add
with_context!macro.
Fixed
- Fix panic shift with overflow.
Changed
- Stabilize API.
- Re-implement most methods.
- Documentation improvements.
-
0.0.1427 Nov 2024Release notes
Open source →- Fix rounding subtraction.
- Extend test coverage for
numtraitsfeature. - Documentation improvements.
-
0.0.1324 Nov 2024 -
0.0.1222 Nov 2024Nothing published for this version
-
0.0.1121 Nov 2024Nothing published for this version
-
0.0.1021 Nov 2024Nothing published for this version
-
0.0.921 Nov 2024 -
0.0.819 Nov 2024 -
0.0.719 Nov 2024 -
0.0.619 Nov 2024 -
0.0.506 Nov 2024Nothing published for this version
-
0.0.406 Nov 2024 withdrawnNothing published for this version
-
0.0.305 Nov 2024 withdrawnNothing published for this version
-
0.0.225 Oct 2024 withdrawnNothing published for this version
-
0.0.121 Oct 2024 withdrawn