Lines Matching refs:exponent

91 static void TrimToMaxSignificantDigits(Vector<const char> buffer, int exponent,
104 exponent + (buffer.length() - kMaxSignificantDecimalDigits);
141 // Compute the binary exponent.
142 int exponent = 0;
143 *result = DiyFp(significand, exponent);
148 static bool DoubleStrtod(Vector<const char> trimmed, int exponent,
166 // If the 10^exponent (resp. 10^-exponent) fits into a double too then we
171 if (exponent < 0 && -exponent < kExactPowersOfTenSize) {
172 // 10^-exponent fits into a double.
175 *result /= exact_powers_of_ten[-exponent];
178 if (0 <= exponent && exponent < kExactPowersOfTenSize) {
179 // 10^exponent fits into a double.
182 *result *= exact_powers_of_ten[exponent];
187 if ((0 <= exponent) &&
188 (exponent - remaining_digits < kExactPowersOfTenSize)) {
190 // 10^remaining_digits. As a result the remaining exponent now fits
195 *result *= exact_powers_of_ten[exponent - remaining_digits];
203 // Returns 10^exponent as an exact DiyFp.
204 // The given exponent must be in the range [1; kDecimalExponentDistance[.
205 static DiyFp AdjustmentPowerOfTen(int exponent) {
206 DCHECK_LT(0, exponent);
207 DCHECK_LT(exponent, PowersOfTenCache::kDecimalExponentDistance);
208 // Simply hardcode the remaining powers for the given decimal exponent
211 switch (exponent) {
234 static bool DiyFpStrtod(Vector<const char> buffer, int exponent,
246 // Move the remaining decimals into the exponent.
247 exponent += remaining_decimals;
254 DCHECK_LE(exponent, PowersOfTenCache::kMaxDecimalExponent);
255 if (exponent < PowersOfTenCache::kMinDecimalExponent) {
261 PowersOfTenCache::GetCachedPowerForDecimalExponent(exponent, &cached_power,
264 if (cached_decimal_exponent != exponent) {
265 int adjustment_exponent = exponent - cached_decimal_exponent;
341 // Returns the correct double for the buffer*10^exponent.
345 // buffer.length() + exponent <= kMaxDecimalPower + 1
346 // buffer.length() + exponent > kMinDecimalPower
348 static double BignumStrtod(Vector<const char> buffer, int exponent,
356 DCHECK(buffer.length() + exponent <= kMaxDecimalPower + 1);
357 DCHECK_GT(buffer.length() + exponent, kMinDecimalPower);
368 if (exponent >= 0) {
369 input.MultiplyByPowerOfTen(exponent);
371 boundary.MultiplyByPowerOfTen(-exponent);
391 double Strtod(Vector<const char> buffer, int exponent) {
394 exponent += left_trimmed.length() - trimmed.length();
399 TrimToMaxSignificantDigits(trimmed, exponent, significant_buffer,
405 if (exponent + trimmed.length() - 1 >= kMaxDecimalPower)
407 if (exponent + trimmed.length() <= kMinDecimalPower) return 0.0;
410 if (DoubleStrtod(trimmed, exponent, &guess) ||
411 DiyFpStrtod(trimmed, exponent, &guess)) {
414 return BignumStrtod(trimmed, exponent, guess);