Danmakufu numbers are floats. The
wiki entry and such can explain it a lot better than I can, but I fear nobody will read it because of jargon and length.
Basically, it's like scientific notation. But in binary. You have a fraction portion and an exponent portion. There's also a sign bit to determine negative values but I'm going to ignore that. In decimal scientific notation, you have numbers like 4.296*10^3 to express the number 4296. 4.296 is the significant/precision/fraction portion, 10 is simply the base, and 3 is the exponent. With floating point, to express something like 5, it would be 1.25*2^2 (in decimal representation).
The fraction as also be expressed as a "mantisse", which is sort of just an easier way to visualize the numbers. The mantisse starts at 1.0. Rather, if your fraction portion is all zeroes, your mantisse is 1.0. If your fraction portion is a 1 and then all zeroes (1000...), that signifies the 1/2 bit is flipped, and your mantisse is 1.5. If the fraction is 01000..., the 1/4 bit is flipped and your mantisse is 1.25. If you want to think of it this way, each fraction bit starting from the
left signifies "one, over its power of two", like 1/2, 1/4, 1/8, 1/16, etc. Following this, if it were 11000... the mantisse is 1 + 1/2 + 1/4 = 1.75. Likewise, 001101000... is 1 + 1/8 + 1/16 + 1/64 = 1.203125.
The exponent part itself is a twos-complement number. If all the bits are 0, you have -127. Each exponent bit starting from the
right signifies its power of two. This also means the leftmost bit adds 128, so if your exponent is 10000000, your exponent is 1. Likewise, 00000001 is -126; 10000001 is 2; 10000011 is 4; 10010100 is 21.
Putting these together, say you want to express 8 as a floating point. This would be simply 1.0*2^3. Knowing the 1.0 is your mantisse and the 3 is your exponent, 8 in binary is:
S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
0 10000010 00000000000000000000000Now as for the problem, look at 16777215 and 16777216:
0 10010110 11111111111111111111111
0 10010111 00000000000000000000000But the next possible value is:
0 10010111 00000000000000000000001which is (1+1/(2^23)) * 2^24 = 16777218. Oh no. This is the loss in precision that turns up when you have numbers too complex for the data structure to hold, and is why Danmakufu won't let you use 123456789 as a number.
You can play around with
this converter for more examples.
Numbers that pass a certain value will screw up things randomly if you don't keep it under control, probably because memory starts leaking around. Naut and I were working on things a while back and after a significant amount of time, graphics would randomly begin to shit themselves because time counters and other arbitrary value counters started to pass the possible values. It was pretty weird. Your instance of DrawText is actually pretty smart, since it's actually still counting the number in memory somewhere. Normally, if you hit a maximum you'd have to explicitly start working with the next exponent upwards: say you had 16777216, you wouldn't be able to add 1 to it anymore, but you could keep adding 2, or 4, or 8, etc. Once you hit 33554432, you wouldn't be able to add 2. At 67108864 you can't add 4, and so on. 123456789 is greater than 67108864, so the lowest precision it can keep at that point is 8. Tada! You've learned why your number is increasing in increments of 8. Notice how this doesn't answer your question on how to get around it.