Releases: neogenie/fastnum
Releases · neogenie/fastnum
v0.7.3
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.
v0.7.2
v0.7.1
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.
v0.7.0
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.
v0.6.2
v0.6.1
v0.6.0
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).
v0.5.0
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.