FGenericPlatformMath::Fmod

Returns the floating-point remainder of X / Y Warning: Always returns remainder toward 0, not toward the smaller multiple of Y.

Choose your operating system:

Windows

macOS

Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/GenericPlatform/GenericPlatformMath.h

Include

#include "GenericPlatform/GenericPlatformMath.h"

Source

/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMath.cpp

Syntax

static double Fmod
(
    double X,
    double Y
)

Remarks

Returns the floating-point remainder of X / Y Warning: Always returns remainder toward 0, not toward the smaller multiple of Y. So for example Fmod(2.8f, 2) gives .8f as you would expect, however, Fmod(-2.8f, 2) gives -.8f, NOT 1.2f Use Floor instead when snapping positions that can be negative to a grid

This is forced to NOT inline so that divisions by constant Y does not get optimized in to an inverse scalar multiply, which is not consistent with the intent nor with the vectorized version.