aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Num.percent.3
blob: fba7be4c43f28facfae55f11a936f4d1df560156 (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
40
41
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Num.percent 3 2025-09-06 "Tomo man-pages"
.SH NAME
Num.percent \- format as a percentage
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Num.percent\ :\ func(n:\ Num,\ precision:\ Num\ =\ 0.01\ ->\ Text)
.fi
.SH DESCRIPTION
Convert a number into a percentage text with a percent sign.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
n	Num	The number to be converted to a percent. 	-
precision	Num	Round the percentage to this precision level. 	0.01
.TE
.SH RETURN
A text representation of the number as a percentage with a percent sign.

.SH EXAMPLES
.EX
>> (0.5).percent()
= "50%"
>> (1./3.).percent(2)
= "33.33%"
>> (1./3.).percent(2, precision=0.0001)
= "33.3333%"
>> (1./3.).percent(2, precision=10.)
= "30%"
.EE