Lines Matching +full:- +full:nv

6 //    (See accompanying file LICENSE-Apache or copy at
7 // http://www.apache.org/licenses/LICENSE-2.0)
11 // (See accompanying file LICENSE-Boost or copy at
19 // -DRYU_DEBUG Generate verbose debugging output to stdout.
21 // -DRYU_ONLY_64_BIT_OPS Avoid using uint128_t or 64-bit intrinsics. Slower,
65 // Decimal exponent's range is -324 to 308
78 e2 = 1 - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS - 2; in d2d()
81 e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS - 2; in d2d()
90 printf("-> %" PRIu64 " * 2^%d\n", m2, e2 + 2); in d2d()
95 // Implicit bool -> int conversion. True is 1, false is 0. in d2d()
99 // uint64_t mm = mv - 1 - mmShift; in d2d()
101 // Step 3: Convert to a decimal power base using 128-bit arithmetic. in d2d()
107 // I tried special-casing q == 0, but there was no effect on performance. in d2d()
108 // This expression is slightly faster than max_int(0, log10Pow2(e2) - 1). in d2d()
109 const uint32_t q = log10Pow2(e2) - (e2 > 3); in d2d()
111 const int32_t k = DOUBLE_POW5_INV_BITCOUNT + pow5bits((int32_t) q) - 1; in d2d()
112 const int32_t i = -e2 + (int32_t) q + k; in d2d()
118 printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); in d2d()
124 const uint32_t mvMod5 = ((uint32_t) mv) - 5 * ((uint32_t) div5(mv)); in d2d()
131 vmIsTrailingZeros = multipleOfPowerOf5(mv - 1 - mmShift, q); in d2d()
134 vp -= multipleOfPowerOf5(mv + 2, q); in d2d()
138 // This expression is slightly faster than max_int(0, log10Pow5(-e2) - 1). in d2d()
139 const uint32_t q = log10Pow5(-e2) - (-e2 > 1); in d2d()
141 const int32_t i = -e2 - (int32_t) q; in d2d()
142 const int32_t k = pow5bits(i) - DOUBLE_POW5_BITCOUNT; in d2d()
143 const int32_t j = (int32_t) q - k; in d2d()
149 printf("%" PRIu64 " * 5^%d / 10^%u\n", mv, -e2, q); in d2d()
151 printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); in d2d()
158 // mm = mv - 1 - mmShift, so it has 1 trailing 0 bit iff mmShift == 1. in d2d()
162 --vp; in d2d()
166 // We need to compute min_int(p2(mv), p5(mv) - e2) >= q in d2d()
167 // <=> p2(mv) >= q && p5(mv) - e2 >= q in d2d()
168 // <=> p2(mv) >= q (because -e2 >= q) in d2d()
177 printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); in d2d()
194 * -exp - 1 zeros left of the first non-zero in d2d()
195 * digit in 'f' format. If non-negative, in d2d()
209 int exp = e10 + decimalLength17(vr) - 1; in d2d()
213 * When exp is < 0, there are -exp-1 zeros taking up in d2d()
216 * we round that (max_decimals - (-exp - 1)). This in d2d()
244 const uint32_t vmMod10 = ((uint32_t) vm) - 10 * ((uint32_t) vmDiv10); in d2d()
246 const uint32_t vrMod10 = ((uint32_t) vr) - 10 * ((uint32_t) vrDiv10); in d2d()
256 printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); in d2d()
257 printf("d-10=%s\n", vmIsTrailingZeros ? "true" : "false"); in d2d()
262 const uint32_t vmMod10 = ((uint32_t) vm) - 10 * ((uint32_t) vmDiv10); in d2d()
268 const uint32_t vrMod10 = ((uint32_t) vr) - 10 * ((uint32_t) vrDiv10); in d2d()
302 int exp = e10 + len - 1; in d2d()
311 len--; in d2d()
319 printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); in d2d()
334 const int32_t e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS; in d2d_small_int()
342 if (e2 < -52) { in d2d_small_int()
347 // Since 2^52 <= m2 < 2^53 and 0 <= -e2 <= 52: 1 <= f = m2 / 2^-e2 < 2^53. in d2d_small_int()
348 // Test if the lower -e2 bits of the significand are 0, i.e. whether the fraction is 0. in d2d_small_int()
349 const uint64_t mask = (1ull << -e2) - 1; in d2d_small_int()
358 v->mantissa = m2 >> -e2; in d2d_small_int()
359 v->exponent = 0; in d2d_small_int()
366 // Step 1: Decode the floating-point number, and unify normalized and subnormal cases. in __dtoa_engine()
371 for (int32_t bit = 63; bit >= 0; --bit) { in __dtoa_engine()
379 const uint64_t ieeeMantissa = bits & ((1ull << DOUBLE_MANTISSA_BITS) - 1); in __dtoa_engine()
380 …_t ieeeExponent = (uint32_t) ((bits >> DOUBLE_MANTISSA_BITS) & ((1u << DOUBLE_EXPONENT_BITS) - 1)); in __dtoa_engine()
388 dtoa->digits[0] = '0'; in __dtoa_engine()
389 dtoa->flags = flags; in __dtoa_engine()
390 dtoa->exp = 0; in __dtoa_engine()
393 if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u)) { in __dtoa_engine()
399 dtoa->flags = flags; in __dtoa_engine()
408 // (This is not needed for fixed-point notation, so it might be beneficial to trim in __dtoa_engine()
409 // trailing zeros in to_chars only if needed - once fixed-point notation output is implemented.) in __dtoa_engine()
412 const uint32_t r = ((uint32_t) v.mantissa) - 10 * ((uint32_t) q); in __dtoa_engine()
425 int32_t exp = v.exponent + olength - 1; in __dtoa_engine()
430 dtoa->digits[olength - i - 1] = (mant % 10) + '0'; in __dtoa_engine()
434 dtoa->exp = exp; in __dtoa_engine()
435 dtoa->flags = flags; in __dtoa_engine()