55#if !defined(HAVE_INT128) && defined(_MSC_VER) \
56 && !defined(RYU_ONLY_64_BIT_OPS) && defined(_M_X64)
57#define HAS_64_BIT_INTRINSICS
65#define DOUBLE_MANTISSA_BITS 52
66#define DOUBLE_EXPONENT_BITS 11
67#define DOUBLE_BIAS 1023
69#define DOUBLE_POW5_INV_BITCOUNT 122
70#define DOUBLE_POW5_BITCOUNT 121
158#if defined(HAVE_INT128)
179#elif defined(HAS_64_BIT_INTRINSICS)
270 Assert(v < 100000000000000000L);
271 if (v >= 10000000000000000L)
275 if (v >= 1000000000000000L)
279 if (v >= 100000000000000L)
283 if (v >= 10000000000000L)
287 if (v >= 1000000000000L)
291 if (v >= 100000000000L)
295 if (v >= 10000000000L)
299 if (v >= 1000000000L)
364 const bool even = (
m2 & 1) == 0;
662 memcpy(result,
"0.000000", 8);
701 const uint32 d1 = (d / 100) << 1;
798 result[
index++] =
'-';
806 if (
exp >= -4 &&
exp < 15)
875 const uint32 d1 = (d / 100) << 1;
926 result[
index + 1] =
'.';
935 result[
index++] =
'e';
938 result[
index++] =
'-';
942 result[
index++] =
'+';
1059 result[
index] =
'\0';
#define Assert(condition)
int double_to_shortest_decimal_bufn(double f, char *result)
#define DOUBLE_POW5_BITCOUNT
static int to_chars_df(const floating_decimal_64 v, const uint32 olength, char *const result)
#define DOUBLE_POW5_INV_BITCOUNT
#define DOUBLE_EXPONENT_BITS
static floating_decimal_64 d2d(const uint64 ieeeMantissa, const uint32 ieeeExponent)
static uint64 mulShiftAll(uint64 m, const uint64 *const mul, const int32 j, uint64 *const vp, uint64 *const vm, const uint32 mmShift)
static bool multipleOfPowerOf5(const uint64 value, const uint32 p)
#define DOUBLE_MANTISSA_BITS
static bool multipleOfPowerOf2(const uint64 value, const uint32 p)
static uint32 pow5Factor(uint64 value)
static uint32 decimalLength(const uint64 v)
static bool d2d_small_int(const uint64 ieeeMantissa, const uint32 ieeeExponent, floating_decimal_64 *v)
int double_to_shortest_decimal_buf(double f, char *result)
static int to_chars(floating_decimal_64 v, const bool sign, char *const result)
char * double_to_shortest_decimal(double f)
static const uint64 DOUBLE_POW5_SPLIT[326][2]
static const uint64 DOUBLE_POW5_INV_SPLIT[292][2]
static uint64 div1e8(const uint64 x)
static uint64 div10(const uint64 x)
static uint64 umul128(const uint64 a, const uint64 b, uint64 *const productHi)
static uint64 div5(const uint64 x)
static uint64 shiftright128(const uint64 lo, const uint64 hi, const uint32 dist)
static uint64 div100(const uint64 x)
static uint32 mulShift(const uint32 m, const uint64 factor, const int32 shift)
static const char DIGIT_TABLE[200]
static int fd(const char *x, int i)
static uint64 double_to_bits(const double d)
static uint32 pow5bits(const int32 e)
static int32 log10Pow5(const int32 e)
static int copy_special_str(char *const result, const bool sign, const bool exponent, const bool mantissa)
static int32 log10Pow2(const int32 e)
#define DOUBLE_SHORTEST_DECIMAL_LEN