Class RoundingModeLongExtensions
- Namespace
- ElectricDrill.AstraRpgFramework.Utils
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
long-value helpers for RoundingMode, shared by any package that needs to round a fractional gameplay amount (damage, healing, modifier deltas, etc.) to a long. Round uses midpoint-away-from-zero semantics to match the RoundingMode contract.
public static class RoundingModeLongExtensions
- Inheritance
-
objectRoundingModeLongExtensions
Methods
ApplyToLong(RoundingMode, double)
Applies mode to value and returns a long.
public static long ApplyToLong(this RoundingMode mode, double value)
Parameters
modeRoundingModeRounding mode to apply.
valuedoubleValue to round.
Returns
- long
The rounded long value.
ApplyToNonNegativeLong(RoundingMode, double)
Clamps value to zero before applying mode.
public static long ApplyToNonNegativeLong(this RoundingMode mode, double value)
Parameters
modeRoundingModeRounding mode to apply.
valuedoubleValue to clamp and round.
Returns
- long
The rounded non-negative long value.