numbro icon indicating copy to clipboard operation
numbro copied to clipboard

milli, micro, nano abbreviations for values less than 1?

Open Aerlinger opened this issue 7 years ago • 2 comments

Is there a way to format suffix abbreviations for values less than 1 with this library?

For instance, something like this:

numeral(0.5).format(...) -> '500m' (500 millis) numeral(0.001).format(...) -> '1m' (1 milli) numeral(0.000001).format(...) -> '1µ' (1 micro)

Ideally, the following abbreviations would be supported:

  • y - yocto, 10⁻²⁴
  • z - zepto, 10⁻²¹
  • a - atto, 10⁻¹⁸
  • f - femto, 10⁻¹⁵
  • p - pico, 10⁻¹²
  • n - nano, 10⁻⁹
  • µ - micro, 10⁻⁶
  • m - milli, 10⁻³
  • (none) - 10⁰
  • k - kilo, 10³
  • M - mega, 10⁶
  • G - giga, 10⁹
  • T - tera, 10¹²
  • P - peta, 10¹⁵
  • E - exa, 10¹⁸
  • Z - zetta, 10²¹
  • Y - yotta, 10²⁴

Obviously, I can use scientific notation, but was wondering if this sort of thing was possible.

Aerlinger avatar Feb 28 '17 13:02 Aerlinger

I don't think so, but that would be a great addition :smile:

BenjaminVanRyseghem avatar Feb 28 '17 13:02 BenjaminVanRyseghem

Duplicate of #126?

paravoid avatar Dec 03 '21 02:12 paravoid