Cldr v0.0.14 Cldr.Number.Formatter.Short

Formats a number according to the locale-specific :short formats

This is best explained by some examples:

iex> Number.to_string 123, format: :short
"123"

iex(> Number.to_string 1234, format: :short
"1K"

iex> Number.to_string 523456789, format: :short
"523M"

iex> Number.to_string 7234567890, format: :short
"7B"

iex> Number.to_string 7234567890, format: :long
"7 billion"

These formats are compact representations however they do lose precision in the presentation in favour of human readibility.

Note that for a :currency short format the number of decimal places is retrieved from the currency definition itself. You can see the difference in the following examples:

iex(14)> Number.to_string 1234, format: :short, currency: "EUR"
"€1.23K"

iex(15)> Number.to_string 1234, format: :short, currency: "JPY"
"¥1K"

Summary

Functions

to_string(number, style, options)