Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FFloat16 Class Reference

#include <Float16.h>

Public Member Functions

 FFloat16 ()
 
 FFloat16 (const FFloat16 &FP16Value)
 
 FFloat16 (float FP32Value)
 
FFloat16operator= (float FP32Value)
 
FFloat16operator= (const FFloat16 &FP16Value)
 
 operator float () const
 
void Set (float FP32Value)
 
void SetClamped (float FP32Value)
 
void SetTruncate (float FP32Value)
 
void SetZero ()
 
void SetOne ()
 
FFloat16 GetClampedNonNegativeAndFinite () const
 
FFloat16 GetClampedFinite () const
 
float GetFloat () const
 
bool IsNegative () const
 

Public Attributes

uint16 Encoded
 

Static Public Attributes

static constexpr float MaxF16Float = 65504.f
 

Friends

FArchiveoperator<< (FArchive &Ar, FFloat16 &V)
 

Detailed Description

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.

Definition at line 33 of file Float16.h.

Constructor & Destructor Documentation

◆ FFloat16() [1/3]

FORCEINLINE FFloat16::FFloat16 ( )

Default constructor

Definition at line 123 of file Float16.h.

◆ FFloat16() [2/3]

FORCEINLINE FFloat16::FFloat16 ( const FFloat16 & FP16Value)

Copy constructor.

Definition at line 128 of file Float16.h.

+ Here is the caller graph for this function:

◆ FFloat16() [3/3]

FORCEINLINE FFloat16::FFloat16 ( float FP32Value)

Conversion constructor. Convert from Fp32 to Fp16.

Definition at line 134 of file Float16.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ GetClampedFinite()

FORCEINLINE FFloat16 FFloat16::GetClampedFinite ( ) const

Return float clamp in [-MaxF16Float,MaxF16Float] , no infinites or nans returned

Definition at line 258 of file Float16.h.

◆ GetClampedNonNegativeAndFinite()

FORCEINLINE FFloat16 FFloat16::GetClampedNonNegativeAndFinite ( ) const

Return float clamp in [0,MaxF16Float] , no negatives or infinites or nans returned

Definition at line 242 of file Float16.h.

◆ GetFloat()

FORCEINLINE float FFloat16::GetFloat ( ) const

Convert from Fp16 to Fp32.

Definition at line 169 of file Float16.h.

+ Here is the caller graph for this function:

◆ IsNegative()

bool FFloat16::IsNegative ( ) const
inline

Is the float negative without converting NOTE: returns true for negative zero!

Definition at line 99 of file Float16.h.

◆ operator float()

FORCEINLINE FFloat16::operator float ( ) const

Convert from Fp16 to Fp32.

Definition at line 154 of file Float16.h.

+ Here is the call graph for this function:

◆ operator=() [1/2]

FORCEINLINE FFloat16 & FFloat16::operator= ( const FFloat16 & FP16Value)

Assignment operator. Copy Fp16 value.

Definition at line 147 of file Float16.h.

+ Here is the caller graph for this function:

◆ operator=() [2/2]

FORCEINLINE FFloat16 & FFloat16::operator= ( float FP32Value)

Assignment operator. Convert from Fp32 to Fp16.

Definition at line 140 of file Float16.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Set()

FORCEINLINE void FFloat16::Set ( float FP32Value)

Convert from Fp32 to Fp16, round-to-nearest-even. (RTNE) Stores values out of range as +-Inf

Definition at line 161 of file Float16.h.

+ Here is the caller graph for this function:

◆ SetClamped()

void FFloat16::SetClamped ( float FP32Value)
inline

Definition at line 66 of file Float16.h.

+ Here is the call graph for this function:

◆ SetOne()

void FFloat16::SetOne ( )
inline

Set to 1.0

Definition at line 83 of file Float16.h.

◆ SetTruncate()

FORCEINLINE void FFloat16::SetTruncate ( float FP32Value)

Convert from Fp32 to Fp16, truncating low bits. (backward-compatible conversion; was used by Set() previously) Clamps values out of range to [-MaxF16Float,MaxF16Float]

Definition at line 176 of file Float16.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetZero()

void FFloat16::SetZero ( )
inline

Set to 0.0

Definition at line 77 of file Float16.h.

Friends And Related Symbol Documentation

◆ operator<<

FArchive & operator<< ( FArchive & Ar,
FFloat16 & V )
friend

Serializes the FFloat16.

Parameters
ArReference to the serialization archive.
VReference to the FFloat16 being serialized.
Returns
Reference to the Archive after serialization.

Definition at line 114 of file Float16.h.

Member Data Documentation

◆ Encoded

uint16 FFloat16::Encoded

Definition at line 40 of file Float16.h.

◆ MaxF16Float

constexpr float FFloat16::MaxF16Float = 65504.f
staticconstexpr

Definition at line 38 of file Float16.h.


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