![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <Float16.h>
Public Member Functions | |
| FFloat16 ()=default | |
| FFloat16 (const FFloat16 &FP16Value)=default | |
| FFloat16 (float FP32Value) | |
| FFloat16 & | operator= (float FP32Value) |
| FFloat16 & | operator= (const FFloat16 &FP16Value)=default |
| operator float () const | |
| void | Set (float FP32Value) |
| void | SetClamped (float FP32Value) |
| void CORE_API | SetTruncate (float FP32Value) |
| void | SetZero () |
| void | SetOne () |
| FFloat16 | GetClampedNonNegativeAndFinite () const |
| FFloat16 | GetClampedFinite () const |
| float | GetFloat () const |
| bool | IsNegative () const |
Public Attributes | |
| uint16 | Encoded = 0 |
Static Public Attributes | |
| static constexpr float | MaxF16Float = 65504.f |
Friends | |
| FArchive & | operator<< (FArchive &Ar, FFloat16 &V) |
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
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.
|
default |
Default constructor
|
default |
Copy constructor.
| UE_FORCEINLINE_HINT FFloat16::FFloat16 | ( | float | FP32Value | ) |
Conversion constructor. Convert from Fp32 to Fp16.
|
inline |
Return float clamp in [-MaxF16Float,MaxF16Float] , no infinites or nans returned
|
inline |
Return float clamp in [0,MaxF16Float] , no negatives or infinites or nans returned
| UE_FORCEINLINE_HINT float FFloat16::GetFloat | ( | ) | const |
Convert from Fp16 to Fp32.
|
inline |
Is the float negative without converting NOTE: returns true for negative zero!
| UE_FORCEINLINE_HINT FFloat16::operator float | ( | ) | const |
Convert from Fp16 to Fp32.
Assignment operator. Copy Fp16 value.
Assignment operator. Convert from Fp32 to Fp16.
| UE_FORCEINLINE_HINT void FFloat16::Set | ( | float | FP32Value | ) |
Convert from Fp32 to Fp16, round-to-nearest-even. (RTNE) Stores values out of range as +-Inf
|
inline |
Set to 1.0
Convert from Fp32 to Fp16, truncating low bits. (backward-compatible conversion; was used by Set() previously) Clamps values out of range to [-MaxF16Float,MaxF16Float]
|
inline |
Set to 0.0
| uint16 FFloat16::Encoded = 0 |