bf16 floating point types for Rust
This crate implements a half-precision floating point
f16 type for Rust implementing the IEEE
half format, as well as a
bf16 type implementing the
bf16 types provides conversion operations as a normal Rust floating point type, but
since they are primarily leveraged for minimal floating point storage and most major hardware does
not implement them, all math operations are done as an
f32 type under the hood. Complex arithmetic
should manually convert to and from
f32 for better performance.
This crate provides
no_std support by
default so can easily be used in embedded code where a smaller float format is most useful.
Requires Rust 1.58 or greater. If you need support for older versions of Rust, use 1.x versions of this crate.
See the crate documentation for more details.
bf16. This adds a dependency on the
use-intrinsics- Use hardware intrinsics for
bf16conversions if available on the compiler host target. By default, without this feature, conversions are done only in software, which will be the fallback if the host target does not have hardware support. Available only on Rust nightly channel.
alloc- Enable use of the
alloccrate when not using the
This enables the
vecmodule, which contains zero-copy conversions for the
Vectype. This allows fast conversion between raw
Vec<bf16>arrays, and vice versa.
std- Enable features that depend on the Rust
stdlibrary, including everything in the
stdfeature enables runtime CPU feature detection when the
use-intrsincisfeature is also enabled. Without this feature detection, intrinsics are only used when compiler host target supports them.
Boundedtrait implementations from the
Podtrait implementations from the
FromBytestrait implementations from the
This library is distributed under the terms of either of:
- MIT License (http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
at your option.
This project is REUSE-compliant. Copyrights are retained by their contributors. Some files may include explicit copyright notices and/or license SPDX identifiers. For full authorship information, see the version control history.
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.