Poplar and PopLibs
poplar::IeeeHalf Class Reference

A IeeeHalf. More...

#include <IeeeHalf.hpp>

Public Member Functions

 IeeeHalf ()=default
 Uninitialised.
 
 IeeeHalf (float value)
 Initialise from a single-precision fp value.
 
 operator float () const
 Type-cast to single-precision.
 
uint16_t bit16 () const
 Obtain half-precision bit-pattern. More...
 
uint32_t bitz32 () const
 Obtain half-precision bit-pattern. More...
 

Static Public Member Functions

static IeeeHalf fromBits (uint16_t bitPattern)
 Initialise from a raw 16-bit pattern (conforming to IEEE 754-2008 binary16 format)
 

Detailed Description

A IeeeHalf.

The half is stored in memory as an actual IeeeHalf but most operations are performed by converting it to a float, performing the operation and converting back again.

Member Function Documentation

◆ bit16()

uint16_t poplar::IeeeHalf::bit16 ( ) const
inline

Obtain half-precision bit-pattern.

Returns
raw 16-bit bit-pattern, as described by IEEE 754-2008

◆ bitz32()

uint32_t poplar::IeeeHalf::bitz32 ( ) const
inline

Obtain half-precision bit-pattern.

Returns
raw zero-extended 16-bit bit-pattern, as described by IEEE 754-2008

The documentation for this class was generated from the following file: