Bitcoin Forum

Other => Beginners & Help => Topic started by: alojzikftp on July 24, 2013, 04:22:50 PM



Title: PHP RPC move float problem
Post by: alojzikftp on July 24, 2013, 04:22:50 PM
Hello,
nice to meet you all.
I cannot cope with such problem:
I want to move BTC with move RPC command in PHP using jsonrpcphp recommended in bitcoin wiki.
The syntax is move(string fromAccount, string toAccount, float amount).

And obviously, amounts like 19999999.99999999 cause error.
What would be the best option in order to avoid it?





Title: Re: PHP RPC move float problem
Post by: ds2013 on July 24, 2013, 05:08:40 PM
I guess you just don't have so much BTC in your wallet :-)

Without code and without error message nobody can help you.


Title: Re: PHP RPC move float problem
Post by: alojzikftp on July 24, 2013, 05:17:38 PM
I guess you just don't have so much BTC in your wallet :-)

Without code and without error message nobody can help you.

Well, I supposed it's obvious what kind of error it is :P
Moving 17999999.99999999 BTC (18 * 10^6 - 1 satoshi) moves 18000000 and that's my error. Of course I know it is float fault, but I want to find some nice option to avoid that.

Now I see few possibilities:
1) Modify bitcoind to use string instead float or satoshi, but it is uncomfortable
2) There is a problem with rpc library, so I should modify library, use curl, etc.

I would like universal solution in terms of protocol, so moving this amount should be correct :).
Cheers