1#ifndef MY_DECIMAL_LIMITS_INCLUDED
2#define MY_DECIMAL_LIMITS_INCLUDED
3/* Copyright (c) 2011 Monty Program Ab
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
17
18#define DECIMAL_LONGLONG_DIGITS 22
19#define DECIMAL_LONG_DIGITS 10
20#define DECIMAL_LONG3_DIGITS 8
21
22/** maximum length of buffer in our big digits (uint32). */
23#define DECIMAL_BUFF_LENGTH 9
24
25/* the number of digits that my_decimal can possibly contain */
26#define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9)
27
28
29/**
30 maximum guaranteed precision of number in decimal digits (number of our
31 digits * number of decimal digits in one our big digit - number of decimal
32 digits in one our big digit decreased by 1 (because we always put decimal
33 point on the border of our big digits))
34
35 With normal precession we can handle 65 digits. MariaDB can store in
36 the .frm up to 63 digits. By default we use DECIMAL_NOT_SPECIFIED digits
37 when converting strings to decimal, so we don't want to set this too high.
38 To not use up all digits for the scale we limit the number of decimals to
39 38.
40*/
41#define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2)
42#define DECIMAL_MAX_SCALE 38
43#define DECIMAL_NOT_SPECIFIED 39
44
45/**
46 maximum length of string representation (number of maximum decimal
47 digits + 1 position for sign + 1 position for decimal point, no terminator)
48*/
49#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2)
50
51#endif /* MY_DECIMAL_LIMITS_INCLUDED */
52