123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 | '\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Num 3 2026-08-27 "Tomo man-pages"
.SH NAME
Num \- a Tomo type
.SH LIBRARY
Tomo Standard Library
.fi
.SH METHODS
.TP
.BI Num.PI\ :\ Num
The ratio of a circle's circumference to its diameter, held exactly rather than as an approximation.
For more, see:
.BR Tomo-Num.PI (3)
.TP
.BI Num.TAU\ :\ Num
Two times pi, held exactly.
For more, see:
.BR Tomo-Num.TAU (3)
.TP
.BI Num.abs\ :\ func(x:\ Num\ ->\ Num)
The absolute value of a number.
For more, see:
.BR Tomo-Num.abs (3)
.TP
.BI Num.acos\ :\ func(x:\ Num\ ->\ Num?)
The arc cosine of a number, in radians.
For more, see:
.BR Tomo-Num.acos (3)
.TP
.BI Num.asin\ :\ func(x:\ Num\ ->\ Num?)
The arc sine of a number, in radians.
For more, see:
.BR Tomo-Num.asin (3)
.TP
.BI Num.atan\ :\ func(x:\ Num\ ->\ Num)
The arc tangent of a number, in radians. Defined for every number.
For more, see:
.BR Tomo-Num.atan (3)
.TP
.BI Num.atan2\ :\ func(y:\ Num,\ x:\ Num\ ->\ Num?)
The angle of the point \fB(x, y)\fR, in radians, placed in the correct quadrant by the signs of both arguments.
For more, see:
.BR Tomo-Num.atan2 (3)
.TP
.BI Num.ceil\ :\ func(x:\ Num\ ->\ Num)
The smallest whole number greater than or equal to a number.
For more, see:
.BR Tomo-Num.ceil (3)
.TP
.BI Num.clamped\ :\ func(x:\ Num,\ low:\ Num,\ high:\ Num\ ->\ Num)
A number restricted to a range.
For more, see:
.BR Tomo-Num.clamped (3)
.TP
.BI Num.cos\ :\ func(x:\ Num\ ->\ Num)
The cosine of an angle in radians.
For more, see:
.BR Tomo-Num.cos (3)
.TP
.BI Num.cosh\ :\ func(x:\ Num\ ->\ Num)
The hyperbolic cosine of a number.
For more, see:
.BR Tomo-Num.cosh (3)
.TP
.BI Num.digits\ :\ func(n:\ Num,\ digits:\ Int\ =\ 15,\ ellipsis:\ Text\ =\ "…"\ ->\ Text)
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.
For more, see:
.BR Tomo-Num.digits (3)
.TP
.BI Num.exp\ :\ func(x:\ Num\ ->\ Num)
e raised to the given power.
For more, see:
.BR Tomo-Num.exp (3)
.TP
.BI Num.floor\ :\ func(x:\ Num\ ->\ Num)
The largest whole number less than or equal to a number.
For more, see:
.BR Tomo-Num.floor (3)
.TP
.BI Num.gcd\ :\ func(x:\ Num,\ y:\ Num\ ->\ Num?)
The greatest common divisor of two numbers, generalized to fractions: the largest value by which both can be divided to give whole numbers.
For more, see:
.BR Tomo-Num.gcd (3)
.TP
.BI Num.inverse\ :\ func(x:\ Num\ ->\ Num?)
One divided by a number.
For more, see:
.BR Tomo-Num.inverse (3)
.TP
.BI Num.is_between\ :\ func(x:\ Num,\ low:\ Num,\ high:\ Num\ ->\ Bool)
Whether a number lies within a range, inclusive.
For more, see:
.BR Tomo-Num.is_between (3)
.TP
.BI Num.is_exact\ :\ func(n:\ Num,\ digits:\ Int\ =\ 15\ ->\ Bool)
Whether the requested number of fractional digits represents a number exactly, rather than rounding it.
For more, see:
.BR Tomo-Num.is_exact (3)
.TP
.BI Num.is_integer\ :\ func(n:\ Num\ ->\ Bool)
Whether a number is a whole number.
For more, see:
.BR Tomo-Num.is_integer (3)
.TP
.BI Num.is_rational\ :\ func(n:\ Num\ ->\ Bool)
Whether a number can be written exactly as a fraction, as opposed to an irrational value like the square root of two.
For more, see:
.BR Tomo-Num.is_rational (3)
.TP
.BI Num.lcm\ :\ func(x:\ Num,\ y:\ Num\ ->\ Num?)
The least common multiple of two numbers, generalized to fractions.
For more, see:
.BR Tomo-Num.lcm (3)
.TP
.BI Num.log\ :\ func(x:\ Num\ ->\ Num?)
The natural logarithm of a number.
For more, see:
.BR Tomo-Num.log (3)
.TP
.BI Num.log10\ :\ func(x:\ Num\ ->\ Num?)
The base-10 logarithm of a number.
For more, see:
.BR Tomo-Num.log10 (3)
.TP
.BI Num.log2\ :\ func(x:\ Num\ ->\ Num?)
The base-2 logarithm of a number.
For more, see:
.BR Tomo-Num.log2 (3)
.TP
.BI Num.max\ :\ func(x:\ Num,\ y:\ Num\ ->\ Num)
The larger of two numbers.
For more, see:
.BR Tomo-Num.max (3)
.TP
.BI Num.min\ :\ func(x:\ Num,\ y:\ Num\ ->\ Num)
The smaller of two numbers.
For more, see:
.BR Tomo-Num.min (3)
.TP
.BI Num.mix\ :\ func(amount:\ Num,\ x:\ Num,\ y:\ Num\ ->\ Num)
A point between two numbers, exactly. \fBamount\fR of zero gives \fBx\fR, one gives \fBy\fR, and a half gives the true midpoint.
For more, see:
.BR Tomo-Num.mix (3)
.TP
.BI Num.parse\ :\ func(text:\ Text\ ->\ Num?)
The exact number a piece of text denotes. Both decimals and fractions are accepted, and both are read exactly: "0.1" is a tenth, not the nearest float to one.
For more, see:
.BR Tomo-Num.parse (3)
.TP
.BI Num.percent\ :\ func(n:\ Num,\ precision:\ Num\ =\ 1%\ ->\ Text)
A number as a percentage, rounded to the given precision.
For more, see:
.BR Tomo-Num.percent (3)
.TP
.BI Num.round\ :\ func(x:\ Num,\ increment:\ Num\ =\ 1\ ->\ Num)
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.
For more, see:
.BR Tomo-Num.round (3)
.TP
.BI Num.sin\ :\ func(x:\ Num\ ->\ Num)
The sine of an angle in radians.
For more, see:
.BR Tomo-Num.sin (3)
.TP
.BI Num.sinh\ :\ func(x:\ Num\ ->\ Num)
The hyperbolic sine of a number.
For more, see:
.BR Tomo-Num.sinh (3)
.TP
.BI Num.sqrt\ :\ func(x:\ Num\ ->\ Num?)
The square root of a number, exactly. The result of a non-square stays symbolic, so identities like \fBsqrt(2) * sqrt(2) == 2\fR hold.
For more, see:
.BR Tomo-Num.sqrt (3)
.TP
.BI Num.symbolic\ :\ func(n:\ Num\ ->\ Text)
The exact value written out: a whole number, a fraction, or a symbolic expression for an irrational.
For more, see:
.BR Tomo-Num.symbolic (3)
.TP
.BI Num.tan\ :\ func(x:\ Num\ ->\ Num?)
The tangent of an angle in radians.
For more, see:
.BR Tomo-Num.tan (3)
.TP
.BI Num.tanh\ :\ func(x:\ Num\ ->\ Num)
The hyperbolic tangent of a number.
For more, see:
.BR Tomo-Num.tanh (3)
.TP
.BI Num.tex\ :\ func(n:\ Num\ ->\ Text)
The exact value as TeX math-mode source.
For more, see:
.BR Tomo-Num.tex (3)
.TP
.BI Num.trunc\ :\ func(x:\ Num\ ->\ Num)
The whole part of a number, discarding the fraction.
For more, see:
.BR Tomo-Num.trunc (3)
|