FFloat16

16 bit float components and conversion

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/Float16.h

Include

#include "Math/Float16.h"

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:...

 

@183

Public variable

FFloat16::@182:...

 

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.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss