Navigation
Unreal Engine C++ API Reference > Runtime > Core > Math
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
conversion from 32 bit float is with RTNE (round to nearest even)
Legacy code truncated in the conversion. SetTruncate can be used for backwards compatibility.
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
uint16 | Encoded |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
FFloat16 () |
Default constructor | |
![]() |
Copy constructor. | ||
![]() |
FFloat16
(
float FP32Value |
Conversion constructor. Convert from Fp32 to Fp16. |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
FFloat16 | Return float clamp in [-MaxF16Float,MaxF16Float] , no infinites or nans returned | |
![]() ![]() |
FFloat16 | Return float clamp in [0,MaxF16Float] , no negatives or infinites or nans returned | |
![]() ![]() |
float | GetFloat () |
Convert from Fp16 to Fp32. |
![]() ![]() |
bool | IsNegative () |
Is the float negative without converting NOTE: returns true for negative zero! |
![]() |
void | Set
(
float FP32Value |
NOTE: Set() on values out of F16 max range store them as +-Inf. |
![]() |
void | SetClamped
(
float FP32Value |
Convert from Fp32 to Fp16, round-to-nearest-even. |
![]() |
void | SetOne () |
Set to 1.0 |
![]() |
void | SetTruncate
(
float FP32Value |
NOTE: Set() on values out of F16 max range store them as +-Inf. |
![]() |
void | SetZero () |
Set to 0.0 |
Operators
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
Convert from Fp16 to Fp32. | ||
![]() |
FFloat16 & | operator=
(
float FP32Value |
Assignment operator. Convert from Fp32 to Fp16. |
![]() |
FFloat16 & | Assignment operator. Copy Fp16 value. |
Constants
Name | Description |
---|---|
MaxF16Float | Float16 can store values in [-MaxF16Float,MaxF16Float] |