So.... yup, there is something missing. Firstly, and don't feel bad for missing this because I did the same thing at first, but these calculations are divisions. Dividing by 10 just happens to be the same as 10%. So, when you change the 10 to an 80, or to a 50 as I did, then you're just dividing it by 80 pieces instead of 10, doing the opposite of what you want. It gets weird with the billions vs millions too.
However, through checking this all again, there is another number that needs to be adjusted as well, and that's the multiplication by 100,000,000 (which is 10% of 1 billion). That is there to shift some of the billions over to the millions to complete the math.
In full, here is how it is calculated:
Code: Select all
EXP = 1234567890
M = EXP % 1000000000 (the "millions" part of EXP)
B = EXP / 1000000000 (the "billions" part of EXP)
M = M / 10
M = M + ((B % 10) * 100000000)
B = B / 10
FINAL_EXP = (B * 1,000,000,000) + M
M = M + ((B % 10) * 100000000)
Here, B % 10 gives you the remainder of B after dividing by 10
meaning, divide 10 into B as many times as it can and then give me what's leftover
5 % 10 == 5 because 10 goes into 5 zero times,
22 % 10 == 2 because 10 goes into 20 twice and then there is 2 leftover
then multiply that by 100,000,000 (which is 10% of 1 billion)
Using values, this works out like this for a value of 22,123,456,789...
EXP == 22,123,456,789
M = EXP % 1000000000 == 123,456,789
B = EXP / 1000000000 == 22
//M = M / 10:
12,345,678 = 123,456,789 / 10
//M = M + ((B % 10) * 100000000):
//M = 12345678 + ((22 % 10) * 100000000)
//M = 12345678 + ((2) * 100000000)
//M = 12345678 + 200000000
212,345,678 = 12345678 + 200,000,000
//B = B / 10
2 = 22 / 10
//M == 212,345,678
//B == 2
//FINAL_EXP = (B * 1,000,000,000) + M
2,212,345,678 = (2 * 1,000,000,000) + 212,345,678
(and 10% of the original 22,123,456,789 is 2,212,345,678)
I'm gonna put a TL:DR as a separate post after this one for how to actually do this now...