Files
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

8 lines
407 B
Plaintext

// LinearInterp: the value at X on the straight line through (X0, Y0) and
// (X1, Y1). X may lie outside [X0, X1]: that is extrapolation, and the line
// carries on. The REQUIRE names the difference the division divides by.
FUNCTION LinearInterp(X0 : FLOAT, Y0 : FLOAT, X1 : FLOAT, Y1 : FLOAT, X : FLOAT) RETURNS FLOAT
REQUIRE X1 - X0 != 0.0
RETURN Y0 + (Y1 - Y0) * (X - X0) / (X1 - X0)
ENDFUNCTION