1234567891011121314151617181920212223242526272829303132333435363738 | '\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Num.clamped 3 2026-08-27 "Tomo man-pages"
.SH NAME
Num.clamped \- clamp to a range
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Num.clamped\ :\ func(x:\ Num,\ low:\ Num,\ high:\ Num\ ->\ Num)
.fi
.SH DESCRIPTION
A number restricted to a range.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx
l l l.
Name Type Description
x Num The number to clamp.
low Num The lowest allowed value.
high Num The highest allowed value.
.TE
.SH RETURN
`x`, or the nearer of `low` and `high` if `x` falls outside them.
.SH EXAMPLES
.EX
assert (1.5).clamped(0, 1) == 1
assert (0.5).clamped(0, 1) == 0.5
.EE
.SH SEE ALSO
.BR Tomo-Num (3)
|