Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Math/UnrealMathUtility.h |
Include |
#include "Math/UnrealMathUtility.h" |
Check if two floating point numbers are nearly equal to within specific number of units of last place (ULP). A single ULP difference between two floating point numbers means that they have an adjacent representation and that no other floating point number can be constructed to fit between them. This enables making consistent comparisons based on representational distance between floating point numbers, regardless of their magnitude.
Use when the two numbers vary greatly in range. Otherwise, if absolute tolerance is required, use IsNearlyEqual instead.
Note: Since IEEE 754 floating point operations are guaranteed to be exact to 0.5 ULP, a value of 4 ought to be sufficient for all but the most complex float operations.
true if the two values are nearly equal.
Parameter |
Description |
---|---|
A |
First number to compare |
B |
Second number to compare |
MaxUlps |
The maximum ULP distance by which neighboring floating point numbers are allowed to differ. |