diff options
author | axtlos <axtlos@disroot.org> | 2024-09-23 23:01:51 +0200 |
---|---|---|
committer | axtlos <axtlos@disroot.org> | 2024-09-23 23:01:51 +0200 |
commit | 8996ee7580ed85b42b6399f9f64e29092ce21c41 (patch) | |
tree | 3cec945364e91e6504edf9a6c533fa104a0d3f34 /doc | |
parent | d9aeb51683449ef79339c9ca3c80059c17dec599 (diff) | |
download | extlib-8996ee7580ed85b42b6399f9f64e29092ce21c41.tar.gz extlib-8996ee7580ed85b42b6399f9f64e29092ce21c41.tar.bz2 |
Add cap,min,max functions
Diffstat (limited to 'doc')
-rw-r--r-- | doc/cap.3 | 60 | ||||
-rw-r--r-- | doc/max.3 | 60 | ||||
-rw-r--r-- | doc/min.3 | 60 |
3 files changed, 180 insertions, 0 deletions
diff --git a/doc/cap.3 b/doc/cap.3 new file mode 100644 index 0000000..f5b4efb --- /dev/null +++ b/doc/cap.3 @@ -0,0 +1,60 @@ +'\" t +.\" Copyright 2024 axtlos (axtlos@disroot.org) +.\" +.\" SPDX-License-Identifier: BSD-3-Clause + +.TH cap 3 2024-09-23 "extlib" +.SH NAME +cap, min, max \- limit a float between a min/max value +.SH LIBRARY +extlib extended standard library +.RI ( libextlib ", " \-lextlib ) +.SH SYNOPSIS +.nf +.B #include <extlib.h> +.P +.BI "float min (float v, float min_v);" +.P +.BI "float max (float v, float max_v);" +.P +.BI "float cap (float v, float min_v, float max_v);" +.P +.fi +.SH DESCRIPTION +The +.BR min () +function limits +.I v +to a given minimum value +.IR min_v . +The +.BR max () +function limits +.I v +to a given maximum value +.IR max_v . +The +.BR cap () +function limits +.I v +between a given minimum value +.I min_v +and a maximum value +.IR max_v . +.fi +.SH RETURN VALUE +.BR max () +and +.BR min () +return the passed value +.I v +if it is in above/below the given maximum/minimum. Otherwise the maximum/minimum is returned. +.BR cap () +returns the given value +.I v +if it is between the given maximum and minimum. +Otherwise the maximum is returned if the value is above the maximum +.IR max_v , +the minimum is returned if the value is below the minimum +.IR min_v . +.\" SRC END diff --git a/doc/max.3 b/doc/max.3 new file mode 100644 index 0000000..353b64d --- /dev/null +++ b/doc/max.3 @@ -0,0 +1,60 @@ +'\" t +.\" Copyright 2024 axtlos (axtlos@disroot.org) +.\" +.\" SPDX-License-Identifier: BSD-3-Clause + +.TH max 3 2024-09-23 "extlib" +.SH NAME +cap, min, max \- limit a float between a min/max value +.SH LIBRARY +extlib extended standard library +.RI ( libextlib ", " \-lextlib ) +.SH SYNOPSIS +.nf +.B #include <extlib.h> +.P +.BI "float min (float v, float min_v);" +.P +.BI "float max (float v, float max_v);" +.P +.BI "float cap (float v, float min_v, float max_v);" +.P +.fi +.SH DESCRIPTION +The +.BR min () +function limits +.I v +to a given minimum value +.IR min_v . +The +.BR max () +function limits +.I v +to a given maximum value +.IR max_v . +The +.BR cap () +function limits +.I v +between a given minimum value +.I min_v +and a maximum value +.IR max_v . +.fi +.SH RETURN VALUE +.BR max () +and +.BR min () +return the passed value +.I v +if it is in above/below the given maximum/minimum. Otherwise the maximum/minimum is returned. +.BR cap () +returns the given value +.I v +if it is between the given maximum and minimum. +Otherwise the maximum is returned if the value is above the maximum +.IR max_v , +the minimum is returned if the value is below the minimum +.IR min_v . +.\" SRC END diff --git a/doc/min.3 b/doc/min.3 new file mode 100644 index 0000000..c260207 --- /dev/null +++ b/doc/min.3 @@ -0,0 +1,60 @@ +'\" t +.\" Copyright 2024 axtlos (axtlos@disroot.org) +.\" +.\" SPDX-License-Identifier: BSD-3-Clause + +.TH min 3 2024-09-23 "extlib" +.SH NAME +cap, min, max \- limit a float between a min/max value +.SH LIBRARY +extlib extended standard library +.RI ( libextlib ", " \-lextlib ) +.SH SYNOPSIS +.nf +.B #include <extlib.h> +.P +.BI "float min (float v, float min_v);" +.P +.BI "float max (float v, float max_v);" +.P +.BI "float cap (float v, float min_v, float max_v);" +.P +.fi +.SH DESCRIPTION +The +.BR min () +function limits +.I v +to a given minimum value +.IR min_v . +The +.BR max () +function limits +.I v +to a given maximum value +.IR max_v . +The +.BR cap () +function limits +.I v +between a given minimum value +.I min_v +and a maximum value +.IR max_v . +.fi +.SH RETURN VALUE +.BR max () +and +.BR min () +return the passed value +.I v +if it is in above/below the given maximum/minimum. Otherwise the maximum/minimum is returned. +.BR cap () +returns the given value +.I v +if it is between the given maximum and minimum. +Otherwise the maximum is returned if the value is above the maximum +.IR max_v , +the minimum is returned if the value is below the minimum +.IR min_v . +.\" SRC END |