MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / clamp

Method clamp

src/main/java/field/linalg/BaseMath.java:25–29  ·  view source on GitHub ↗

Clamps the value to the specified range. @param val the value to clamp @param low the lower value that will replace val if val < low. @param high the upper value that will replace val if val > high. @return the clamped value in the range [low, high].

(double val, double low, double high)

Source from the content-addressed store, hash-verified

23 * @return the clamped value in the range [low, high].
24 */
25 public static final double clamp(double val, double low, double high) {
26 if (val > high) return high;
27 if (val < low) return low;
28 return val;
29 }
30
31 /**
32 * Input-checking inverse cosine. Clamps the input to the domain of acos (i.e. [-1..1]) before evaluating, instead of returning a silent NaN like java.lang.Math.acos. Useful when there's a

Callers 2

acosMethod · 0.95
asinMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected