# Trunc (Real)
Grammar — Trunc(x)
Flags —Native
|Function
Strips off the fractional portion of a real.
# Arguments
fixed
— Value
Returns — fixed
native fixed Trunc(fixed x);
# Related
Category: Math / Arithmetic
- Absolute Value (Integer) —
int
— AbsI - Absolute Value (Real) —
fixed
— AbsF - Arithmetic (Integer)
- Bitwise Arithmetic (Integer)
- Arithmetic (Real)
- Arithmetic Multiple (Integer)
- Bitwise Arithmetic Multiple (Integer)
- Arithmetic Multiple (Real)
- Ceiling (Integer) —
int
— CeilingI - Ceiling (Real) —
fixed
— Ceiling - Clamp (Integer) —
int
— libNtve_gf_ArithmeticIntClamp - Clamp (Real) —
fixed
— libNtve_gf_ArithmeticRealClamp - Cycle
- Floor (Integer) —
int
— FloorI - Floor (Real) —
fixed
— Floor - Log2 (Integer) —
int
— Log2I - Log2 (Real) —
fixed
— Log2 - Log (Real) —
fixed
— libNtve_gf_Log - Modulo (Integer) —
int
— ModI - Modulo (Real) —
fixed
— ModF - Power (Integer) —
int
— PowI - Power (Real) —
fixed
— Pow - Round (Integer) —
int
— RoundI - Round (Real) —
fixed
— Round - Pow2 (Integer) —
int
— Pow2I - Pow2 (Real) —
fixed
— Pow2 - Square Root (Integer) —
int
— SquareRootI - Square Root (Real) —
fixed
— SquareRoot - Trunc (Integer) —
int
— TruncI - Trunc (Real) —
fixed
— Trunc
# Examples
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:9901
lv_heroKilledUnit = libGame_gf_HeroKilledUnit();
lv_wizenedDuelistStacks = IntToFixed(UnitBehaviorCount(libGame_gf_HeroKilledUnit(), "GreymaneWizenedDuelistQuestToken"));
UnitSetTokenCount(lv_heroKilledUnit, "GreymaneWizenedDuelistQuestToken", Trunc((lv_wizenedDuelistStacks / 2.0)), lv_heroKilledUnit);
UnitSetTokenCount(lv_heroKilledUnit, "GreymaneWizenedDuelistTokenCounter", 0.0, lv_heroKilledUnit);
return true;
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:25561
lv_siegeScore = PlayerScoreValueGetAsFixed(lv_player, "SiegeDamage");
lv_modScore = (lv_siegeScore / 1000.0);
lv_finalScore = (lv_rangedDamageDealtFraction + (Trunc(lv_modScore) / 100.0));
// Actions
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2140
}
else {
lv_levelDifferenceTrunc = AbsF(Trunc(lv_levelDifferenceReal));
}
lv_levelDifferenceModulo = AbsF(ModF(lv_levelDifferenceReal, 1.0));