- /* snconst.h by K.Tsuru */
- /***********************
- SN library
- Definition for constants
- ************************/
- #ifndef SN_CONST_H
- #define SN_CONST_H
-
- #include <limits.h>
- #include <cmath>
- #include <float.h>
-
- // typedef
- #ifndef TYPEDEF_H
- #include "typedef.h"
- #endif
- // Max size of memory block
- /*
- maxSizeOfMemoryBlock =1,073,741,824(1GB) maxDigits =2147483648
- Maximum number of digits 4,294,967,296 digits
- INT_MAX= 2,147,483,647
- */
- // Uses this value in SXXX class files, block.h and ncblock.h
- const unsigned long maxSizeOfMemoryBlock = 1024ul*1024uL*1024uL; // 1,073,741,824(1GB)
- //Maximum number of digits = (maxSizeOfMemoryBlock/sizeof(fType))*DFIGURES
- const unsigned long maxDigits = maxSizeOfMemoryBlock*2UL; // 2,147,483,648 digits
-
- // type of figure[] 2 bytes
- typedef unsigned short fType; // "FType" is changed into "fType" since vesion 2.30
-
- enum { NO = 0, YES = 1 };
- // enum { FALSE = 0, TRUE = 1 }; // ver.2.17
- enum { OFF = 0, ON = 1 };
- enum { DISABLE = 0, ENABLE = 1};
-
- // common constants
- const fType fTypeMax = USHRT_MAX; // maximum value of fType
- const fType DRADIX = 10000u; // decimal radix (= 10^DFIGURES)
- const int DFIGURES = 4; // figure of DRADIX -1
- const int DOUBLE_FIG = DBL_DIG; // effective figures of double
- const int DOUBLE_BITS = DBL_MANT_DIG; // bits of mantissa of double = 53
- const double ROUND_DBL_INT = 0.25 +1.0/(1 << 20); //= 0.2500009536... additional value to round double to integer
- // used in FFT multiplication etc. Added "1.0/(1 << 20)" since version 2.30 for BRADIX. See "\test\fftlimit.cpp"
-
- //maximum value of exponent in SDouble class (|rdxExp| <= DRADIX_EXP_MAX)
- //condition DRADIX_EXP_MAX < maxDigits must be satisfied Max(SDouble 10^DRADIX_EXP_MAX) < Max(SLong 10^maxDigits)
- const int DRADIX_EXP_MAX = INT_MAX - 1;
-
- const ulong DRADIX_SQ = (ulong)DRADIX*(ulong)DRADIX; // square of DRADIX
- extern const double INT_MAX_DBL;// maximum integer in double = 1.0e15
-
- // For SInteger & SDecimal class
- // condition 2*BRADIX -1 == fTypeMax must be satisfied
- const int BRADIX_BITS = 15; // bits of binary radix
- const fType BRADIX = (1u << BRADIX_BITS); // binary radix
- const fType BRADIX1 = BRADIX-1u;
- const ulong BRADIX_SQ = (1uL << 2*BRADIX_BITS); // square of BRADIX
- const int BFIGURES = 5; // figures of BRADIX in decimal
-
- #define atoF (fType)atoi // string --> fType
- #define fTypeFormat "hu" // format of fType
-
- // figures which can be displayed on CRT
- const unsigned int displayWidth = 80u;
-
- #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).