UKismetMathLibrary::Percent_FloatFloat
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPureCustomThunk
Description
Returns the floating-point remainder of A divided by B (A % B). Equivalent to fmod for positive values, wrapped with a Blueprint-safe divide-by-zero guard.
Caveats & Gotchas
- • If B is zero, the Blueprint runtime logs a 'Modulo by zero' warning via KismetExecutionMessage and returns 0 rather than crashing — this is a Blueprint-only guard; calling the raw C++ function with B==0 is undefined behaviour.
- • The result sign matches A, not B, consistent with C++ fmod behaviour; e.g., Percent_FloatFloat(-7.0, 3.0) returns -1.0.
Signature
static ENGINE_API double Percent_FloatFloat(double A, double B = 1.f); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | double | The dividend. | — |
| B | double | The divisor. | 1.f |
Return Type
double Example
Wrap an angle into [0, 360) C++
double Angle = -45.0;
double Wrapped = UKismetMathLibrary::Percent_FloatFloat(Angle + 360.0, 360.0);
// Wrapped == 315.0 See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?