24#ifndef DECIMAL_INCLUDED
25#define DECIMAL_INCLUDED
27#ifndef MYSQL_ABI_CHECK
64#ifndef MYSQL_ABI_CHECK
68 int fixed_precision,
int fixed_decimals);
81 bool keep_prec =
false);
136 return (
dec->intg ?
dec->intg : 1) +
dec->frac + (
dec->frac > 0) + 2;
149#define E_DEC_TRUNCATED 1
150#define E_DEC_OVERFLOW 2
151#define E_DEC_DIV_ZERO 4
152#define E_DEC_BAD_NUM 8
155#define E_DEC_FATAL_ERROR \
156 (E_DEC_OVERFLOW | E_DEC_DIV_ZERO | E_DEC_BAD_NUM | E_DEC_OOM)
157#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:1653
int decimal_bin_size(int precision, int scale)
Definition: decimal.cc:1631
int decimal2longlong(const decimal_t *from, longlong *to)
Definition: decimal.cc:1175
int ulonglong2decimal(ulonglong from, decimal_t *to)
Definition: decimal.cc:1139
int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2083
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:135
int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale, bool keep_prec=false)
Definition: decimal.cc:1486
int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
Definition: decimal.cc:2510
int double2lldiv_t(double nr, lldiv_t *lld)
Convert double value to lldiv_t value.
Definition: decimal.cc:1244
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:2034
int decimal_is_zero(const decimal_t *from)
Definition: decimal.cc:2054
int longlong2decimal(longlong from, decimal_t *to)
Definition: decimal.cc:1144
int decimal_actual_fraction(const decimal_t *from)
Definition: decimal.cc:486
int decimal2lldiv_t(const decimal_t *from, lldiv_t *to)
Convert decimal to lldiv_t.
Definition: decimal.cc:1222
void max_decimal(int precision, int frac, decimal_t *to)
Definition: decimal.cc:432
int32 decimal_digit_t
Definition: decimal.h:41
int decimal2ulonglong(const decimal_t *from, ulonglong *to)
Definition: decimal.cc:1151
int decimal2bin(const decimal_t *from, uchar *to, int precision, int scale)
Definition: decimal.cc:1351
int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to, int scale_incr)
Definition: decimal.cc:2478
int decimal_shift(decimal_t *dec, int shift)
Definition: decimal.cc:760
int decimal_size(int precision, int scale)
Definition: decimal.cc:1606
int string2decimal(const char *from, decimal_t *to, const char **end)
Definition: decimal.cc:932
static void decimal_make_zero(decimal_t *dec)
Definition: decimal.h:124
int decimal2double(const decimal_t *from, double *to)
Definition: decimal.cc:1075
int decimal2string(const decimal_t *from, char *to, int *to_len, int fixed_precision, int fixed_decimals)
Definition: decimal.cc:526
int decimal_cmp(const decimal_t *from1, const decimal_t *from2)
Definition: decimal.cc:2044
void widen_fraction(int new_frac, decimal_t *d)
Add zeros behind comma to increase precision of decimal.
Definition: decimal.cc:1048
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:2028
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:2039
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:61
Base struct used to represent decimal data type.
Definition: decimal.h:49
int frac
The number of decimal digits after the point.
Definition: decimal.h:54
decimal_digit_t * buf
An array of decimal_digit_t's.
Definition: decimal.h:61
int intg
The number of decimal digits (NOT number of decimal_digit_t's !) before the point.
Definition: decimal.h:52
bool sign
False means positive, true means negative.
Definition: decimal.h:59
int len
The length of buf (length of allocated space) in decimal_digit_t's, not in bytes.
Definition: decimal.h:57