NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #2694 most downloaded on crates.io
Fixed-point numbers.
Last release 6 months ago
20 Mar 2026
Release timing varies
gaps range from 2 weeks to 11 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
16 versions withdrawn
withdrawn after publishing
8 years old
84 releases · first in 2018
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
The crate now requires rustc version 1.93.0 or later.
unchecked_neg method was added to all signed fixed-point
numbers and to the FixedSigned trait.Fixed trait:
All methods starting with unwrapped_ were renamed to start with strict_. The old method names are deprecated.
unwrapped_ were renamed to start with strict_.
The old method names are deprecated.Unwrapped wrapper was renamed to Strict. The old
name is deprecated.compat-readonly-static optional feature was
added to fix an issue on some platforms where statics are readonly (issue
74, merge request 14).defmt optional feature was added to support logging
using the [defmt crate] (issue 70).num-traits, the following
traits were implemented for all fixed-point numbers:
The crate now requires rustc version 1.83.0 or later.
Fixed trait, and to the Saturating,
Wrapping and Unwrapped wrappers:
unbounded_shl, unbounded_shrfrom_ascii, from_ascii_binary,
from_ascii_octal, from_ascii_hexsaturating_from_ascii,
saturating_from_ascii_binary,
saturating_from_ascii_octal,
saturating_from_ascii_hexwrapping_from_ascii,
wrapping_from_ascii_binary,
wrapping_from_ascii_octal,
wrapping_from_ascii_hexunwrapped_from_ascii,
unwrapped_from_ascii_binary,
unwrapped_from_ascii_octal,
unwrapped_from_ascii_hexoverflowing_from_ascii,
overflowing_from_ascii_binary,
overflowing_from_ascii_octal,
overflowing_from_ascii_hexcast_unsigned method was added to all signed fixed-point
numbers, to their Saturating, Wrapping and
Unwrapped wrappers, and to the Fixed trait.cast_signed method was added to all unsigned fixed-point
numbers, to their Saturating, Wrapping and
Unwrapped wrappers, and to the Fixed trait.ParseFixedError implements [Error] even when the std
optional feature is disabled.For all fixed-point numbers and the [Fixed][tf-1-28] trait, the following methods were renamed. The old method names are deprecated.
Fixed trait:
Fixed trait, the following
methods were renamed. The old method names are deprecated.
round_ties_to_even renamed to
round_ties_evenchecked_round_ties_to_even renamed to
checked_round_ties_evensaturating_round_ties_to_even renamed to
saturating_round_ties_evenwrapping_round_ties_to_even renamed to
wrapping_round_ties_evenunwrapped_round_ties_to_even renamed to
unwrapped_round_ties_evenoverflowing_round_ties_to_even renamed to
overflowing_round_ties_evenconsts module and as
associated constants to fixed-point types:
nightly-float was added.num-traits, the following
traits were implemented for all fixed-point numbers:
The [hypot][f-h-1-27] method was added to all fixed-point numbers, to the [Fixed][tf-1-27] trait, and to the [Saturating][s-1-27], [Wrapping][w-1-27]
The [sqrt][f-s-1-26] method was added to all fixed-point numbers, to the [Fixed][tf-1-26] trait, and to the [Saturating][s-1-26], [Wrapping][w-1-26] a
sqrt method was added to all fixed-point numbers, to the
Fixed trait, and to the Saturating,
Wrapping and Unwrapped wrappers.
checked_sqrt method was added to all fixed-point numbers
and to the Fixed trait.Bug fix: formatting numbers with [LowerExp] and [UpperExp] was producing incorrect output when rounding incremented a zero in the middle of a string,
LowerExp] and [UpperExp] was producing
incorrect output when rounding incremented a zero in the middle of a string,
for example format!("{:.2e}", I16F16::lit("9.099")).Bug fix: formatting numbers with [LowerExp] and [UpperExp] was producing incorrect output for very small numbers, for example format!("{:e}", I16F16::
LowerExp] and [UpperExp] was producing
incorrect output for very small numbers, for example
format!("{:e}", I16F16::DELTA).
LowerExp] and [UpperExp] was panicking
for some cases of positive exponents and small precision, for example
format!("{:.1e}", I16F16::from_num(1001)).LowerExp] and [UpperExp] was producing
incorrect output when rounding adds a more significant digit, for example
format!("{:.1e}", I16F16::lit("0.999")).borsh feature was promoted to an
optional feature, and the optional [borsh crate] dependency
was updated to version 1.0.The crate now requires rustc version 1.71.0 or later.
saturating_div_int method was added to all fixed-point
numbers and to the Fixed trait.Saturating wrapper was added.Bug fix: comparison of signed and unsigned numbers where the signed number was wider than the unsigned number was truncating bits from the signed numb
String parsing of binary, octal and hexadecimal strings now supports base-2 exponents starting with the separator “p” or “P”.
p” or “P”.
int_log10, int_log,
checked_int_log10 and checked_int_log were
panicking or returning incorrect values for fixed-point numbers with no
integer bits.The errors from the [lit][f-l-1-22] method have been improved.
lit][f-l-1-22] method have been improved.
track_caller attribute is now applied to many more inline functions
that can panic.String parsing now supports an optional exponent for all supported radices.
lit method was added to all fixed-point numbers. This is
useful to write fixed-point numbers literally in code and also works in
constant context.LowerExp] and [UpperExp].Fixed and FixedBits traits now have the added
supertraits [Binary], [Octal], [LowerHex], [UpperHex], [LowerExp]
and [UpperExp].Wrapping and Unwrapped wrappers now implement
[Binary], [Octal], [LowerHex], [UpperHex], [LowerExp] and
[UpperExp].Debug] for fixed-point numbers now has more relaxed
constraints on the fractional bits generic parameter: now Frac only needs
to implement Unsigned.Comparisons involving fixed-point numbers now have more relaxed constraints on the fractional bits generic parameter: now Frac only needs to implement
Frac only needs to implement
Unsigned.
The [const_fixed_from_int][cffi-1-20] macro is now deprecated.
TRY_ONE associated constant was added to the
Fixed trait.
TRY_NEG_ONE associated constant was added to the
FixedSigned trait.const_from_fixed and const_from_int
methods were added to all fixed-point numbers.const_fixed_from_int macro is now deprecated.F128
struct:
F128 now implements [From] for conversions from [f64],
[f32], f16 and bf16.F128 basic mathematical constants.Bug fix: comparison of and conversion from subnormal floating-point numbers to fixed-point numbers were off by a factor of 2.
FixedBits
trait:
FixedEquiv is now a supertrait of the FixedBits
trait.FixedBits now has more supertraits from the [num-traits
crate] if the num-traits experimental feature is enabled.The [F128][f128-1-18] struct was added to replace the [F128Bits][f128b-1-18] struct which is now deprecated. [F128][f128-1-18] has standard floating-p…
MIN by <code>-DELTA</code> for fixed-point numbers
with zero integer bits, that is when all bits are fractional bits (issue
51).
Fixed trait, and to the Wrapping and
Unwrapped wrappers:
F128 struct was added to replace the
F128Bits struct which is now deprecated. F128
has standard floating-point ordering and various classification methods and
associated constants.from_str_dec method was added to the
Unwrapped wrapper.Contiguous trait from the [bytemuck crate] was implemented
for all fixed-point numbers, added as a supertrait to the Fixed
trait, and implemented for the Wrapping and
Unwrapped wrappers.The [*half* crate] dependency was updated to [version 2][half-2].
from_str method was added as a const function
to all fixed-point numbers so that it can be use in constant context.const functions:
saturating_from_str, wrapping_from_str,
overflowing_from_strfrom_str_binary,
saturating_from_str_binary,
wrapping_from_str_binary,
overflowing_from_str_binaryfrom_str_octal,
saturating_from_str_octal,
wrapping_from_str_octal,
overflowing_from_str_octalfrom_str_hex,
saturating_from_str_hex,
wrapping_from_str_hex,
overflowing_from_str_hexchecked_div, saturating_div,
wrapping_div, unwrapped_div,
overflowing_divrecip, checked_recip,
saturating_recip, wrapping_recip,
unwrapped_recip, overflowing_recipchecked_rem_int, unwrapped_rem_intdiv_euclid, checked_div_euclid,
saturating_div_euclid,
wrapping_div_euclid,
unwrapped_div_euclid,
overflowing_div_eucliddiv_euclid_int, checked_div_euclid_int,
saturating_div_euclid_int,
wrapping_div_euclid_int,
unwrapped_div_euclid_int,
overflowing_div_euclid_intrem_euclid_int, checked_rem_euclid_int,
saturating_rem_euclid_int,
wrapping_rem_euclid_int,
unwrapped_rem_euclid_int,
overflowing_rem_euclid_intlerp, checked_lerp,
saturating_lerp, wrapping_lerp,
unwrapped_lerp, overflowing_lerpinv_lerp, checked_inv_lerp,
saturating_inv_lerp, wrapping_inv_lerp,
unwrapped_inv_lerp, overflowing_inv_lerpFixed trait:
Unwrapped wrapper:
FromStr]>::[from_str][FromStr::from_str]</code>*Cargo.toml* now includes the [rust-version] field ([merge request 11]).
rust-version] field ([merge request 11]).The crate now requires rustc version 1.61.0 or later.
NEG_ONE constant was added to all signed fixed-point
numbers that can represent the value −1.add_prod method was added to all fixed-point numbers, to
the Fixed trait, and to the Wrapping and
Unwrapped wrappers.Fixed trait:
const functions:
int, frac, round_to_zeroceil, checked_ceil,
saturating_ceil, wrapping_ceil,
unwrapped_ceil, overflowing_ceilfloor, checked_floor,
saturating_floor, wrapping_floor,
unwrapped_floor, overflowing_floorround, checked_round,
saturating_round, wrapping_round,
unwrapped_round, overflowing_roundround_ties_to_even,
checked_round_ties_to_even,
saturating_round_ties_to_even,
wrapping_round_ties_to_even,
unwrapped_round_ties_to_even,
overflowing_round_ties_to_evenint_log2, checked_int_log2,
int_log10, checked_int_log2wide_mul, wide_mul_unsigned,
wide_mul_signedwide_div, wide_sdiv,
wide_div_unsigned, wide_sdiv_signedchecked_mul, saturating_mul,
wrapping_mul, unwrapped_mul,
overflowing_mulmul_add, checked_mul_add,
saturating_mul_add, wrapping_mul_add,
unwrapped_mul_add,
overflowing_mul_addsignum, checked_signum,
saturating_signum, wrapping_signum,
unwrapped_signum, overflowing_signumThe following methods were added to all fixed-point signed numbers up to 64 bits wide:
wide_mul_unsigned
* wide_sdiv
* wide_div_unsigned
The [next_multiple_of][f-nmo-1-14] method was added to all fixed-point numbers, to the [Fixed][tf-1-14] trait, and to the [Wrapping][w-1-14] and [Unwr
next_multiple_of method was added to all fixed-point
numbers, to the Fixed trait, and to the Wrapping
and Unwrapped wrappers.
Fixed trait:
FixedSigned trait, and to the Wrapping and
Unwrapped wrappers for signed numbers:
FixedUnsigned trait, and to the Wrapping and
Unwrapped wrappers for unsigned numbers:
The [const_fixed_from_int][cffi-1-13] macro now accepts a visibility qualifier ([merge request 10]).
const_fixed_from_int][cffi-1-13] macro now accepts a visibility
qualifier ([merge request 10]).The [AddAssign], [SubAssign], [MulAssign], [DivAssign], [RemAssign], [BitAndAssign], [BitOrAssign] and [BitXorAssign] traits for [Wrapping][w-1-13]<F>
AddAssign], [SubAssign], [MulAssign], [DivAssign],
[RemAssign], [BitAndAssign], [BitOrAssign] and [BitXorAssign] traits
for <code>Wrapping<F></code> and
<code>Unwrapped<F></code> are now also implemented with F as
the type of the right-hand side operand.
The crate now requires rustc version 1.57.0 or later.
wide_div method was added to all fixed-point numbers up to
64 bits wide ([issue 25]).const functions:
The following methods were added to all fixed-point numbers, to the [Fixed][tf-1-11] trait, and to the [Wrapping][w-1-11] and [Unwrapped][u-1-11] wrap
Fixed trait, and to the Wrapping and
Unwrapped wrappers:
* lerp
* inv_lerp
Fixed trait:
LeEqU8, LeEqU16, LeEqU32,
LeEqU64 and LeEqU128 traits no longer have
a direct 'static constraint, as it is a constraint of their supertrait
Unsigned since typenum version 1.14. This
fixes a potential compatibility issue introduced in version 1.9.0.The crate now requires rustc version 1.53.0 or later.
Div],[DivAssign][DivAssign],[Rem][Rem],[RemAssign][RemAssign]}<[NonZeroU32][NonZeroU32]></code>
are now implemented for FixedU32, and similar for all other
unsigned fixed-point numbers.Rem],[RemAssign][RemAssign]}<[NonZeroI32][NonZeroI32]></code>
are now implemented for FixedI32, and similar for all other
signed fixed-point numbers.arbitrary optional feature was added to implement the
Arbitrary trait provided by the [arbitrary crate] for all
fixed-point numbers (issue 37).Fixed-point numbers can now be formatted as hexadecimal with [Debug] similarly to primitive integers, for example formatting with {:X?} will produce u
Debug]
similarly to primitive integers, for example formatting with {:X?} will
produce upper-case hexadecimal fixed-point numbers.
Fixed trait, and to the Wrapping and
Unwrapped wrappers:
Fixed trait:
unsigned_dist method was added to all signed
fixed-point types and to the FixedSigned trait.Fixed trait:
FixedEquiv was added.Fixed trait,
and implemented for the Wrapping and Unwrapped
wrappers (issue 31).
Debug] implementation for Wrapping outputs the value
only without “Wrapping()”, and the [Debug] implementation for
Unwrapped outputs the value only without “Unwrapped()”.LeEqU8, LeEqU16, LeEqU32,
LeEqU64 and LeEqU128 traits now have a
'static constraint. This should have no practical side effects, since
these traits are a convenience feature and already have the
Unsigned marker trait as a supertrait, and the types that
implement Unsigned are 'static.FixedOptionalFeatures trait was not sealed, which was as an
oversight. Now it is sealed, and the documentation explicitly states that
the trait should not be used directly.The following constants and method were added to all fixed-point numbers, to the [Fixed][tf-1-8] trait, and to the [Wrapping][w-1-8] and [Unwrapped][u
Fixed trait, and to the Wrapping and
Unwrapped wrappers:
* ZERO, DELTA
* mul_acc
ONE constant was added to all fixed-point numbers that can
represent the value 1.Fixed trait:
const functions:
must_use attribute.The [az][feat-dep-1-7] and [f16][feat-dep-1-7] optional features are now deprecated and have no effect.
const functions:
Fixed trait, and to the Wrapping and
Unwrapped wrappers:
Wrapping and
Unwrapped wrappers:
FixedUnsigned trait, and to the Wrapping and
Unwrapped wrappers for unsigned numbers:
signed_bits method was added to all signed fixed-point
types, to the FixedSigned trait, and to the Wrapping
and Unwrapped wrappers for signed numbers.consts module and as
associated constants to fixed-point types:
SQRT_PI (Go), FRAC_1_SQRT_PI (C++)SQRT_3 (C++), FRAC_1_SQRT_3 (C++)SQRT_E (Go)SQRT_PHI (Go)GAMMA (C++)CATALAN (Julia)Sum] and [Product] are now supertraits of the Fixed trait.F128Bits type was added to support conversions and
comparisons between fixed-point numbers and binary128 floating-point
numbers.az and
f16 optional features are now always provided. The
az and f16 optional features are now
deprecated and have no effect.num-traits, the following
traits were implemented for all fixed-point numbers:
The crate now requires rustc version 1.47.0 or later.
unsigned_abs method was added to all signed fixed-point
types and to the FixedSigned trait.const functions:
unwrapped_to_fixed method was added to the
ToFixed trait.unwrapped_from_fixed method was added to the
FromFixed trait.The [wide_mul][f-wm-1-5] method was added to all fixed-point numbers up to 64 bits wide ([issue 25]).
wide_mul method was added to all fixed-point numbers up to
64 bits wide (issue 25).
Unwrapped
wrapper were added. Unwrapped methods panic on overflow, even when debug
assertions are disabled, similar to how wrapping methods will wrap around
even when debug assertions are enabled. (This was previously an experimental
feature unwrapped.)serde-str feature was added. (This was previously an
experimental feature.)num-traits, some missing
supertraits were added to FixedOptionalFeatures.FixedI128 was panicking when
multiplying some large negative numbers (issue 26).The following methods were added to all fixed-point types, to the [Fixed][tf-1-4] trait, and to the [Wrapping][w-1-4] wrapper:
Fixed trait, and to the Wrapping wrapper:
* recip, checked_recip,
saturating_recip, wrapping_recip,
overflowing_recip
num-traits, the following
traits were implemented where applicable (issue 23):
serde-str, serialization in
human-readable formats was made more convenient to write manually (issue
24). This makes it incompatible with the version in 1.3.0.The [MulAssign] implementation on fixed-point numbers now accepts an rhs fixed-point number with a different number of fractional bits from self.
MulAssign] implementation on fixed-point numbers now accepts an rhs
fixed-point number with a different number of fractional bits from self.
Fixed trait, and to the Wrapping wrapper:
unwrapped was added,
providing arithmetic methods that panic on overflow even when debug
assertions are disabled.serde-str was added, which
makes serialization use the number’s value in human-readable formats.The [const_fixed_from_int!][cffi-1-2] macro was added to make it easy to define constant fixed-point numbers using integer expressions ([issue 20]).
const_fixed_from_int! macro was added to make it easy to
define constant fixed-point numbers using integer expressions (issue 20).The new experimental feature [num-traits][feat-nt-1-1] was added to implement some traits, and to also add the relevant traits as supertraits to the [
num-traits was added to
implement some traits, and to also add the relevant traits as supertraits to
the FixedOptionalFeatures trait (issue 18).All deprecated items were removed.
const functions:
The LosslessTryFrom and LosslessTryInto traits were added.
LosslessTryFrom and LosslessTryInto traits were added.
Fixed
trait, and to the Wrapping wrapper:
leading_ones, trailing_onesFixedUnsigned trait:
wrapping_next_power_of_twoPHI and FRAC_1_PHI constants were added to the consts module and
as associated constants to fixed-point types.Casts deprecated in version 0.3.1 of the *az* crate were marked as deprecated.
FixedSigned trait:
* checked_signum, saturating_signum, wrapping_signum,
overflowing_signum
LossyFrom and LossyInto traits were added to the prelude.The following methods were deprecated:
FixedI to a number that would overflow by
exactly one bit when converting to FixedI.
Fixed trait, and to the Wrapping wrapper:
MIN, MAXFixed trait and to
the Wrapping wrapper:
INT_NBITS, FRAC_NBITSFixed
trait:
int_log2, int_log10checked_int_log2, checked_int_log10Wrapping wrapper:
int_log2, int_log10consts module were also added as associated constants
to fixed-point types that can represent them.min_value, max_valueint_nbits, frac_nbitsBug fix: rem_euclid_int and its checked versions were handling overflow incorrectly.
rem_euclid_int and its checked versions were handling overflow
incorrectly.The following methods were deprecated:
round_to_zero was returning incorrect results for negative whole
number operands.
Rem and RemAssign were implemented for fixed-point numbers.Fixed
trait:
checked_remdiv_euclid, rem_euclidchecked_div_euclid, checked_rem_euclidsaturating_div_euclidwrapping_div_euclidoverflowing_div_euclidWrapping wrapper:
div_euclid, rem_eucliddiv_euclid_int, rem_euclid_intwrapping_rem_int, overflowing_rem_intWrapping now supports serialization. (Thanks: Shane Pearman)
Wrapping now supports serialization. (Thanks: Shane Pearman)Your coding agent can read these notes before it upgrades. Set up the MCP server →