diff options
author | Tyler Murphy <=> | 2023-07-16 02:54:32 -0400 |
---|---|---|
committer | Tyler Murphy <=> | 2023-07-16 02:54:32 -0400 |
commit | fbf131b5c043b27e0b1543374bb144e3e426f723 (patch) | |
tree | 07f0ab2fc107b36621d5ae95480e6a91e332548b /libk/src/math/fclamp.c | |
download | finix-fbf131b5c043b27e0b1543374bb144e3e426f723.tar.gz finix-fbf131b5c043b27e0b1543374bb144e3e426f723.tar.bz2 finix-fbf131b5c043b27e0b1543374bb144e3e426f723.zip |
initial
Diffstat (limited to '')
-rw-r--r-- | libk/src/math/fclamp.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libk/src/math/fclamp.c b/libk/src/math/fclamp.c new file mode 100644 index 0000000..f757b48 --- /dev/null +++ b/libk/src/math/fclamp.c @@ -0,0 +1,13 @@ +#include <math.h> + +double fclamp(double x, double l, double h) { + if (x < l) return l; + if (x > h) return h; + return x; +} + +float fclampf(float x, float l, float h) { + if (x < l) return l; + if (x > h) return h; + return x; +} |