[][src]Crate half

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 serde 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. A std feature is available, which enables additional utilities using the std library, such as the vec module that provides zero-copy Vec conversions.

Modules

consts

Useful f16 constants.

slice

Contains utility functions to convert between slices of u16 bits and f16 numbers.

Structs

f16

The 16-bit floating point type.