I have been playing around with the send many command on testnet building a new project. I currently using the latest client with a transfer cost of 0.0005. I am making several transfers of the amounts of 5, 3, 2.5, 2 and 0.005btc. The issue i have is i am noticing that sometimes my wallet is ending up with a balance that goes from a whole number down to 8 decimal places and i don't get why as i am not making transactions that small and send many does not seem to support it anyway as transactions to just send left over funds error so i need to round the amount to only 4 decimal places.
I am confused how send btc where the smallest amount i send is 0.005 can result in a wallet having a balance like 10.03257234. I have double checked my code and placed limits on all my decimals to round them to 4 decimal places to rule anything like that out as a cause. Since my system is automated and makes about 15 transactions i can't be exactly where the issue is but all of the transactions use send many just in slightly different ways. Some send the whole balance to set account plus a fee and others send partial balance + fee and send rest of the balance back to the same address.
I know send many charges per kb. Does it charge based on the percentage of a KB you use? That may explain my issue. I just need to work out what is going on so i can correctly deal with it.