Do formatted values like 1M still counts as 1.000.000?

Hi guys :slight_smile:

When making games with really large numbers, do formatted numbers then still count as their initial value digit-wise?
For instance:
10.000 = 10k.
Does 10k count as 2 or 5 digits?

If so is there no way to convert them, so that 1m would simply count as 1 digit (or 2 if the “M” counts)?

Thanks for reading :slight_smile:

By “count” do you mean memory use? In what context are you interested in the “count”?

Are you asking about character space?
If that was the case, what you see is what’s counted :wink: You’d format the number to display it.
If you want to show 10,000 as 10k it’s 3 characters to show, right?

I think I phrased my question badly :stuck_out_tongue:
It’s my understanding that an int, long, float, double and so on, can only contain a specific amount of digits (with or without decimals, depending on the type).

I may have gotten it all wrong, but I always thought that an integer for instance would be able to show number between -2,147,483,648 and 2,147,483,647.
Would I be able to show the number 1.000.000.000.000 if formatted as 1T or would it still count as a trillion and be too big??

I see, I see. Okay… The value it can store is based on its memory size. Yes there are limits. Try a quick google search for the exact limits in c# if you really want to know. For a trillion (if that’s a limit), you’d want to use ‘long’. :slight_smile:
And to sort of touch on your first message, you cannot even declare a variable with ‘k’.
int num = 10k; // is not valid code :slight_smile:
(of course you can write it out to the game screen as “10k” but that’s different).

If your game’s score is thousands-based, you can always store 5000 points as 5 and then just add a “K” or “000” when you display it to the user.

If you don’t need negative numbers there is ulong that goes from 0 to 18,446,744,073,709,551,615 using 64-bit. is that enough?

I was actually thinking of pointing that out when I responded :slight_smile:

It’s actually not really for my game… I was playing a game - one of those clicker games that reach VERY high numbers.
I asked someone why the late-game was lacking content, to which they responded that the devs had a problem with the numbers getting too big, for the doubles they’re using…
Their numbers appear as formatted, so I assumed that would never be a problem, but evidently it is, which made me wonder about the question asked in this thread :slight_smile:

Ah, I see. It’s always cool to learn :slight_smile: Now you know heh.

Depends on the numeric type.

A fixed point system has a specific range of numbers it can show, and can show all integers in that range. These types include:
byte, int, long

A floating point system has a significant value range that it can show, and will move the decimal point (float the decimal point) allowing for a much larger range. There is no guarantee that all integers in that range are possible to be shown, but that any number with a the number of sig values will fit in that range. These types include:
float, double, decimal

Having about 7 sig values, 16 sig values, and 28 sig values respectively.

Note, I say ‘integer’, because theoretically there are an infinite number of ‘numbers’ between any 2 integers. But this isn’t to mean that fixed point systems can only represent integers… you can find fixed point systems that support a fixed width of fractional values.

Anyways… the system you describe (OP), a floating point system like a float (obvsly named) or double-float would suffice. It’s storing mechanism would take a number like 1.000.000.000 and store it as the binary equivalent of 1*10^9.