]> Cypherpunks repositories - gostls13.git/commit
math/big: more tests, documentation for Flot gob marshalling
authorRobert Griesemer <gri@golang.org>
Wed, 20 Apr 2016 20:40:55 +0000 (13:40 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 20 Apr 2016 21:16:21 +0000 (21:16 +0000)
commitaea224386ea7c10c07490bb6cdef12a51fa9a9cf
tree659b34a9a6dd85fee53d5962f8956ceca571309c
parent60fd32a47fdffb95d3646c9fc75acc9beff67183
math/big: more tests, documentation for Flot gob marshalling

Follow-up to https://golang.org/cl/21755.
This turned out to be a bit more than just a few nits
as originally expected in that CL.

1) The actual mantissa may be shorter than required for the
   given precision (because of trailing 0's): no need to
   allocate space for it (and transmit 0's). This can save
   a lot of space when the precision is high: E.g., for
   prec == 1000, 16 words or 128 bytes are required at the
   most, but if the actual number is short, it may be much
   less (for the test cases present, it's significantly less).

2) The actual mantissa may be longer than the number of
   words required for the given precision: make sure to
   not overflow when encoding in bytes.

3) Add more documentation.

4) Add more tests.

Change-Id: I9f40c408cfdd9183a8e81076d2f7d6c75e7a00e9
Reviewed-on: https://go-review.googlesource.com/22324
Reviewed-by: Alan Donovan <adonovan@google.com>
src/math/big/floatmarsh.go
src/math/big/floatmarsh_test.go