aboutsummaryrefslogtreecommitdiffstats
path: root/src/hal/components/limit1.comp
blob: 8c47daa1c071aefd76af565b54afcd55384dbb26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
component limit1 "Limit the output signal to fall between min and max";
pin in float in;
pin out float out;
pin in float min_=-1e20;
pin in float max_=1e20;
function _;
license "GPL";
author "Jeff Epler";
;;
FUNCTION(_) {
    double tmp = in;
    if(tmp < min_) tmp = min_;
    if(tmp > max_) tmp = max_;
    out = tmp;
}
bues.ch cgit interface