llm
Download
41 lines 1022 BGroffModified 2026-08-27 raw
1234567891011121314151617181920212223242526272829303132333435363738394041
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Num.round 3 2026-08-27 "Tomo man-pages"
.SH NAME
Num.round \- round to the nearest multiple
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Num.round\ :\ func(x:\ Num,\ increment:\ Num\ =\ 1\ ->\ Num)
.fi
.SH DESCRIPTION
The nearest multiple of an increment, exactly: the nearest penny, nickel, third, or thousand are all one argument away, and the default increment of 1 gives the nearest whole number. Ties go to the even multiple.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
x	Num	The number to round. 	-
increment	Num	The step to round to a multiple of. Rounding to zero is an error. 	1
.TE
.SH RETURN
`x` rounded to the nearest multiple of `increment`.

.SH EXAMPLES
.EX
assert (4.6).round() == 5
assert (2.5).round() == 2
assert (3.14159).round(0.01) == 3.14
assert (0.13).round(0.05) == 0.15
assert (0.5).round(1/3) == 2/3
assert (1234567.).round(1000) == 1235000
.EE
.SH SEE ALSO
.BR Tomo-Num (3)