RealDocs

UKismetMathLibrary::Abs_Int64

function Engine Blueprint Since unknown
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns the absolute (non-negative) value of A. Returns A unchanged if A >= 0, or negates A if A < 0.

Caveats & Gotchas

  • Abs_Int64(INT64_MIN) is undefined behaviour in C++ — INT64_MIN has no positive counterpart in a signed 64-bit integer (two's complement). Defensively clamp or check for INT64_MIN before calling if the input can reach that value.
  • For distances or magnitudes where you also need the sign separately, call SignOfInteger64 before Abs_Int64 rather than after — once negated, the sign information is discarded.

Signature

static UE_INL_API int64 Abs_Int64(int64 A);

Parameters

Name Type Description Default
A int64 The value whose absolute value is returned.

Return Type

int64

Example

Compute the magnitude of a signed offset C++
int64 Offset = GetSignedOffset(); // may be negative
int64 Distance = UKismetMathLibrary::Abs_Int64(Offset);
if (Distance > Threshold)
{
    ApplyCorrection(Offset);
}

Tags

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.