Package civitas.celestis.math.decimal
Class Decimals
java.lang.Object
civitas.celestis.math.decimal.Decimals
Contains utilities related to
BigDecimals.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MathContextstatic final intstatic final RoundingMode -
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimalclamp(BigDecimal val, BigDecimal min, BigDecimal max) Clamps the provided valuevalto respect the range of[min, max].
-
Field Details
-
RUNTIME_PRECISION
public static final int RUNTIME_PRECISION- See Also:
-
RUNTIME_ROUNDING_MODE
-
RUNTIME_CONTEXT
-
-
Method Details
-
clamp
@Nonnull public static BigDecimal clamp(@Nonnull BigDecimal val, @Nonnull BigDecimal min, @Nonnull BigDecimal max) Clamps the provided valuevalto respect the range of[min, max].- Parameters:
val- The value of which to clampmin- The minimum allowed value (inclusive)max- The maximum allowed value (inclusive)- Returns:
- The clamped value
-