I'm a bit lost on what to do with the following calculation. The problem is that decimals are being round up/down, which obviously doesn't give me the result I desire.
int totalValue = 275000;
int percentage = 2;
for (uint i = 0; i < 30; i++) {
totalValue += totalValue * percentage / 100;
}
With the above code, the result is:
498108
The expected result is:
498124.436
I know that normally you could simply use the following calculation to work with a predetermined amount of decimals like so:
value * 10**4 (4 decimals)
But I haven't gotten that to work in this case, often resulting in insanely high numbers due to the multiplication and division that "do not make sense" once I revert the above calculation using:
value / 10**4
Thank you very much for your time. Any help would be very much appreciated!