RealDocs

UKismetMathLibrary::Abs

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

Description

Returns the absolute (positive) value of A. Negative values become positive; zero and positive values are returned unchanged.

Caveats & Gotchas

  • The float overload (Abs) and integer overload (Abs_Int) are separate Blueprint nodes — in C++ you can call FMath::Abs for either, but in Blueprint you must use the correctly-typed node or you may get a type mismatch.
  • Abs of the most-negative double value (DBL_MIN negated, i.e., -1.7976931348623158e+308) is well-defined for doubles, unlike the int32 equivalent where Abs(INT_MIN) overflows.

Signature

static UE_INL_API double Abs(double A);

Parameters

Name Type Description Default
A double The input value.

Return Type

double

Example

Compute the absolute difference between two angles C++
double AngleA = -30.0;
double AngleB = 45.0;
double Delta = UKismetMathLibrary::Abs(AngleA - AngleB); // 75.0

Tags

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.