num-traits icon indicating copy to clipboard operation
num-traits copied to clipboard

Numeric traits for generic mathematics in Rust

Results 114 num-traits issues
Sort by recently updated
recently updated
newest added

Hello, I was looking for a type that could only ever increase. Useful for the CPU side of Vulkan's Timeline Semaphores. I know I could trivially implement this, I was...

Closes https://github.com/rust-num/num-traits/issues/250 This adds `CheckedSum` and `CheckedProduct` traits as well as blanket implementations for them. It also adds `CheckedSumIter` and `CheckedProductIter` traits and blanket implementations for those as that provides...

The Rust language team decided not to add `CheckedSum` and `CheckedProduct` traits to core https://github.com/rust-lang/rust/pull/95485 but it was suggested that they be added here. These traits allow you to add...

[There is][err-place] `autocfg` can't determine target details for custom target-spec (json file). Error: ```text [num-traits 0.2.19] error: Error loading target specification: Could not find specification for target "my-custom-target". Run `rustc...

Blocked by #327 ### Motivation The trait method `float::Float::integer_decode` invokes one of the functions `integer_decode_f32` or `integer_decode_f64` depending on the implementation. These functions share a lot of code, so I...

### Motivation While working on #326, I saw an opportunity to add unit test coverage for the trait method `float::Float::integer_decode`. I hope others find this helpful when troubleshooting this method....

Working with numerics in `num-traits` is biased towards using the standard traits, which is generally good. However, checked arithmetic is lacking a unifying trait (like `NumOps`). This PR adds that....

`ToPrimitive` implements conversions to all primitive numeric types, and provides `to_T` functions for each `T`, but `AsPrimitive` only implements a conversion to a single type, and there is currently no...

Given the IEEE total-ordering predicate and `.is_nan()`, we can implement NaN propagating minmax, cf. `f32::maximum`. I'm not sure if using `.is_nan()` with `trait TotalOrder: FloatCore` is the best idea, but...

When working in a generic context, it would be useful to access whether a PrimInt-based generic type is signed or not signed at build time. ```rust fn foo(v: X) where...