FormatMetricPrefix

FormatMetricPrefix(number, binary, precision): String

Convert numeric value to human-readable form with metric prefix.

Table 1. Parameters

number

Number

Number to format.

binary

Boolean

Optional argument. Set to true to use binary multipliers (Ki, Mi, etc.). Default value is false.

precision

Unsigned Integer

Optional argument with rounding precision. Acceptable values are from 0 to 20. Default value is 2.

Return

String containing the value converted to human-readable form with metric prefix.

>>> FormatMetricPrefix(5000)
5.00 k
>>> FormatMetricPrefix(5000, true)
4.88 Ki
>>> FormatMetricPrefix(-1234567.89, false, 0)
-1 M
>>> FormatMetricPrefix(-1234567.89,, 10)
-1.2345678900 M