24#ifndef DECIMAL_INCLUDED
25#define DECIMAL_INCLUDED
27#ifndef MYSQL_ABI_CHECK
58#ifndef MYSQL_ABI_CHECK
62 int fixed_precision,
int fixed_decimals);
75 bool keep_prec =
false);
130 return (
dec->intg ?
dec->intg : 1) +
dec->frac + (
dec->frac > 0) + 2;
143#define E_DEC_TRUNCATED 1
144#define E_DEC_OVERFLOW 2
145#define E_DEC_DIV_ZERO 4
146#define E_DEC_BAD_NUM 8
149#define E_DEC_FATAL_ERROR \
150 (E_DEC_OVERFLOW | E_DEC_DIV_ZERO | E_DEC_BAD_NUM | E_DEC_OOM)
151#define E_DEC_ERROR (E_DEC_FATAL_ERROR | E_DEC_TRUNCATED)
int decimal_round(const decimal_t *from, decimal_t *to, int new_scale, decimal_round_mode mode)
Definition: decimal.cc:1657
int decimal_bin_size(int precision, int scale)
Definition: decimal.cc:1635
int decimal2longlong(const decimal_t *from, longlong *to)
Definition: decimal.cc:1178
int ulonglong2decimal(ulonglong from, decimal_t *to)
Definition: decimal.cc:1142
int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2087
static int decimal_string_size(const decimal_t *dec)
Returns the length of the buffer to hold string representation of the decimal (including decimal dot,...
Definition: decimal.h:129
int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale, bool keep_prec=false)
Definition: decimal.cc:1489
int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2513
int double2lldiv_t(double nr, lldiv_t *lld)
Convert double value to lldiv_t value.
Definition: decimal.cc:1247
decimal_round_mode
Definition: decimal.h:34
@ CEILING
Definition: decimal.h:38
@ FLOOR
Definition: decimal.h:39
@ HALF_UP
Definition: decimal.h:37
@ TRUNCATE
Definition: decimal.h:35
@ HALF_EVEN
Definition: decimal.h:36
int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2038
int decimal_is_zero(const decimal_t *from)
Definition: decimal.cc:2058
int longlong2decimal(longlong from, decimal_t *to)
Definition: decimal.cc:1147
int decimal_actual_fraction(const decimal_t *from)
Definition: decimal.cc:483
int decimal2lldiv_t(const decimal_t *from, lldiv_t *to)
Convert decimal to lldiv_t.
Definition: decimal.cc:1225
static constexpr int DECIMAL_NOT_SPECIFIED
Definition: decimal.h:154
void max_decimal(int precision, int frac, decimal_t *to)
Definition: decimal.cc:429
int32 decimal_digit_t
Definition: decimal.h:41
int decimal2ulonglong(const decimal_t *from, ulonglong *to)
Definition: decimal.cc:1154
int decimal2bin(const decimal_t *from, uchar *to, int precision, int scale)
Definition: decimal.cc:1354
int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to, int scale_incr)
Definition: decimal.cc:2481
int decimal_shift(decimal_t *dec, int shift)
Definition: decimal.cc:757
int decimal_size(int precision, int scale)
Definition: decimal.cc:1610
int string2decimal(const char *from, decimal_t *to, const char **end)
Definition: decimal.cc:929
static void decimal_make_zero(decimal_t *dec)
Definition: decimal.h:118
int decimal2double(const decimal_t *from, double *to)
Definition: decimal.cc:1072
int decimal2string(const decimal_t *from, char *to, int *to_len, int fixed_precision, int fixed_decimals)
Definition: decimal.cc:523
int decimal_cmp(const decimal_t *from1, const decimal_t *from2)
Definition: decimal.cc:2048
void widen_fraction(int new_frac, decimal_t *d)
Add zeros behind comma to increase precision of decimal.
Definition: decimal.cc:1045
int decimal_intg(const decimal_t *from)
Returns the number of decimal digits before the decimal point in a decimal_t, with any insignificant ...
Definition: decimal.cc:2032
int double2decimal(double from, decimal_t *to)
Definition: decimal.cc:1101
int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2043
static constexpr int DECIMAL_MAX_SCALE
Definition: decimal.h:153
static const std::string dec("DECRYPTION")
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
int32_t int32
Definition: my_inttypes.h:66
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
mode
Definition: file_handle.h:60
intg is the number of decimal digits (NOT number of decimal_digit_t's !) before the point frac is the...
Definition: decimal.h:52
int frac
Definition: decimal.h:53
decimal_digit_t * buf
Definition: decimal.h:55
int intg
Definition: decimal.h:53
bool sign
Definition: decimal.h:54
int len
Definition: decimal.h:53