# FGenericPlatformMath

Inheritance Hierarchy

FGenericPlatformMath

FClangPlatformMath

FLinuxPlatformMath

 FMath

Syntax

struct FGenericPlatformMath

Remarks

Generic implementation for most platforms

Functions

Name Description

constexpr T

Abs

(
const T A
)

Computes absolute value in a generic way

float

Abs

(
const float A
)

Float specialization

float

Acos

(
float Value
)

float

Asin

(
float Value
)

float

Atan

(
float Value
)

float

Atan2

(
float Y,
float X
)

CeilLogTwo

(
uint32 Arg
)

Returns smallest N such that (1<=Arg. Note: CeilLogTwo(0)=0 because (1<<0)=1 >= 0.

CeilLogTwo64

(
uint64 Arg
)

double

CeilToDouble

(
double F
)

Converts a double to the nearest greater or equal integer.

float

CeilToFloat

(
float F
)

Converts a float to the nearest greater or equal integer.

CeilToInt

(
float F
)

Converts a float to the nearest greater or equal integer.

float

Cos

(
float Value
)

CountBits

(
uint64 Bits
)

(
uint32 Value
)

Counts the number of leading zeros in the bit representation of the value

(
uint64 Value
)

Counts the number of leading zeros in the bit representation of the 64-bit value

CountTrailingZeros

(
uint32 Value
)

Counts the number of trailing zeros in the bit representation of the value

CountTrailingZeros64

(
uint64 Value
)

Counts the number of trailing zeros in the bit representation of the value

float

Exp

(
float Value
)

Returns e^Value.

float

Exp2

(
float Value
)

Returns 2^Value.

constexpr fl...

FloatSelect

(
float Comparand,
float ValueGEZero,
float ValueLTZero
)

Returns value based on comparand.

constexpr do...

FloatSelect

(
double Comparand,
double ValueGEZero,
double ValueLTZero
)

Returns value based on comparand.

FloorLog2

(
uint32 Value
)

Computes the base 2 logarithm for an integer value that is greater than 0.

FloorLog2_64

(
uint64 Value
)

Computes the base 2 logarithm for a 64-bit value that is greater than 0.

double

FloorToDouble

(
double F
)

Converts a double to a less or equal integer.

float

FloorToFloat

(
float F
)

Converts a float to the nearest less or equal integer.

FloorToInt

(
float F
)

Converts a float to a nearest less or equal integer.

float

Fmod

(
float X,
float Y
)

Returns the floating-point remainder of X / Y Warning: Always returns remainder toward 0, not toward the smaller multiple of Y.

float

Frac

(
float Value
)

Returns the fractional part of a float.

float

Fractional

(
float Value
)

Returns signed fractional part of a float.

float

FRand()

Returns a random float between 0 and 1, inclusive.

GetRandSeed()

Returns the current seed for SRand() .

float

InvSqrt

(
float F
)

Computes a fully accurate inverse square root

float

InvSqrtEst

(
float F
)

Computes a faster but less accurate inverse square root

bool

IsFinite

(
float A
)

Return true if value is finite (not NaN and not Infinity).

bool

IsNaN

(
float A
)

Return true if value is NaN (not a number).

bool

IsNegativeDouble

(
const double& A
)

bool

IsNegativeFloat

(
const float& A
)

float

Log2

(
float Value
)

1.0 / Loge(2) = 1.4426950f

float

Loge

(
float Value
)

float

LogX

(
float Base,
float Value
)

VectorRegist ...

Max

(
const VectorRegister A,
const VectorRegister B
)

Returns the larger of the two values (operates on each component individually)

T

Max

(
const TArray < T >& Values,
int32 * MaxIndex
)

Max of Array

constexpr T

Max

(
const T A,
const T B
)

Returns higher value in a generic way

VectorRegist ...

Min

(
const VectorRegister A,
const VectorRegister B
)

Returns the smaller of the two values (operates on each component individually)

T

Min

(
const TArray < T >& Values,
int32 * MinIndex
)

Min of Array

constexpr T

Min

(
const T A,
const T B
)

Returns lower value in a generic way

double

Modf

(
const double InValue,
double* OutIntPart
)

Breaks the given value into an integral and a fractional part.

float

Modf

(
const float InValue,
float* OutIntPart
)

Breaks the given value into an integral and a fractional part.

MortonCode2

(
uint32 x
)

MortonCode3

(
uint32 x
)

float

Pow

(
float A,
float B
)

Rand()

Returns a random integer between 0 and RAND_MAX, inclusive

void

RandInit

(
int32 Seed
)

Seeds global random number functions Rand() and FRand()

ReverseMortonCode2

(
uint32 x
)

Reverses MortonCode2. Compacts every other bit to the right.

ReverseMortonCode3

(
uint32 x
)

Reverses MortonCode3. Compacts every 3rd bit to the right.

double

RoundToDouble

(
double F
)

Converts a double to the nearest integer. Rounds up when the fraction is .5

float

RoundToFloat

(
float F
)

Converts a float to the nearest integer. Rounds up when the fraction is .5

RoundToInt

(
float F
)

Converts a float to the nearest integer. Rounds up when the fraction is .5

RoundUpToPowerOfTwo

(
uint32 Arg
)

RoundUpToPowerOfTwo64

(
uint64 V
)

constexpr T

Sign

(
const T A
)

Returns 1, 0, or -1 depending on relation of T to 0

float

Sin

(
float Value
)

float

Sinh

(
float Value
)

float

Sqrt

(
float Value
)

float

SRand()

Returns a seeded random float in the range [0,1), using the seed from SRandInit() .

void

SRandInit

(
int32 Seed
)

Seeds future calls to SRand()

float

Tan

(
float Value
)

constexpr fl...

TruncToFloat

(
float F
)

Converts a float to an integer value with truncation towards zero.

constexpr in ...

TruncToInt

(
float F
)

Converts a float to an integer with truncation towards zero.

References