1. /* snconst.h by K.Tsuru */
  2. /***********************
  3. SN library
  4. Definition for constants
  5. ************************/
  6. #ifndef SN_CONST_H
  7. #define SN_CONST_H
  8. #include <limits.h>
  9. #include <cmath>
  10. #include <float.h>
  11. // typedef
  12. #ifndef TYPEDEF_H
  13. #include "typedef.h"
  14. #endif
  15. // Max size of memory block
  16. /*
  17. maxSizeOfMemoryBlock =1,073,741,824(1GB) maxDigits =2147483648
  18. Maximum number of digits 4,294,967,296 digits
  19. INT_MAX= 2,147,483,647
  20. */
  21. // Uses this value in SXXX class files, block.h and ncblock.h
  22. const unsigned long maxSizeOfMemoryBlock = 1024ul*1024uL*1024uL; // 1,073,741,824(1GB)
  23. //Maximum number of digits = (maxSizeOfMemoryBlock/sizeof(fType))*DFIGURES
  24. const unsigned long maxDigits = maxSizeOfMemoryBlock*2UL; // 2,147,483,648 digits
  25. // type of figure[] 2 bytes
  26. typedef unsigned short fType; // "FType" is changed into "fType" since vesion 2.30
  27. enum { NO = 0, YES = 1 };
  28. // enum { FALSE = 0, TRUE = 1 }; // ver.2.17
  29. enum { OFF = 0, ON = 1 };
  30. enum { DISABLE = 0, ENABLE = 1};
  31. // common constants
  32. const fType fTypeMax = USHRT_MAX; // maximum value of fType
  33. const fType DRADIX = 10000u; // decimal radix (= 10^DFIGURES)
  34. const int DFIGURES = 4; // figure of DRADIX -1
  35. const int DOUBLE_FIG = DBL_DIG; // effective figures of double
  36. const int DOUBLE_BITS = DBL_MANT_DIG; // bits of mantissa of double = 53
  37. const double ROUND_DBL_INT = 0.25 +1.0/(1 << 20); //= 0.2500009536... additional value to round double to integer
  38. // used in FFT multiplication etc. Added "1.0/(1 << 20)" since version 2.30 for BRADIX. See "\test\fftlimit.cpp"
  39. //maximum value of exponent in SDouble class (|rdxExp| <= DRADIX_EXP_MAX)
  40. //condition DRADIX_EXP_MAX < maxDigits must be satisfied Max(SDouble 10^DRADIX_EXP_MAX) < Max(SLong 10^maxDigits)
  41. const int DRADIX_EXP_MAX = INT_MAX - 1;
  42. const ulong DRADIX_SQ = (ulong)DRADIX*(ulong)DRADIX; // square of DRADIX
  43. extern const double INT_MAX_DBL;// maximum integer in double = 1.0e15
  44. // For SInteger & SDecimal class
  45. // condition 2*BRADIX -1 == fTypeMax must be satisfied
  46. const int BRADIX_BITS = 15; // bits of binary radix
  47. const fType BRADIX = (1u << BRADIX_BITS); // binary radix
  48. const fType BRADIX1 = BRADIX-1u;
  49. const ulong BRADIX_SQ = (1uL << 2*BRADIX_BITS); // square of BRADIX
  50. const int BFIGURES = 5; // figures of BRADIX in decimal
  51. #define atoF (fType)atoi // string --> fType
  52. #define fTypeFormat "hu" // format of fType
  53. // figures which can be displayed on CRT
  54. const unsigned int displayWidth = 80u;
  55. #endif // SN_CONST_H

snconst.h : last modifiled at 2017/07/17 15:25:09(2,564 bytes)
created at 2016/04/11 11:18:59
The creation time of this html file is 2017/10/11 16:07:52 (Wed Oct 11 16:07:52 2017).