← Back to the archive
Bitcoin.onl > Archive > Bitcoin Forum > Re: BUG Report: Rounding glitch
AuthorTopic: Re: BUG Report: Rounding glitch
satoshiFounderSr. Member★★★★
Re: BUG Report: Rounding glitch
« on: July 17, 2010, 04:06:12 PM UTC »

It must be a rounding error when getinfo converts to floating point to return the JSON-RPC result.  The only place where it uses floating point to represent money is returning a value in JSON-RPC.

1.139999999999 is longer than bitcoin can internally represent.

internally, it could only be:
1.13999999 or
1.14000000

1.139999999999 is much much closer to 1.14000000 than 1.13999999, so it must be 1.14000000.

The code is this:
(double)GetBalance() / (double)COIN.

(I can't think of an easy way to fix it at the moment)
Original: view the exact post on bitcointalk.org ↗Text compiled by the Satoshi Nakamoto Institute, used under CC BY-SA 4.0. Formatting by Bitcoin.onl.
© Bitcoin.onl · Home