Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
rust: [
1.85.0, # MSRV
1.86.0, # MSRV
stable,
beta,
nightly,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
5 changes: 5 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 8 additions & 0 deletions src/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down