I'm a beginner programmer, I've just been making a game to play on Discord. It's working fine so far, but so far as fine-tuning, I've come into a problem with numeral.js that I can't seem to find any good references so far as how to fix.
In the game, numbers can get extremely high. The abbreviations k, m, b, and t work out for a good while and are more user-friendly than engineering, but now numbers are starting to get into the quadrillions and quintillions, and will display things like "9,999t". I would like to set up the default behavior of numeral.format()
to use the abbreviations for anything below 1 quadrillion, and engineering after.
I imagine it's simple if I have the know-how, but I've just been following guides for a few months and only know a few basics, and I haven't the slightest idea how to do this. Anyone who could help me out or point me in the right direction would be appreciated.
In reply to comments:
numeral.defaultFormat("O,0[.]0a");
is my current default format, and when I am dealing with numbers in the quintillions it'll show, as an example, "249,448,931.3t"
What I want it to do is display any number over 1,000t as something like 1.0e+12 and any number below that using standard abbreviations. I tried something like:
numeral.defaultFormat("O,0[.]0a[e+0]");
but that just went to engineering by default.