45 uint64_t distance_too_high_w,
46 uint64_t unsafe_interval,
50 uint64_t small_distance = distance_too_high_w - unit;
51 uint64_t big_distance = distance_too_high_w + unit;
123 DCHECK(rest <= unsafe_interval);
124 while (rest < small_distance &&
125 unsafe_interval - rest >= ten_kappa &&
126 (rest + ten_kappa < small_distance ||
127 small_distance - rest >= rest + ten_kappa - small_distance)) {
128 buffer[length - 1]--;
135 if (rest < big_distance &&
136 unsafe_interval - rest >= ten_kappa &&
137 (rest + ten_kappa < big_distance ||
138 big_distance - rest > rest + ten_kappa - big_distance)) {
147 return (2 * unit <= rest) && (rest <= unsafe_interval - 4 * unit);
176 if (unit >= ten_kappa)
return false;
180 if (ten_kappa - unit <= unit)
return false;
182 if ((ten_kappa - rest > rest) && (ten_kappa - 2 * rest >= 2 * unit)) {
186 if ((rest > unit) && (ten_kappa - (rest - unit) <= (rest - unit))) {
188 buffer[length - 1]++;
189 for (
int i = length - 1;
i > 0; --
i) {
190 if (buffer[
i] !=
'0' + 10)
break;
198 if (buffer[0] ==
'0' + 10) {
224 switch (number_bits) {
228 if (
kTen9 <= number) {
236 if (
kTen8 <= number) {
244 if (
kTen7 <= number) {
253 if (
kTen6 <= number) {
261 if (
kTen5 <= number) {
269 if (
kTen4 <= number) {
278 if (1000 <= number) {
368 DCHECK(low.
e() == w.
e() && w.
e() == high.
e());
369 DCHECK(low.
f() + 1 <= high.
f() - 1);
395 DiyFp one =
DiyFp(
static_cast<uint64_t
>(1) << -w.
e(), w.
e());
399 uint64_t fractionals = too_high.
f() & (one.
f() - 1);
401 int divisor_exponent;
403 &divisor, &divisor_exponent);
404 *kappa = divisor_exponent + 1;
411 int digit = integrals / divisor;
412 buffer[*length] =
'0' + digit;
414 integrals %= divisor;
419 (
static_cast<uint64_t
>(integrals) << -one.
e()) + fractionals;
422 if (rest < unsafe_interval.
f()) {
426 unsafe_interval.
f(), rest,
427 static_cast<uint64_t
>(divisor) << -one.
e(), unit);
444 unsafe_interval.
set_f(unsafe_interval.
f() * 10);
446 int digit =
static_cast<int>(fractionals >> -one.
e());
447 buffer[*length] =
'0' + digit;
449 fractionals &= one.
f() - 1;
451 if (fractionals < unsafe_interval.
f()) {
453 unsafe_interval.
f(), fractionals, one.
f(), unit);
489 int requested_digits,
498 uint64_t w_error = 1;
503 DiyFp one =
DiyFp(
static_cast<uint64_t
>(1) << -w.
e(), w.
e());
507 uint64_t fractionals = w.
f() & (one.
f() - 1);
509 int divisor_exponent;
511 &divisor, &divisor_exponent);
512 *kappa = divisor_exponent + 1;
520 int digit = integrals / divisor;
521 buffer[*length] =
'0' + digit;
524 integrals %= divisor;
528 if (requested_digits == 0)
break;
532 if (requested_digits == 0) {
534 (
static_cast<uint64_t
>(integrals) << -one.
e()) + fractionals;
536 static_cast<uint64_t
>(divisor) << -one.
e(), w_error,
549 while (requested_digits > 0 && fractionals > w_error) {
553 int digit =
static_cast<int>(fractionals >> -one.
e());
554 buffer[*length] =
'0' + digit;
557 fractionals &= one.
f() - 1;
560 if (requested_digits != 0)
return false;
580 int* decimal_exponent) {
586 DiyFp boundary_minus, boundary_plus;
591 int ten_mk_minimal_binary_exponent =
593 int ten_mk_maximal_binary_exponent =
596 ten_mk_minimal_binary_exponent,
597 ten_mk_maximal_binary_exponent,
630 bool result =
DigitGen(scaled_boundary_minus, scaled_w, scaled_boundary_plus,
631 buffer, length, &kappa);
632 *decimal_exponent = -mk + kappa;
643 int requested_digits,
646 int* decimal_exponent) {
650 int ten_mk_minimal_binary_exponent =
652 int ten_mk_maximal_binary_exponent =
655 ten_mk_minimal_binary_exponent,
656 ten_mk_maximal_binary_exponent,
680 buffer, length, &kappa);
681 *decimal_exponent = -mk + kappa;
688 int requested_digits,
691 int* decimal_point) {
696 int decimal_exponent = 0;
699 result =
Grisu3(v, buffer, length, &decimal_exponent);
703 buffer, length, &decimal_exponent);
709 *decimal_point = *length + decimal_exponent;
710 buffer[*length] =
'\0';
static DiyFp Minus(const DiyFp &a, const DiyFp &b)
static const int kSignificandSize
static DiyFp Times(const DiyFp &a, const DiyFp &b)
void set_f(uint64_t new_value)
void NormalizedBoundaries(DiyFp *out_m_minus, DiyFp *out_m_plus) const
DiyFp AsNormalizedDiyFp() const
static void GetCachedPowerForBinaryExponentRange(int min_exponent, int max_exponent, DiyFp *power, int *decimal_exponent)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
#define DCHECK(condition)
#define V8_2PART_UINT64_C(a, b)
static bool DigitGenCounted(DiyFp w, int requested_digits, Vector< char > buffer, int *length, int *kappa)
static const uint32_t kTen5
static bool RoundWeedCounted(Vector< char > buffer, int length, uint64_t rest, uint64_t ten_kappa, uint64_t unit, int *kappa)
static const int kMinimalTargetExponent
static const uint32_t kTen6
static bool Grisu3Counted(double v, int requested_digits, Vector< char > buffer, int *length, int *decimal_exponent)
static bool RoundWeed(Vector< char > buffer, int length, uint64_t distance_too_high_w, uint64_t unsafe_interval, uint64_t rest, uint64_t ten_kappa, uint64_t unit)
static const uint32_t kTen4
static void BiggestPowerTen(uint32_t number, int number_bits, uint32_t *power, int *exponent)
static const uint32_t kTen8
static bool Grisu3(double v, Vector< char > buffer, int *length, int *decimal_exponent)
bool FastDtoa(double v, FastDtoaMode mode, int requested_digits, Vector< char > buffer, int *length, int *decimal_point)
static const uint32_t kTen7
static bool DigitGen(DiyFp low, DiyFp w, DiyFp high, Vector< char > buffer, int *length, int *kappa)
static const uint32_t kTen9
static const int kMaximalTargetExponent
Debugger support for the V8 JavaScript engine.