FFloat16

16 bit float components and conversion

Windows
MacOS
Linux

Syntax

class FFloat16

Remarks

16 bit float components and conversion

IEEE float 16 Represented by 10-bit mantissa M, 5-bit exponent E, and 1-bit sign S

Specials:

E=0, M=0 == 0.0 E=0, M!=0 == Denormalized value (M / 2^10) * 2^-14 0<E<31, M=any == (1 + M / 2^10) * 2^(E-15) E=31, M=0 == Infinity E=31, M!=0 == NAN

Variables

Name Description

Public variable

union FFloat16:...

 

@147

Public variable

FFloat16::@146:...

 

Components

Public variable

uint16

 

Encoded

Public variable

uint16: 5

 

Exponent

Public variable

uint16: 10

 

Mantissa

Public variable

uint16: 1

 

Sign

Constructors

Name Description

Public function

FFloat16()

Default constructor

Public function

FFloat16

(
    const FFloat16& FP16Value
)

Copy constructor.

Public function

FFloat16

(
    float FP32Value
)

Conversion constructor. Convert from Fp32 to Fp16.

Functions

Name Description

Public function Const

float

 

GetFloat()

Convert from Fp16 to Fp32.

Public function

void

 

Set

(
    float FP32Value
)

Convert from Fp32 to Fp16.

Public function

void

 

SetWithoutBoundsChecks

(
    const float FP32Value
)

Convert from Fp32 to Fp16 without doing any checks if the Fp32 exponent is too large or too small.

Operators

Name Description

Public function Const

 

operator float()

Convert from Fp16 to Fp32.

Public function

FFloat16 &

 

operator=

(
    float FP32Value
)

Assignment operator. Convert from Fp32 to Fp16.

Public function

FFloat16 &

 

operator=

(
    const FFloat16& FP16Value
)

Assignment operator. Copy Fp16 value.

References

Module

Core

Header

Runtime/Core/Public/Math/Float16.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback