aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Num.with_precision.3
blob: eb463bacb67de8b03d425a8a8bfafe48c9f98367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Num.with_precision 3 2025-09-06 "Tomo man-pages"
.SH NAME
Num.with_precision \- round to a given precision
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Num.with_precision\ :\ func(n:\ Num,\ precision:\ Num\ ->\ Num)
.fi
.SH DESCRIPTION
Round a number to the given precision level (specified as `10`, `.1`, `.001` etc).


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
n	Num	The number to be rounded to a given precision. 	-
precision	Num	The precision to which the number should be rounded. 	-
.TE
.SH RETURN
The number, rounded to the given precision level.

.SH EXAMPLES
.EX
>> (0.1234567).with_precision(0.01)
= 0.12
>> (123456.).with_precision(100)
= 123500
>> (1234567.).with_precision(5)
= 1234565
.EE