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

Pretty much the title. I am wondering about the reasoning that `Float` would allow `x = x + a` but not `x += a`.

# Objective Since Rust 1.77, [`round_ties_even`](https://doc.rust-lang.org/std/primitive.f32.html#method.round_ties_even) was added to `f32` and `f64` in the standard library. This function is used within [WGPU](https://github.com/gfx-rs/wgpu), and as a part of a push for...

This threw me off because floats saturate at `±INF`, but I'm not sure if subtleties around `NaN`s are what's keeping Saturation Operations from being implemented for `f32` and `f64`.

This implements [Saturating Ops for floats (#361)](https://github.com/rust-num/num-traits/issues/361).

I have a use-case for a function supporting both big integers and primitive integers. It would be useful to be able to get the minimum and maximum value as an...

It is very confusing as a user that `num-traits` contains the `Real` trait, but not the `Integer` trait. See for instance https://github.com/rust-num/num-traits/issues/219 and https://github.com/rust-num/num-traits/issues/357. Having a link in the documentation...

(Note: this idea is currently only appliable on nightly, as it requires `generic_const_exprs`.) `FromBytes` and `ToBytes` are declared like this: ```rust pub trait FromBytes { type Bytes: NumBytes + ?Sized;...

`f32::ZERO` and `f64::ZERO` are currently `+0.0`, which is not the additive identity. For non-NaN `f32` and `f64` under default rounding, the additive identity is `-0.0` and not `+0.0`, since `(-0.0)...

Adds functionality as requested in #252. This is done by adding `ConstLowerBounded` and `ConstUpperBounded` traits, with associated costs of `const MIN: Self` and `const MAX: Self`, respectively. In addition, I...

https://github.com/rust-num/num-traits/blob/022f250f7c12955166dd2ebe776f74e1707312a2/src/ops/euclid.rs#L23 Is there any particular reason the functions of `trait Euclid` takes their args by reference, instead of by value? In std `f32::rem_euclid` also takes them by value, not reference,...