MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / clamp

Function clamp

examples/Modbus PLC Simulator/plc_simulator.py:136–138  ·  view source on GitHub ↗

Clamp value between min and max.

(value: float, min_val: float, max_val: float)

Source from the content-addressed store, hash-verified

134
135
136def clamp(value: float, min_val: float, max_val: float) -> float:
137 """Clamp value between min and max."""
138 return max(min_val, min(max_val, value))
139
140
141# =========================================================================

Callers 15

updateMethod · 0.70
_update_noiseMethod · 0.70
_update_motor_physicsMethod · 0.70
_update_flow_and_loadMethod · 0.70
_update_vibrationMethod · 0.70
_failure_sequenceMethod · 0.70
get_registersMethod · 0.70
triggerOriginMethod · 0.50
solveBitTimingFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected