Closed GoogleCodeExporter closed 9 years ago
Thanks for the patch! Just a few comments:
Could you add a JavaDoc explaining what formats are accepted please?
This needs a few unit tests. I have a feeling you need to parse these amounts
as doubles not floats to represent the full range of possible BitCoin values
without losing precision. In the unit tests, please check the edge cases like
the smallest and largest possible values.
Original comment by hearn@google.com
on 10 Mar 2011 at 10:51
Original comment by hearn@google.com
on 10 Mar 2011 at 10:51
Here is an improved version of the patch, which uses BigDecimal instead of
floating point arithmetics to avoid the precision/rounding problem.
There are also additions to JavaDoc and JUnit (which uncovered issue #11, also
fixed in this patch).
> return new BigDecimal(coins).movePointRight(9).toBigIntegerExact();
https://github.com/thiloplanz/bitcoinj/commit/87c45efd57514f203443bace24a253ea0b
bf0483
Maybe we should also look at the spec regarding accepting negative values, see
the JUnit test case for things that currently pass, but should probably not. Or
maybe they should, not sure.
Original comment by thilopl...@googlemail.com
on 9 Apr 2011 at 2:37
Okay, since issue #11 was not an issue after all, here is the updated patch
that does not change the nanocoin terminology or exchange rate, and only does
what issue #1 originally requested, but with additional Javadoc and JUnit, and
using BigDecimal instead of floating point arithmetics:
https://github.com/thiloplanz/bitcoinj/compare/8f7a1565...5ee554e
Original comment by thilopl...@googlemail.com
on 15 Apr 2011 at 3:04
This issue was closed by revision r52.
Original comment by hearn@google.com
on 20 Apr 2011 at 3:47
Original issue reported on code.google.com by
andreas....@gmail.com
on 10 Mar 2011 at 10:43