summaryrefslogtreecommitdiff
path: root/include/my_decimal_limits.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/my_decimal_limits.h')
-rw-r--r--include/my_decimal_limits.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/my_decimal_limits.h b/include/my_decimal_limits.h
new file mode 100644
index 00000000000..b395a2ed144
--- /dev/null
+++ b/include/my_decimal_limits.h
@@ -0,0 +1,45 @@
+#ifndef MY_DECIMAL_LIMITS_INCLUDED
+#define MY_DECIMAL_LIMITS_INCLUDED
+/* Copyright (c) 2011 Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#define DECIMAL_LONGLONG_DIGITS 22
+#define DECIMAL_LONG_DIGITS 10
+#define DECIMAL_LONG3_DIGITS 8
+
+/** maximum length of buffer in our big digits (uint32). */
+#define DECIMAL_BUFF_LENGTH 9
+
+/* the number of digits that my_decimal can possibly contain */
+#define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9)
+
+
+/**
+ maximum guaranteed precision of number in decimal digits (number of our
+ digits * number of decimal digits in one our big digit - number of decimal
+ digits in one our big digit decreased by 1 (because we always put decimal
+ point on the border of our big digits))
+*/
+#define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2)
+#define DECIMAL_MAX_SCALE 30
+#define DECIMAL_NOT_SPECIFIED 31
+
+/**
+ maximum length of string representation (number of maximum decimal
+ digits + 1 position for sign + 1 position for decimal point)
+*/
+#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2)
+
+#endif /* MY_DECIMAL_LIMITS_INCLUDED */