mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 03:07:36 +02:00
error_ulp -> error
This commit is contained in:
@ -469,7 +469,7 @@ inline round_direction get_round_direction(uint64_t divisor, uint64_t remainder,
|
|||||||
|
|
||||||
// Generates output using Grisu2 digit-gen algorithm.
|
// Generates output using Grisu2 digit-gen algorithm.
|
||||||
template <typename Stop>
|
template <typename Stop>
|
||||||
int grisu2_gen_digits(char* buf, fp value, uint64_t error_ulp, int& exp,
|
int grisu2_gen_digits(char* buf, fp value, uint64_t error, int& exp,
|
||||||
Stop stop) {
|
Stop stop) {
|
||||||
fp one(1ull << -value.e, value.e);
|
fp one(1ull << -value.e, value.e);
|
||||||
// The integral part of scaled value (p1 in Grisu) = value / one. It cannot be
|
// The integral part of scaled value (p1 in Grisu) = value / one. It cannot be
|
||||||
@ -483,7 +483,7 @@ int grisu2_gen_digits(char* buf, fp value, uint64_t error_ulp, int& exp,
|
|||||||
exp = count_digits(integral); // kappa in Grisu.
|
exp = count_digits(integral); // kappa in Grisu.
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (stop.init(buf, size, value.f, data::POWERS_OF_10_64[exp] << -one.e,
|
if (stop.init(buf, size, value.f, data::POWERS_OF_10_64[exp] << -one.e,
|
||||||
error_ulp, exp)) {
|
error, exp)) {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
// Generate digits for the integral part. This can produce up to 10 digits.
|
// Generate digits for the integral part. This can produce up to 10 digits.
|
||||||
@ -540,19 +540,19 @@ int grisu2_gen_digits(char* buf, fp value, uint64_t error_ulp, int& exp,
|
|||||||
uint64_t remainder =
|
uint64_t remainder =
|
||||||
(static_cast<uint64_t>(integral) << -one.e) + fractional;
|
(static_cast<uint64_t>(integral) << -one.e) + fractional;
|
||||||
if (stop(buf, size, remainder, data::POWERS_OF_10_64[exp] << -one.e,
|
if (stop(buf, size, remainder, data::POWERS_OF_10_64[exp] << -one.e,
|
||||||
error_ulp, exp, true)) {
|
error, exp, true)) {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
} while (exp > 0);
|
} while (exp > 0);
|
||||||
// Generate digits for the fractional part.
|
// Generate digits for the fractional part.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
fractional *= 10;
|
fractional *= 10;
|
||||||
error_ulp *= 10;
|
error *= 10;
|
||||||
char digit = static_cast<char>(fractional >> -one.e);
|
char digit = static_cast<char>(fractional >> -one.e);
|
||||||
buf[size++] = static_cast<char>('0' + digit);
|
buf[size++] = static_cast<char>('0' + digit);
|
||||||
fractional &= one.f - 1;
|
fractional &= one.f - 1;
|
||||||
--exp;
|
--exp;
|
||||||
if (stop(buf, size, fractional, one.f, error_ulp, exp, false)) return size;
|
if (stop(buf, size, fractional, one.f, error, exp, false)) return size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user