llm
Download
40 lines 1.2 KiBGroffModified 2026-08-30 raw
12345678910111213141516171819202122232425262728293031323334353637383940
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Num.digits 3 2026-08-27 "Tomo man-pages"
.SH NAME
Num.digits \- decimal expansion
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Num.digits\ :\ func(n:\ Num,\ digits:\ Int\ =\ 15,\ ellipsis:\ Text\ =\ "…"\ ->\ Text)
.fi
.SH DESCRIPTION
The decimal expansion of a number, to at most the requested number of fractional digits. A value that fits exactly stops early rather than padding with zeros, and gets no marker. A value that doesn't shows a truncated prefix of its true expansion with the ellipsis appended, and never a rounding: every digit shown is a digit the value actually has. To round, round first.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
n	Num	The number to expand. 	-
digits	Int	The maximum number of fractional digits. 	15
ellipsis	Text	Appended when the digits don't capture the value exactly. 	"…"
.TE
.SH RETURN
The decimal expansion as text.

.SH EXAMPLES
.EX
assert (1/3).digits(10) == "0.3333333333…"
assert Num.PI.digits(10) == "3.1415926535…"
assert (2/3).digits(10, ellipsis="") == "0.6666666666"
assert (0.25).digits(10) == "0.25"
.EE
.SH SEE ALSO
.BR Tomo-Num (3)