flowrs-engine/spec/conformance/fdsl/function.fdsl
flowRS 2b6f30d348 flowRS engine, cut from flowRS f907e0756a7c
Built alone from an empty CARGO_HOME, its tests passed, and flowrsc checked, ran and exported a
document from the conformance corpus; the export built alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-10 08:54:33 -05:00

9 lines
415 B
Text

fn calibrate@1(raw: f64, gain: f64, offset: f64 = 0) -> (volts: "f64@{unit=V}") {
let n0 = math.mul(a: raw.value, b: gain.value);
let n1 = math.add(a: n0.product, b: offset.value);
out volts = n1.sum;
}
let n0 = FloatLiteral { value: 1.5 };
let n1 = calibrate@1(raw: n0.value.copy()) { gain: 2 };
let n2 = calibrate@1(raw: n0.value.copy()) { gain: 2, offset: -0.1 };
let n3 = io.print(value: n2.volts);