38#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
42static const int kMaxExactDoubleIntegerDecimalDigits = 15;
60#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
61static const double exact_powers_of_ten[] = {
80 1000000000000000000.0,
81 10000000000000000000.0,
82 100000000000000000000.0,
83 1000000000000000000000.0,
85 10000000000000000000000.0
96 for (
int i = 0;
i <
buffer.length();
i++) {
106 char* significant_buffer,
107 int* significant_exponent) {
117 *significant_exponent =
127 char* buffer_copy_space,
int space_size,
131 exponent += left_trimmed.
length() - right_trimmed.
length();
136 buffer_copy_space, updated_exponent);
140 *trimmed = right_trimmed;
141 *updated_exponent = exponent;
152 int* number_of_read_digits) {
160 *number_of_read_digits =
i;
171 int* remaining_decimals) {
174 if (
buffer.length() == read_digits) {
176 *remaining_decimals = 0;
179 if (
buffer[read_digits] >=
'5') {
185 *remaining_decimals =
buffer.length() - read_digits;
193#if !defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
204 if (trimmed.
length() <= kMaxExactDoubleIntegerDecimalDigits) {
212 if (exponent < 0 && -exponent < kExactPowersOfTenSize) {
216 *
result /= exact_powers_of_ten[-exponent];
219 if (0 <= exponent && exponent < kExactPowersOfTenSize) {
223 *
result *= exact_powers_of_ten[exponent];
226 int remaining_digits =
227 kMaxExactDoubleIntegerDecimalDigits - trimmed.
length();
228 if ((0 <= exponent) &&
229 (exponent - remaining_digits < kExactPowersOfTenSize)) {
235 *
result *= exact_powers_of_ten[remaining_digits];
236 *
result *= exact_powers_of_ten[exponent - remaining_digits];
274 int remaining_decimals;
281 const int kDenominatorLog = 3;
282 const int kDenominator = 1 << kDenominatorLog;
284 exponent += remaining_decimals;
285 uint64_t
error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
287 int old_e = input.
e();
289 error <<= old_e - input.
e();
297 int cached_decimal_exponent;
300 &cached_decimal_exponent);
302 if (cached_decimal_exponent != exponent) {
303 int adjustment_exponent = exponent - cached_decimal_exponent;
312 error += kDenominator / 2;
322 int error_b = kDenominator / 2;
323 int error_ab = (
error == 0 ? 0 : 1);
324 int fixed_error = kDenominator / 2;
325 error += error_b + error_ab + fixed_error;
329 error <<= old_e - input.
e();
333 int effective_significand_size =
335 int precision_digits_count =
341 int shift_amount = (precision_digits_count + kDenominatorLog) -
343 input.
set_f(input.
f() >> shift_amount);
344 input.
set_e(input.
e() + shift_amount);
347 error = (
error >> shift_amount) + 1 + kDenominator;
348 precision_digits_count -= shift_amount;
354 uint64_t precision_bits_mask = (one64 << precision_digits_count) - 1;
355 uint64_t precision_bits = input.
f() & precision_bits_mask;
356 uint64_t half_way = one64 << (precision_digits_count - 1);
357 precision_bits *= kDenominator;
358 half_way *= kDenominator;
359 DiyFp rounded_input(input.
f() >> precision_digits_count,
360 input.
e() + precision_digits_count);
361 if (precision_bits >= half_way +
error) {
362 rounded_input.
set_f(rounded_input.
f() + 1);
369 if (half_way -
error < precision_bits && precision_bits < half_way +
error) {
408 if (diy_fp.
e() > 0) {
421 if (trimmed.
length() == 0) {
445 return (
'0' <=
d) && (
d <=
'9');
449 return (
'1' <=
d) && (
d <=
'9');
452#ifdef __has_cpp_attribute
453#if __has_cpp_attribute(maybe_unused)
458 for(
int i = 0;
i <
buffer.length(); ++
i) {
470 const bool is_correct =
ComputeGuess(trimmed, exponent, &guess);
476 if (comparison < 0) {
478 }
else if (comparison > 0) {
480 }
else if ((
Double(guess).Significand() & 1) == 0) {
491 int updated_exponent;
493 &trimmed, &updated_exponent);
504 float max_finite = 3.4028234663852885981170418348451692544e+38;
508 double half_max_finite_infinity =
509 3.40282356779733661637539395458142568448e+38;
510 if (
d >= max_finite) {
511 if (
d >= half_max_finite_infinity) {
517 return static_cast<float>(
d);
524 int updated_exponent;
526 &trimmed, &updated_exponent);
527 exponent = updated_exponent;
536 bool is_correct =
ComputeGuess(trimmed, exponent, &double_guess);
539 if (float_guess == double_guess) {
562 float f2 = float_guess;
581 (f1 == f2 && f2 != f3 && f3 == f4) ||
582 (f1 == f2 && f2 == f3 && f3 != f4));
588 DiyFp upper_boundary;
590 float min_float = 1e-45f;
591 upper_boundary =
Double(
static_cast<double>(min_float) / 2).
AsDiyFp();
596 if (comparison < 0) {
598 }
else if (comparison > 0) {
600 }
else if ((
Single(guess).Significand() & 1) == 0) {
static float next(float f)
static const int kMaxSignificantBits
static int Compare(const Bignum &a, const Bignum &b)
void ShiftLeft(const int shift_amount)
void AssignDecimalString(const Vector< const char > value)
void MultiplyByPowerOfTen(const int exponent)
void AssignUInt64(uint64_t value)
void set_f(uint64_t new_value)
void Multiply(const DiyFp &other)
void set_e(int32_t new_value)
static const int kSignificandSize
DiyFp UpperBoundary() const
static int SignificandSizeForOrderOfMagnitude(int order)
double PreviousDouble() const
double NextDouble() const
DiyFp UpperBoundary() const
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
const uint8_t uint32_t uint32_t GError ** error
static const int kDecimalExponentDistance
static const int kMinDecimalExponent
void GetCachedPowerForDecimalExponent(int requested_exponent, DiyFp *power, int *found_exponent)
static const int kMaxDecimalExponent
static const int kMinDecimalPower
static bool IsDigit(const char d)
static uint64_t ReadUint64(Vector< const char > buffer, int *number_of_read_digits)
double Strtod(Vector< const char > buffer, int exponent)
static const uint64_t kMaxUint64
static DiyFp AdjustmentPowerOfTen(int exponent)
static const int kMaxSignificantDecimalDigits
static bool DiyFpStrtod(Vector< const char > buffer, int exponent, double *result)
static bool ComputeGuess(Vector< const char > trimmed, int exponent, double *guess)
float StrtofTrimmed(Vector< const char > trimmed, int exponent)
float Strtof(Vector< const char > buffer, int exponent)
static void CutToMaxSignificantDigits(Vector< const char > buffer, int exponent, char *significant_buffer, int *significant_exponent)
static float SanitizedDoubletof(double d)
double StrtodTrimmed(Vector< const char > trimmed, int exponent)
static int CompareBufferWithDiyFp(Vector< const char > buffer, int exponent, DiyFp diy_fp)
static bool DoubleStrtod(Vector< const char > trimmed, int exponent, double *result)
static bool IsNonZeroDigit(const char d)
static const int kMaxDecimalPower
static Vector< const char > TrimLeadingZeros(Vector< const char > buffer)
static const int kMaxUint64DecimalDigits
static void TrimAndCut(Vector< const char > buffer, int exponent, char *buffer_copy_space, int space_size, Vector< const char > *trimmed, int *updated_exponent)
static bool AssertTrimmedDigits(const Vector< const char > &buffer)
Vector< const char > TrimTrailingZeros(Vector< const char > buffer)
static void ReadDiyFp(Vector< const char > buffer, DiyFp *result, int *remaining_decimals)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
#define DOUBLE_CONVERSION_ASSERT(condition)
#define DOUBLE_CONVERSION_UINT64_2PART_C(a, b)
#define DOUBLE_CONVERSION_UNREACHABLE()
#define DOUBLE_CONVERSION_ARRAY_SIZE(a)