my_decimal_limits.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef MY_DECIMAL_LIMITS_INCLUDED
  2. #define MY_DECIMAL_LIMITS_INCLUDED
  3. /* Copyright (c) 2011 Monty Program Ab
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; version 2 of the License.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  14. #define DECIMAL_LONGLONG_DIGITS 22
  15. #define DECIMAL_LONG_DIGITS 10
  16. #define DECIMAL_LONG3_DIGITS 8
  17. /** maximum length of buffer in our big digits (uint32). */
  18. #define DECIMAL_BUFF_LENGTH 9
  19. /* the number of digits that my_decimal can possibly contain */
  20. #define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9)
  21. /**
  22. maximum guaranteed precision of number in decimal digits (number of our
  23. digits * number of decimal digits in one our big digit - number of decimal
  24. digits in one our big digit decreased by 1 (because we always put decimal
  25. point on the border of our big digits))
  26. */
  27. #define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2)
  28. #define DECIMAL_MAX_SCALE 30
  29. #define DECIMAL_NOT_SPECIFIED 31
  30. /**
  31. maximum length of string representation (number of maximum decimal
  32. digits + 1 position for sign + 1 position for decimal point, no terminator)
  33. */
  34. #define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2)
  35. #endif /* MY_DECIMAL_LIMITS_INCLUDED */