diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 314692d..7eeb4f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: rust: [ - 1.85.0, # MSRV + 1.86.0, # MSRV stable, beta, nightly, @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.85.0 + - uses: dtolnay/rust-toolchain@1.86.0 with: components: rustfmt - run: cargo fmt --all --check diff --git a/Cargo.toml b/Cargo.toml index 782477a..ef22b25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "num-primitive" -version = "0.2.1" +version = "0.2.2" description = "Traits for primitive numeric types" repository = "https://github.com/rust-num/num-primitive" license = "MIT OR Apache-2.0" keywords = ["generic", "mathematics", "numerics", "primitive"] categories = ["algorithms", "science", "no-std"] edition = "2024" -rust-version = "1.85" +rust-version = "1.86" [features] default = ["std"] diff --git a/RELEASES.md b/RELEASES.md index d9a5eb5..268c4af 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,8 @@ +# Release 0.2.2 (2025-12-16) + +- Updated to MSRV 1.86. +- Added `PrimitiveFloat::next_down` and `next_up`. + # Release 0.2.1 (2025-12-16) - Doc-only, updated 0.1 references to 0.2. diff --git a/src/float.rs b/src/float.rs index 8d501b7..104d146 100644 --- a/src/float.rs +++ b/src/float.rs @@ -224,6 +224,12 @@ pub trait PrimitiveFloat: /// Returns the minimum of the two numbers, ignoring NaN. fn min(self, other: Self) -> Self; + /// Returns the greatest number less than `self`. + fn next_down(self) -> Self; + + /// Returns the least number greater than `self`. + fn next_up(self) -> Self; + /// Takes the reciprocal (inverse) of a number, `1/x`. fn recip(self) -> Self; @@ -523,6 +529,8 @@ macro_rules! impl_float { fn max(self, other: Self) -> Self; fn midpoint(self, other: Self) -> Self; fn min(self, other: Self) -> Self; + fn next_down(self) -> Self; + fn next_up(self) -> Self; fn recip(self) -> Self; fn signum(self) -> Self; fn to_bits(self) -> Self::Bits;