Navigation
Unreal Engine C++ API Reference > Runtime > Core > GenericPlatform
Inheritance Hierarchy
- FGenericPlatformMath
- FClangPlatformMath
References
Module | Core |
Header | /Engine/Source/Runtime/Core/Public/GenericPlatform/GenericPlatformMath.h |
Include | #include "GenericPlatform/GenericPlatformMath.h" |
Syntax
struct FGenericPlatformMath
Remarks
Generic implementation for most platforms
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
constexpr T | Abs
(
const T A |
Computes absolute value in a generic way |
![]() |
double | Abs
(
const double A |
|
![]() |
float | Abs
(
const float A |
Float specialization |
![]() ![]() |
float | Acos
(
float Value |
|
![]() ![]() |
double | Acos
(
double Value |
|
![]() ![]() |
float | AsFloat
(
uint32 U |
Performs a bit cast of the given unsigned int to float of the same bit width. |
![]() ![]() |
double | AsFloat
(
uint64 U |
Performs a bit cast of the given unsigned int to float of the same bit width. |
![]() ![]() |
float | Asin
(
float Value |
|
![]() ![]() |
double | Asin
(
double Value |
|
![]() ![]() |
uint32 | AsUInt
(
float F |
Performs a bit cast of the given float to an unsigned int of the same bit width. |
![]() ![]() |
uint64 | AsUInt
(
double F |
Performs a bit cast of the given double to an unsigned int of the same bit width. |
![]() ![]() |
float | Atan
(
float Value |
|
![]() ![]() |
double | Atan
(
double Value |
|
![]() ![]() |
float | Atan2
(
float Y, |
|
![]() ![]() |
double | Atan2
(
double Y, |
|
![]() ![]() |
auto | Atan2
(
Arg1 X, |
|
![]() ![]() |
constexpr uint32 | CeilLogTwo
(
uint32 Arg |
Returns smallest N such that (1< |
![]() ![]() |
constexpr uint64 | CeilLogTwo64
(
uint64 Arg |
|
![]() ![]() |
double | CeilToDouble
(
double F |
Converts a double to the nearest greater or equal integer. |
![]() ![]() |
double | CeilToFloat
(
double F |
|
![]() ![]() |
float | CeilToFloat
(
float F |
Converts a float to the nearest greater or equal integer. |
![]() ![]() |
int64 | CeilToInt
(
double F |
|
![]() ![]() |
int32 | CeilToInt
(
float F |
|
![]() ![]() |
int32 | CeilToInt32
(
float F |
Converts a float to the nearest greater or equal integer. |
![]() ![]() |
int32 | CeilToInt32
(
double F |
|
![]() ![]() |
int64 | CeilToInt64
(
double F |
|
![]() ![]() |
constexpr uint8 | ConstExprCeilLogTwo
(
SIZE_T Arg |
Returns the smallest N such that (1< |
![]() ![]() |
double | Cos
(
double Value |
|
![]() ![]() |
float | Cos
(
float Value |
|
![]() ![]() |
double | Cosh
(
double Value |
|
![]() ![]() |
float | Cosh
(
float Value |
|
![]() ![]() |
constexpr int32 | CountBits
(
uint64 Bits |
|
![]() ![]() |
constexpr uint32 | CountLeadingZeros
(
uint32 Value |
Counts the number of leading zeros in the bit representation of the 32-bit value |
![]() ![]() |
constexpr uint64 | CountLeadingZeros64
(
uint64 Value |
Counts the number of leading zeros in the bit representation of the 64-bit value |
![]() ![]() |
constexpr uint8 | CountLeadingZeros8
(
uint8 Value |
Counts the number of leading zeros in the bit representation of the 8-bit value |
![]() ![]() |
constexpr uint32 | CountTrailingZeros
(
uint32 Value |
Counts the number of trailing zeros in the bit representation of the value |
![]() ![]() |
constexpr uint64 | CountTrailingZeros64
(
uint64 Value |
Counts the number of trailing zeros in the bit representation of the value |
![]() ![]() |
double | Exp
(
double Value |
|
![]() ![]() |
float | Exp
(
float Value |
Returns e^Value. |
![]() ![]() |
float | Exp2
(
float Value |
Returns 2^Value. |
![]() ![]() |
double | Exp2
(
double Value |
|
![]() ![]() |
constexpr float | FloatSelect
(
float Comparand, |
Returns value based on comparand. |
![]() ![]() |
constexpr double | FloatSelect
(
double Comparand, |
Returns value based on comparand. |
![]() ![]() |
constexpr uint32 | FloorLog2
(
uint32 Value |
Computes the base 2 logarithm for an integer value. |
![]() ![]() |
constexpr uint64 | FloorLog2_64
(
uint64 Value |
Computes the base 2 logarithm for a 64-bit value. |
![]() ![]() |
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. |
![]() ![]() |
double | FloorToFloat
(
double F |
|
![]() ![]() |
int32 | FloorToInt
(
float F |
|
![]() ![]() |
int64 | FloorToInt
(
double F |
|
![]() ![]() |
int32 | FloorToInt32
(
float F |
Converts a float to a nearest less or equal integer. |
![]() ![]() |
int32 | FloorToInt32
(
double F |
|
![]() ![]() |
int64 | FloorToInt64
(
double F |
|
![]() ![]() |
float | Fmod
(
float X, |
Returns the floating-point remainder of X / Y Warning: Always returns remainder toward 0, not toward the smaller multiple of Y. |
![]() ![]() |
double | Fmod
(
double X, |
Returns the floating-point remainder of X / Y Warning: Always returns remainder toward 0, not toward the smaller multiple of Y. |
![]() ![]() |
auto | Fmod
(
Arg1 X, |
|
![]() ![]() |
float | Frac
(
float Value |
Returns the fractional part of a float. |
![]() ![]() |
double | Frac
(
double Value |
|
![]() ![]() |
float | Fractional
(
float Value |
Returns signed fractional part of a float. |
![]() ![]() |
double | Fractional
(
double Value |
|
![]() ![]() |
float | FRand () |
Returns a random float between 0 and 1, inclusive. |
![]() ![]() |
int32 | GetRandSeed () |
Returns the current seed for SRand(). |
![]() ![]() |
float | InvSqrt
(
float F |
Computes a fully accurate inverse square root |
![]() ![]() |
double | InvSqrt
(
double F |
|
![]() ![]() |
float | InvSqrtEst
(
float F |
Computes a faster but less accurate inverse square root |
![]() ![]() |
double | InvSqrtEst
(
double F |
|
![]() ![]() |
bool | IsFinite
(
float A |
Return true if value is finite (not NaN and not Infinity). |
![]() ![]() |
bool | IsFinite
(
double A |
|
![]() ![]() |
bool | IsNaN
(
double A |
|
![]() ![]() |
bool | IsNaN
(
float A |
Return true if value is NaN (not a number). |
![]() ![]() |
bool | IsNegativeOrNegativeZero
(
double A |
|
![]() ![]() |
bool | IsNegativeOrNegativeZero
(
float A |
|
![]() ![]() |
constexpr float | LoadHalf
(
const uint16* Ptr |
Load half (F16) to float https://gist.github.com/rygorous/2156668 |
![]() ![]() |
double | Log2
(
double Value |
1.0 / Loge(2) = 1.442695040888963387 |
![]() ![]() |
float | Log2
(
float Value |
1.0 / Loge(2) = 1.4426950f |
![]() ![]() |
float | Loge
(
float Value |
|
![]() ![]() |
double | Loge
(
double Value |
|
![]() ![]() |
auto | LogX
(
Arg1 X, |
|
![]() ![]() |
double | LogX
(
double Base, |
|
![]() ![]() |
float | LogX
(
float Base, |
|
![]() ![]() |
constexpr auto | Max
(
Arg1 X, |
Allow mixing of signed integral types. |
![]() |
VectorRegister4Double | Max
(
const VectorRegister4Double A, |
|
![]() |
VectorRegister4Float | Max
(
const VectorRegister4Float A, |
Returns the larger of the two values (operates on each component individually) |
![]() ![]() |
T | Max of Array | |
![]() ![]() |
auto | Max
(
Arg1 X, |
Allow mixing of float types to promote to highest precision type. |
![]() ![]() |
constexpr T | Max
(
const T A, |
Returns higher value in a generic way |
![]() ![]() |
auto | Min
(
Arg1 X, |
|
![]() ![]() |
constexpr T | Min
(
const T A, |
Returns lower value in a generic way |
![]() |
VectorRegister4Float | Min
(
const VectorRegister4Float A, |
Returns the smaller of the two values (operates on each component individually) |
![]() ![]() |
constexpr auto | Min
(
Arg1 X, |
|
![]() ![]() |
T | Min of Array | |
![]() |
VectorRegister4Double | Min
(
const VectorRegister4Double A, |
|
![]() ![]() |
float | Modf
(
const float InValue, |
Breaks the given value into an integral and a fractional part. |
![]() ![]() |
double | Modf
(
const double InValue, |
Breaks the given value into an integral and a fractional part. |
![]() ![]() |
constexpr uint32 | MortonCode2
(
uint32 x |
Spreads bits to every other. |
![]() ![]() |
constexpr uint64 | MortonCode2_64
(
uint64 x |
|
![]() ![]() |
constexpr uint32 | MortonCode3
(
uint32 x |
Spreads bits to every 3rd. |
![]() ![]() |
float | Pow
(
float A, |
|
![]() ![]() |
auto | Pow
(
Arg1 X, |
|
![]() ![]() |
double | Pow
(
double A, |
|
![]() ![]() |
int32 | Rand () |
Returns a random integer between 0 and RAND_MAX, inclusive |
![]() ![]() |
void | RandInit
(
int32 Seed |
Seeds global random number functions Rand() and FRand() |
![]() ![]() |
constexpr uint32 | ReverseMortonCode2
(
uint32 x |
Reverses MortonCode2. Compacts every other bit to the right. |
![]() ![]() |
constexpr uint64 | ReverseMortonCode2_64
(
uint64 x |
|
![]() ![]() |
constexpr uint32 | 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 |
![]() ![]() |
double | RoundToFloat
(
double F |
|
![]() ![]() |
int32 | RoundToInt
(
float F |
|
![]() ![]() |
int64 | RoundToInt
(
double F |
|
![]() ![]() |
int32 | RoundToInt32
(
float F |
Converts a float to the nearest integer. Rounds up when the fraction is .5 |
![]() ![]() |
int32 | RoundToInt32
(
double F |
|
![]() ![]() |
int64 | RoundToInt64
(
double F |
|
![]() ![]() |
int64 | RoundToNearestTiesToEven
(
double F |
Converts a double to nearest int64 with ties rounding to nearest even May incur a performance penalty. |
![]() ![]() |
constexpr uint32 | RoundUpToPowerOfTwo
(
uint32 Arg |
|
![]() ![]() |
constexpr uint64 | 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 |
|
![]() ![]() |
double | Sin
(
double Value |
|
![]() ![]() |
double | Sinh
(
double Value |
|
![]() ![]() |
float | Sinh
(
float Value |
|
![]() ![]() |
double | Sqrt
(
double 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() |
![]() ![]() |
constexpr void | StoreHalf
(
uint16* Ptr, |
Store float to half (F16) converts with RTNE = round to nearest even values too large for F16 are stored as +-Inf https://gist.github.com/rygorous/2156668 float_to_half_fast3_rtne |
![]() ![]() |
float | Tan
(
float Value |
|
![]() ![]() |
double | Tan
(
double Value |
|
![]() ![]() |
double | Tanh
(
double Value |
|
![]() ![]() |
float | Tanh
(
float Value |
|
![]() ![]() |
double | TruncToDouble
(
double F |
Converts a double to an integer value with truncation towards zero. |
![]() ![]() |
double | TruncToFloat
(
double F |
|
![]() ![]() |
float | TruncToFloat
(
float F |
Converts a float to an integer value with truncation towards zero. |
![]() ![]() |
constexpr int32 | TruncToInt
(
float F |
|
![]() ![]() |
constexpr int64 | TruncToInt
(
double F |
|
![]() ![]() |
constexpr int32 | TruncToInt32
(
double F |
|
![]() ![]() |
constexpr int32 | TruncToInt32
(
float F |
Converts a float to an integer with truncation towards zero. |
![]() ![]() |
constexpr int64 | TruncToInt64
(
double F |
|
![]() ![]() |
constexpr void | VectorLoadHalf
(
float*__restrict Dst, |
|
![]() ![]() |
constexpr void | VectorStoreHalf
(
uint16*__restrict Dst, |
|
![]() ![]() |
constexpr void | WideVectorLoadHalf
(
float*__restrict Dst, |
|
![]() ![]() |
constexpr void | WideVectorStoreHalf
(
uint16*__restrict Dst, |
Deprecated Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
bool | IsNegative
(
double A |
IsNegative has been deprecated in favor of IsNegativeOrNegativeZero or simply A < 0. |
![]() ![]() |
bool | IsNegative
(
float A |
IsNegative has been deprecated in favor of IsNegativeOrNegativeZero or simply A < 0. |
![]() ![]() |
bool | IsNegativeDouble
(
double A |
IsNegativeDouble has been deprecated in favor of IsNegativeOrNegativeZero or simply A < 0. |
![]() ![]() |
bool | IsNegativeFloat
(
float A |
IsNegativeFloat has been deprecated in favor of IsNegativeOrNegativeZero or simply A < 0. |