after reading bitcoin wiki "Proper money handling" I supposed that there shouldn't be any precision problems.
However, sending/moving for instance 16999999.99999999 sends/moves 17000000.
I figured out where the problem is:
- PHP stores float value with sufficient precision. I can printf it with 8 correct digits after dot.
- json-rpc php library copies that float into "params" array, and again, precision is fine.
- Unfortunately, string produced by json_encode() used in json-rpc library contains "rounded" value, so there is a problem.
So, can I force json_encode() to output 8 digits (or more)? Or do I have to write my own, which isn't very complicated, but will be rather slower than standard function.
Please note those topics about problems with floats in PHP and Python on bitcointalk, so it is not my fault. One of the results of this issue is genjix branch of bitcoin, that sends amounts as strings.