See this report: https://bitcoin.stackexchange.com/questions/22716/bitcoind-sendfrom-round-amount-error
I’ve been unable to reproduce it in either master or 0.8.6. However, in theory this could happen on architectures that have imprecise floating point types. Even though bitcoind itself doesn’t rely on floating point types anywhere, Spirit JSON does use doubles internally for parsing values like 123.456 (and so do we in ValueFromAmount / AmountFromValue).
My first attempt was to try to fix this and make the parser use a fixed-point or string representation for JSON numbers (ie https://github.com/bitcoin/bitcoin/blob/master/src/json/json_spirit_reader_template.h#L499 ), but turned out to be a deep rabbit hole and doesn’t solve the issue at the client side.
So this is my solution: add an option -rpcstringamounts
to represent monetary amounts as strings in RPC. With this option any monetary amount will be emitted as a string with fixed 8 decimals, very easy to parse. Also this changes the parsing to accept the same format (by using the existing ParseMoney function).
Example getinfo:
0{
1 ...
2 "balance" : "0.29099995",
3 ...
4}
Commits should be self-documenting.