23#ifndef DECIMAL_INCLUDED
24#define DECIMAL_INCLUDED
26#ifndef MYSQL_ABI_CHECK
57#ifndef MYSQL_ABI_CHECK
61 int fixed_precision,
int fixed_decimals);
74 bool keep_prec =
false);
129 return (
dec->intg ?
dec->intg : 1) +
dec->frac + (
dec->frac > 0) + 2;
142#define E_DEC_TRUNCATED 1
143#define E_DEC_OVERFLOW 2
144#define E_DEC_DIV_ZERO 4
145#define E_DEC_BAD_NUM 8
148#define E_DEC_FATAL_ERROR \
149 (E_DEC_OVERFLOW | E_DEC_DIV_ZERO | E_DEC_BAD_NUM | E_DEC_OOM)
150#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:1656
int decimal_bin_size(int precision, int scale)
Definition: decimal.cc:1634
int decimal2longlong(const decimal_t *from, longlong *to)
Definition: decimal.cc:1177
int ulonglong2decimal(ulonglong from, decimal_t *to)
Definition: decimal.cc:1141
int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2086
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:128
int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale, bool keep_prec=false)
Definition: decimal.cc:1488
int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2512
int double2lldiv_t(double nr, lldiv_t *lld)
Convert double value to lldiv_t value.
Definition: decimal.cc:1246
decimal_round_mode
Definition: decimal.h:33
@ CEILING
Definition: decimal.h:37
@ FLOOR
Definition: decimal.h:38
@ HALF_UP
Definition: decimal.h:36
@ TRUNCATE
Definition: decimal.h:34
@ HALF_EVEN
Definition: decimal.h:35
int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2037
int decimal_is_zero(const decimal_t *from)
Definition: decimal.cc:2057
int longlong2decimal(longlong from, decimal_t *to)
Definition: decimal.cc:1146
int decimal_actual_fraction(const decimal_t *from)
Definition: decimal.cc:482
int decimal2lldiv_t(const decimal_t *from, lldiv_t *to)
Convert decimal to lldiv_t.
Definition: decimal.cc:1224
static constexpr int DECIMAL_NOT_SPECIFIED
Definition: decimal.h:153
void max_decimal(int precision, int frac, decimal_t *to)
Definition: decimal.cc:428
int32 decimal_digit_t
Definition: decimal.h:40
int decimal2ulonglong(const decimal_t *from, ulonglong *to)
Definition: decimal.cc:1153
int decimal2bin(const decimal_t *from, uchar *to, int precision, int scale)
Definition: decimal.cc:1353
int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to, int scale_incr)
Definition: decimal.cc:2480
int decimal_shift(decimal_t *dec, int shift)
Definition: decimal.cc:756
int decimal_size(int precision, int scale)
Definition: decimal.cc:1609
int string2decimal(const char *from, decimal_t *to, const char **end)
Definition: decimal.cc:928
static void decimal_make_zero(decimal_t *dec)
Definition: decimal.h:117
int decimal2double(const decimal_t *from, double *to)
Definition: decimal.cc:1071
int decimal2string(const decimal_t *from, char *to, int *to_len, int fixed_precision, int fixed_decimals)
Definition: decimal.cc:522
int decimal_cmp(const decimal_t *from1, const decimal_t *from2)
Definition: decimal.cc:2047
void widen_fraction(int new_frac, decimal_t *d)
Add zeros behind comma to increase precision of decimal.
Definition: decimal.cc:1044
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:2031
int double2decimal(double from, decimal_t *to)
Definition: decimal.cc:1100
int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2042
static constexpr int DECIMAL_MAX_SCALE
Definition: decimal.h:152
static const std::string dec("DECRYPTION")
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
unsigned char uchar
Definition: my_inttypes.h:51
long long int longlong
Definition: my_inttypes.h:54
int32_t int32
Definition: my_inttypes.h:65
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:191
mode
Definition: file_handle.h:59
intg is the number of decimal digits (NOT number of decimal_digit_t's !) before the point frac is the...
Definition: decimal.h:51
int frac
Definition: decimal.h:52
decimal_digit_t * buf
Definition: decimal.h:54
int intg
Definition: decimal.h:52
bool sign
Definition: decimal.h:53
int len
Definition: decimal.h:52