The gaps function can be useful for formatting in other modules that work with displaying large numbers.
Using the gaps function, the first argument is the number to format. The second argument can be a table with keys that tell the module how to format. The table keys that can be used are:
gap - a number with CSS units (px, em, en, etc) that define the size of the gap between numbers. If blank, the module will use 0.25em.
prec - a number that determines the precision of the decimal part of the number. If the precision is less than the number of digits, extra digits will be removed without rounding; if it is more, zeroes will be added to the end to create the desired precision. If blank, the module will use -1, which means the precision will be the same as the number given; no digits added or removed.
Note that the return statement is a table. This means more styling or text can be added to the wrapper span tag, but it may also mean that tostring() may be required when used in other modules.
groups
The groups function can be used in other modules to separate a number into groups as gaps does, but instead of a formatted string, the function will return tables whose elements are the separated groups.