I created erc20 token. I want total supply of 50,00,000. And I want to give 7% tax on every transaction. So if anyone sends single coin then, how can I get 7% and transfer remaining to receiver? For this problem I decided to give 2 decimal places. I.e. value of decimals method I set 2. So now I should increase total supply by 2 zeros Or what I'm confused Please help.
For clarity, I'll assume you meant for 50,000,000.
With two decimal places, add two more zeroes, so: 50,000,000.00 => 5000000000.
You still have the problem of indivisibility/precision at the low end, e.g. sending
1. This just doesn't go away. You can and should decide what happens to rounding errors because they are unavoidable.
Hope it helps.