commit | ba22c85bcd34b6141c54e8ad1b39148ddc2f75a2 | [log] [tgz] |
---|---|---|
author | Xin Li <[email protected]> | Fri Feb 11 20:47:19 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Fri Feb 11 20:47:19 2022 +0000 |
tree | 6b326b447991163107c022a12e5328ff4f7904da | |
parent | 31d7d033ce97957ab074bb75c19fd585a1220c9c [diff] | |
parent | e59961059556536f1ab8bc29f39c1011a7c465e6 [diff] |
[automerger skipped] Empty merge of sc-v2-dev-plus-aosp-without-vendor@8084891 am: f3a298e692 -s ours am: e599610595 -s ours am skip reason: Merged-In I9602830da1debfad4a4be3df6f86f0c6aaebd1ea with SHA-1 7fc63fa7d6 is already in history Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/num-traits/+/16843769 Change-Id: I5e4d16076dc21e28f8c47f5005a9d4628ed7a40b
Numeric traits for generic mathematics in Rust.
Add this to your Cargo.toml
:
[dependencies] num-traits = "0.2"
and this to your crate root:
extern crate num_traits;
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 libm
feature is only available with Rust 1.31 and later (see PR #99).
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
.
Implementations for i128
and u128
are only available with Rust 1.26 and later. The build script automatically detects this, but you can make it mandatory by enabling the i128
crate feature.
Release notes are available in RELEASES.md.
The num-traits
crate is tested for rustc 1.8 and greater.
Licensed under either of
at your option.
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.