wcomp.comp
1 component wcomp "Window comparator"; 2 pin in float in "Value being compared"; 3 pin in float min_ "Low boundary for comparison"; 4 pin in float max_ "High boundary for comparison"; 5 pin out bit out "True if \\fBin\\fR is strictly between \\fBmin\\fR and \\fBmax\\fR"; 6 pin out bit under "True if \\fBin\\fR is less than or equal to \\fBmin\\fR"; 7 pin out bit over "True if \\fBin\\fR is greater than or equal to \\fBmax\\fR"; 8 notes "If \\fBmax\\fR <= \\fBmin\\fR then the behavior is undefined."; 9 10 function _; 11 license "GPL"; 12 ;; 13 FUNCTION(_) { 14 double tmp = in; 15 under = (tmp <= min_); 16 over = (tmp >= max_); 17 out = !(over || under); 18 }