/*
 * Generated by EML-lang C backend
 * Source module: clamp_bounded
 * Source file:   /home/monogate/monogate/forge/examples/clamp_bounded.eml
 * Functions:     1
 * Constants:     2
 * Types:         0
 */

#include "libmonogate.h"
#include <stdint.h>
#include <math.h>

static const double LO = (-1.0);
static const double HI = 1.0;

/*
 * clamp_unit
 * Chain order: 0     Cost class: p0-d2-w0-c0
 * EML depth:   2  Drift risk: LOW
 * Dynamics:    0 osc, 0 decay  (predicted_r=0)
 * FPGA est:   2 MAC, 0 exp, 0 ln, 0 trig -> 4 cy @ 32-bit
 */
double clamp_unit(double x) {
    return mg_clamp(x, LO, HI);
}
