RealDocs

UKismetMathLibrary::Percent_Int64Int64

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

Description

Returns the remainder of 64-bit integer division (A % B). The result has the same sign as A (C++ truncating remainder semantics).

Caveats & Gotchas

  • The result sign follows A, not the mathematical modulo convention. For A = -7, B = 3: result is -1, not 2. If you need a non-negative modulo for circular indexing, add B and take % again: ((A % B) + B) % B.
  • Like Divide_Int64Int64, dividing by zero calls ReportError_Percent_Int64Int64 and returns 0 silently. Guard against B == 0.

Signature

static UE_INL_API int64 Percent_Int64Int64(int64 A, int64 B = 1);

Parameters

Name Type Description Default
A int64 Dividend.
B int64 Divisor (modulus). Defaults to 1. 1

Return Type

int64

Example

Check if a large counter is a multiple of N C++
if (UKismetMathLibrary::Percent_Int64Int64(FrameCounter, 60LL) == 0)
{
    RunPeriodicCleanup();
}

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.