Compute Library
 22.11
bfloat16 Class Referencefinal

Brain floating point representation class. More...

#include <Bfloat16.h>

Public Member Functions

 bfloat16 ()
 Default Constructor. More...
 
 bfloat16 (float v)
 Constructor. More...
 
bfloat16operator= (float v)
 Assignment operator. More...
 
 operator float () const
 Floating point conversion operator. More...
 

Static Public Member Functions

static bfloat16 lowest ()
 Lowest representative value. More...
 
static bfloat16 max ()
 Largest representative value. More...
 

Detailed Description

Brain floating point representation class.

Definition at line 81 of file Bfloat16.h.

Constructor & Destructor Documentation

◆ bfloat16() [1/2]

bfloat16 ( )
inline

Default Constructor.

Definition at line 85 of file Bfloat16.h.

86  : value(0)
87  {
88  }

◆ bfloat16() [2/2]

bfloat16 ( float  v)
inlineexplicit

Constructor.

Parameters
[in]vFloating-point value

Definition at line 93 of file Bfloat16.h.

94  : value(float_to_bf16(v))
95  {
96  }

Member Function Documentation

◆ lowest()

static bfloat16 lowest ( )
inlinestatic

Lowest representative value.

Returns
Returns the lowest finite value representable by bfloat16

Definition at line 120 of file Bfloat16.h.

Referenced by arm_compute::check_value_range(), arm_compute::get_min_max(), and arm_compute::support::cpp11::lowest< bfloat16 >().

121  {
122  bfloat16 val;
123  val.value = 0xFF7F;
124  return val;
125  }
bfloat16()
Default Constructor.
Definition: Bfloat16.h:85

◆ max()

static bfloat16 max ( )
inlinestatic

Largest representative value.

Returns
Returns the largest finite value representable by bfloat16

Definition at line 130 of file Bfloat16.h.

Referenced by arm_compute::check_value_range(), and arm_compute::get_min_max().

131  {
132  bfloat16 val;
133  val.value = 0x7F7F;
134  return val;
135  }
bfloat16()
Default Constructor.
Definition: Bfloat16.h:85

◆ operator float()

operator float ( ) const
inline

Floating point conversion operator.

Returns
Floating point representation of the value

Definition at line 112 of file Bfloat16.h.

113  {
114  return bf16_to_float(value);
115  }

◆ operator=()

bfloat16& operator= ( float  v)
inline

Assignment operator.

Parameters
[in]vFloating point value to assign
Returns
The updated object

Definition at line 103 of file Bfloat16.h.

104  {
105  value = float_to_bf16(v);
106  return *this;
107  }

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