#numeric

no-std num-traits

Numeric traits for generic mathematics

31 releases

0.2.19 May 3, 2024
0.2.18 Feb 8, 2024
0.2.17 Oct 7, 2023
0.2.16 Jul 20, 2023
0.1.34 Jul 24, 2016

#41 in Math

Download history 2716317/week @ 2024-08-07 2524382/week @ 2024-08-14 2624755/week @ 2024-08-21 2499455/week @ 2024-08-28 2790976/week @ 2024-09-04 2582229/week @ 2024-09-11 2638128/week @ 2024-09-18 2852418/week @ 2024-09-25 3273055/week @ 2024-10-02 3357512/week @ 2024-10-09 3452938/week @ 2024-10-16 2818480/week @ 2024-10-23 2896018/week @ 2024-10-30 2754456/week @ 2024-11-06 2822454/week @ 2024-11-13 2776993/week @ 2024-11-20

11,774,828 downloads per month
Used in 50,668 crates (4,308 directly)

MIT/Apache

240KB
4K SLoC

num-traits

crate documentation minimum rustc 1.60 build status

Numeric traits for generic mathematics in Rust.

Usage

Add this to your Cargo.toml:

[dependencies]
num-traits = "0.2"

Features

This crate can be used without the standard library (#![no_std]) by disabling the default std feature. Use this in Cargo.toml:

[dependencies.num-traits]
version = "0.2"
default-features = false
# features = ["libm"]    # <--- Uncomment if you wish to use `Float` and `Real` without `std`

The Float and Real traits are only available when either std or libm is enabled.

The FloatCore trait is always available. MulAdd and MulAddAssign for f32 and f64 also require std or libm, as do implementations of signed and floating- point exponents in Pow.

Releases

Release notes are available in RELEASES.md.

Compatibility

The num-traits crate is tested for rustc 1.60 and greater.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~100KB