See examples in NumConvert.mw
Round(v,digits,$)
round number to desired number of digits::integer.
Here v can be realcons or complex or any indexable object of any depth.mod1(e,m,$)
reduce e::integer to integer modulo m::posint in the range 1..m
(use mod to reduce to range 0..m-1).Reduce2P(x,/P,x0,$)
reduces a number x to the interval x0..x0+P using periodicity condition.
Here and below P:=1 and x0:=0.
In the case of symbolic x, the list of indeterminates is evaluated by the sequence
of numbers exp(-2.07-0.5*i),i=1..PeriodicMean(V,/i1orx1,P,x0,{maxiter,digits,printout},$)
calculate mean value for periodic variable given by V::indexable.
It is only meaningful if there is a gap in the distribution of V,
because one need to iteratively find the middle of this gap, xgap,
and preprocess V by Reduce2P(V,P,xgap).
If the gap is small, either increase maxiter::posint:=3,
or decrease digits::integer:=Digits-2,
or provide better initial guess of the mean value through i1orx1::{list,set}:=[1]:
if it is a list, V[op(i1orx1)] is used for the guess,
otherwise op(i1orx1) is used.PeriodicStandardDeviation(V,/i1orx1,P,x0,{maxiter,digits,printout},$)
calculate standard deviation for periodic variable.angle2pair(angle::numeric,n::integer,$)::a0,da
determine the nearest high-symmetry (360/n) and
reduce it to -180<a0≤180 interval, so that a=a0+da+360*integer.
For negative n the reference angle is shifted by 180/|n|, see examples.ReduceFloat(f)::float
delete trailing zeros from float f::atomic or add decimal point to integer.ReduceFloat2(f,$)::{float,integer}
delete trailing zeros from float, converting it to integer if appropriate.ReduceFloat3(f,base,/digits,$)::{float,integer,rational}
convert float to rational with base::posint
by checking if f*base is integer at digits::posint:=Digits-2 level of precision.ReduceFloatGrid(G,id,digits,/digits2,$)::G,lsn
convert grid of floats to rational grid, where
G::list(list) is the grid;id::{posint,list(posint)} grid indexes, a posint is interpreted as [$1..id];digits::posint for identifying zero values and negligible deviations;digits2::posint:=digits-2 for convert,rational;lsn::list(integer) list of common denominators.