fastnum v0.1.11 has landed!
New release v0.1.11 of fastnum - fast, exact precision decimal numbers crate. It provides signed and unsigned exact precision decimal numbers suitable for financial calculations that require significant integral and fractional digits with no round-off errors (such as 0.1 + 0.2 ≠ 0.3).
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.
All methods are const, so you can calculate e^(x) or even sin(x) as constant in compile-time.
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 optimization 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 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.
Docs: https://docs.rs/fastnum/latest/fastnum/
GitHub: https://github.com/neogenie/fastnum
Reddit intro: https://www.reddit.com/r/rust/comments/1hk61om/announcing_a_new_fast_exact_precision_decimal/
Feedback on this here or on GitHub is welcome! Thanks!