struct

FFixed

Q16.16 fixed point for gameplay state that must come out the same bits on every machine and every build: the float rules a compiler may follow (contraction into FMA, x87 vs SSE, reassociation under fast-math) differ across toolchains, and integer arithmetic does not. Products and quotients widen to 64 bits before they narrow, and both round toward negative infinity, so the result never depends on the sign convention of a division.

Module
Game
Header
#include "Rollback/DeterministicMath.h"
Namespace
Mowo

Inside one binary, strict IEEE float (the engine builds /fp:precise) is already deterministic; FFixed is for state that crosses builds — a replay, a dedicated server on another platform.

Properties

TypeNameDescription
static constexpr int32_tkFractionBitsDefault 16.
static constexpr int32_tkOneDefault 1 << kFractionBits.
int32_trawDefault 0.
bool operator<(FFixed other)const

Public functions

ReturnsNameDescription
FFixedFromRaw
FFixedFromInt
FFixedFromFloatRounded to the nearest representable value; only for authored constants and inputs entering the simulation, never inside it.
floatToFloat
int32_tToIntFloor
FFixedoperator+
FFixedoperator-
FFixedoperator-
FFixedoperator*
FFixedoperator/
FFixed&operator+=
FFixed&operator-=
booloperator==
booloperator!=
booloperator>
booloperator>=
FFixedAbs
FFixedClamp
FFixedSqrtInteger square root (Newton on the widened value): exact to the last fractional bit and the same on every machine.

Function details

FromRaw

C++
static constexpr FFixed FromRaw(int32_t value)

FromInt

C++
static constexpr FFixed FromInt(int32_t value)

FromFloat

C++
static FFixed FromFloat(float value)

Rounded to the nearest representable value; only for authored constants and inputs entering the simulation, never inside it.

ToFloat

C++
float ToFloat() const

ToIntFloor

C++
int32_t ToIntFloor() const

operator+

C++
FFixed operator+(FFixed other) const

operator-

C++
FFixed operator-(FFixed other) const

operator-

C++
FFixed operator-() const

operator*

C++
FFixed operator*(FFixed other) const

operator/

C++
FFixed operator/(FFixed other) const

operator+=

C++
FFixed& operator+=(FFixed other)

operator-=

C++
FFixed& operator-=(FFixed other)

operator==

C++
bool operator==(FFixed other) const

operator!=

C++
bool operator!=(FFixed other) const

operator>

C++
bool operator>(FFixed other) const

operator>=

C++
bool operator>=(FFixed other) const

Abs

C++
static FFixed Abs(FFixed value)

Clamp

C++
static FFixed Clamp(FFixed value, FFixed lo, FFixed hi)

Sqrt

C++
static FFixed Sqrt(FFixed value)

Integer square root (Newton on the widened value): exact to the last fractional bit and the same on every machine.

Generated from Rollback/DeterministicMath.h via game.json · Nov 5, 2026Version 1.0.0