MySQL 8.4.0
Source Code Documentation
anonymous_namespace{print_utils.cc} Namespace Reference

Functions

int IntegerDigits (double d)
 Find the number of integer digits (i.e. More...
 
std::string DecimalFormat (double d, int log_precision)
 Format 'd' as a decimal number with enough decimals to get a rounding error less than d*10^log_precision, without any trailing fractional zeros. More...
 
std::string EngineeringFormat (double d)
 Format 'd' in engineering format, i.e. More...
 
constexpr uint64_t Power (uint64_t base, int power)
 Integer exponentiation. More...
 

Variables

constexpr int kPlainNumberLength = 6
 The maximal number of digits we use in decimal numbers (e.g. More...
 
constexpr int kMantissaLength = 3
 The maximal number of digits in engineering format mantissas, e.g. More...
 
constexpr double kMinNonZeroNumber = 1.0e-12
 The smallest number (absolute value) that we do not format as "0". More...
 
constexpr int kLogPrecision = -2
 For decimal numbers, include enough decimals to ensure that any rounding error is less than <number>*10^kLogPrecision (i.e. More...
 
const double kMinPlainFormatNumber
 The smallest number (absolute value) that we format as decimal (rather than engineering format). More...
 

Function Documentation

◆ DecimalFormat()

std::string anonymous_namespace{print_utils.cc}::DecimalFormat ( double  d,
int  log_precision 
)

Format 'd' as a decimal number with enough decimals to get a rounding error less than d*10^log_precision, without any trailing fractional zeros.

◆ EngineeringFormat()

std::string anonymous_namespace{print_utils.cc}::EngineeringFormat ( double  d)

Format 'd' in engineering format, i.e.

<mantissa>e<sign><exponent> where 1.0<=mantissa<1000.0 and exponent is a multiple of 3.

◆ IntegerDigits()

int anonymous_namespace{print_utils.cc}::IntegerDigits ( double  d)

Find the number of integer digits (i.e.

those before the decimal point) in 'd' when represented as a decimal number.

◆ Power()

constexpr uint64_t anonymous_namespace{print_utils.cc}::Power ( uint64_t  base,
int  power 
)
constexpr

Integer exponentiation.

Variable Documentation

◆ kLogPrecision

constexpr int anonymous_namespace{print_utils.cc}::kLogPrecision = -2
constexpr

For decimal numbers, include enough decimals to ensure that any rounding error is less than <number>*10^kLogPrecision (i.e.

less than 1%).

◆ kMantissaLength

constexpr int anonymous_namespace{print_utils.cc}::kMantissaLength = 3
constexpr

The maximal number of digits in engineering format mantissas, e.g.

"12.3e+6".

◆ kMinNonZeroNumber

constexpr double anonymous_namespace{print_utils.cc}::kMinNonZeroNumber = 1.0e-12
constexpr

The smallest number (absolute value) that we do not format as "0".

◆ kMinPlainFormatNumber

const double anonymous_namespace{print_utils.cc}::kMinPlainFormatNumber
Initial value:
=
std::pow(10, 1 - kPlainNumberLength - kLogPrecision)
constexpr int kLogPrecision
For decimal numbers, include enough decimals to ensure that any rounding error is less than <number>*...
Definition: print_utils.cc:112
constexpr int kPlainNumberLength
The maximal number of digits we use in decimal numbers (e.g.
Definition: print_utils.cc:101

The smallest number (absolute value) that we format as decimal (rather than engineering format).

◆ kPlainNumberLength

constexpr int anonymous_namespace{print_utils.cc}::kPlainNumberLength = 6
constexpr

The maximal number of digits we use in decimal numbers (e.g.

"123456" or "0.00123").