Crate half[][src]

A crate that provides support for the half-precision floating point type.

This crate provides the f16 type, which is an implementation of the IEEE 754-2008 binary16 floating point type. This 'half' precision floating point type is intended for efficient storage where the full range and precision of a larger floating point value is not required. This is especially useful for image storage formats.

Because f16 is primarily for efficient storage, floating point operations are not implemented. Operations should be performed with f32 or higher-precision types and converted to/from f16 as necessary.

Some hardware architectures provide support for 16-bit floating point conversions. Enable the use-intrinsics feature to use LLVM intrinsics for hardware conversions. This crate does no checks on whether the hardware supports the feature. This feature currently only works on nightly Rust due to a compiler feature gate.

Support for serde crate Serialize and Deserialize traits is provided when the serialize feature is enabled. This adds a dependency on serde crate so is an optional feature that works on Rust 1.15 or newer.

The crate uses #[no_std] by default, so can be used in embedded environments without using the Rust std library. While a std feature is available, at present there are no additional changes when the feature is enabled and is merely provided for forward-compatibility.

Modules

consts

Useful f16 constants.

Structs

f16

The 16-bit floating point type.