Uploaded two patchsets. The first one addresses most of the comments. The
second
one reorders the functions and adds forward declarations.
http://codereview.chromium.org/3468003/diff/61001/src/bignum-dtoa.cc
File src/bignum-dtoa.cc (right):
http://codereview.chromium.org/3468003/diff/61001/src/bignum-dtoa.cc#newcode243
src/bignum-dtoa.cc:243: // The initial start values consist of:
On 2010/11/17 09:44:09, William Hesse wrote:
How about:
Computes v / 10^estimated_power exactly, as a ratio of two bignums,
numerator
and denominator. The functions GenerateShortestDigits and
GenerateCountedDigits
will then convert this ratio to its decimal representation, d, with
the required
accuracy, and then d * 10^estimated_power is the representation of v.
Done.
http://codereview.chromium.org/3468003/diff/61001/src/bignum-dtoa.cc#newcode246
src/bignum-dtoa.cc:246: // optionally (depending on the flag
need_boundary_deltas):
On 2010/11/17 09:44:09, William Hesse wrote:
Might as well say here: used by GenerateShortestDigits to decide if it
has the
shortest decimal converting back to v.
Done.
http://codereview.chromium.org/3468003/diff/61001/src/bignum-dtoa.cc#newcode249
src/bignum-dtoa.cc:249: // The scaling consist of multiplying the
numerator by 10^estimated_power, or
On 2010/11/17 09:44:09, William Hesse wrote:
Not needed. This will be obvious from the code, or commented there.
Done.
http://codereview.chromium.org/3468003/diff/61001/src/bignum-dtoa.cc#newcode252
src/bignum-dtoa.cc:252: // Note that the boundary-deltas are scaled too.
If the common denominator has
On 2010/11/17 09:44:09, William Hesse wrote:
Not needed, except to say that v, m+, m-, and therefore v - m- and m+
- v all
share the same denominator.
Done.
http://codereview.chromium.org/3468003/diff/61001/src/bignum-dtoa.cc#newcode338
src/bignum-dtoa.cc:338: // when the generated digits yield a number that
is close enough. The number
On 2010/11/17 09:44:09, William Hesse wrote:
yield the shortest decimal representation of v. A decimal
representation of v
is a number lying closer to v than to any other double, so it converts
to v when
read.
This is true if d, the decimal representation, is between m- and m+,
the upper
and lower boundaries. d must be strictly between them if !is_even.
m+ = ...
m- = ...
Done.
http://codereview.chromium.org/3468003/diff/61001/src/bignum-dtoa.cc#newcode455
src/bignum-dtoa.cc:455: // Let v = numerator / denominator.
On 2010/11/17 09:44:09, William Hesse wrote:
// Let v = numerator / denominator < 10.
// Then we generate 'count' digits of d = x.xxxxxxx... from left to
right. Once
'count' digits have
been produced we decide whether to round up or down. Remainders of
exactly .5
round upwards. Numbers such 9.99999 propagate a carry all the way,
and change
the exponent, when rounding upwards.
Done.
http://codereview.chromium.org/3468003/
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev