Macaw OS C reference

Function mid

#include <macaw.h>
double mid(double a, double b, double c);

Gives the middle one of three numbers. With a low and a high limit either side, it keeps a number between them.

Parameters

adouble
The first number.
bdouble
The second number.
cdouble
The third number.

Returns double

Whichever of the three is between the other two.

In Handy maths for games, with rnd, clamp, sgn, lerp, flr.