UKismetMathLibrary::FMod
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Divides Dividend by Divisor and returns the integer quotient as an int32, outputting the floating-point remainder via the Remainder out parameter.
Caveats & Gotchas
- • Returns the integer quotient (truncated toward zero), not the floating-point modulo. If you only want the remainder, use FMath::Fmod instead of this Blueprint wrapper.
- • Passing a Divisor of zero sets Remainder to 0.0 and returns 0 — no crash, but the silent zero result can hide logic bugs in callers that don't validate input.
Signature
static ENGINE_API int32 FMod(double Dividend, double Divisor, double& Remainder); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Dividend | double | The value to be divided. | — |
| Divisor | double | The value to divide by. | — |
| Remainder | double& | Output: the fractional remainder after integer division. | — |
Return Type
int32 Example
Split a distance into whole meters and a fractional remainder C++
double Distance = 7.35;
double Rem = 0.0;
int32 WholeMeters = UKismetMathLibrary::FMod(Distance, 1.0, Rem);
// WholeMeters == 7, Rem == 0.35 Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?