2 ms·
indeed. (int)round($info['balance'] * 100000000) such constructs are not a good sign. Quick glance over the rest of the code also confirms this. Way too muc
by stinos 13y ago
indeed.
(int)round($info['balance'] * 100000000)
such constructs are not a good sign. Quick glance over the rest of the code also confirms this. Way too much room for improvement (and that is a friendly way of saying it).
- makomk 13y agoThat's harmless and more or less unavoidable in this case. While the official Bitcoin client uses safe fixed-point arithmetic internally, the JSON API it exposes uses floating point all over the place. This isn't a problem so long as you correctly convert the data back to fixed point as soon as you get it before doing any other arithmetic on it, exactly as this code is doing. (All the numbers are guaranteed to be small enough that this isn't going to lead to rounding errors if done correctly.)