formatNumber is an alternate way to print numbers. It is especially useful when
representing both integral and floating point values with float point data types.
formatNumber was created for tsv-summarize, where all calculations are done as doubles,
but may be integers by nature. In addition, output may be either for human consumption
or for additional machine processing. Integers are printed normally. Floating point is
printed as follows:
Values that are exact integral values are printed as integers, as long as they
are within the range of where all integers are represented exactly by the floating
point type. The practical effect is to avoid switching to exponential notion.
If the specified floatPrecision is between 0 and readablePrecisionMax, then
floatPrecision is used to set the significant digits following the decimal point.
Otherwise, it is used to set total significant digits. This does not apply to
really large numbers, for doubles, those larger than 2^53. Trailing zeros are
chopped in all cases.
formatNumber is an alternate way to print numbers. It is especially useful when representing both integral and floating point values with float point data types.
formatNumber was created for tsv-summarize, where all calculations are done as doubles, but may be integers by nature. In addition, output may be either for human consumption or for additional machine processing. Integers are printed normally. Floating point is printed as follows: