1 /***************************************************************************\
2 |* Function Parser for C++ v4.3 *|
3 |*-------------------------------------------------------------------------*|
4 |* Copyright: Juha Nieminen *|
6 |* This library is distributed under the terms of the *|
7 |* GNU Lesser General Public License version 3. *|
8 |* (See lgpl.txt and gpl.txt for the license text.) *|
9 \***************************************************************************/
15 This file is for the internal use of the function parser only.
16 You don't need to include this file in your source files, just
21 /* Uncomment any of these lines or define them in your compiler settings
22 to enable the correspondent version of the parser. (These are disabled
23 by default because they rely on C99 functions, and non-standard libraries
24 in the case pf MPFR and GMP, and they make compiling needlessly slower
25 and the resulting binary needlessly larger if they are not used in the
28 //#define FP_SUPPORT_FLOAT_TYPE
29 //#define FP_SUPPORT_LONG_DOUBLE_TYPE
30 //#define FP_SUPPORT_LONG_INT_TYPE
31 //#define FP_SUPPORT_MPFR_FLOAT_TYPE
32 //#define FP_SUPPORT_GMP_INT_TYPE
34 /* Uncomment this line of define it in your compiler settings if you want
35 to disable compiling the basic double version of the library, in case
36 one of the above types is used but not the double type. (If the double
37 type is not used, then disabling it makes compiling faster and the
38 resulting binary smaller.)
40 //#define FP_DISABLE_DOUBLE_TYPE
43 Note that these do not change what FunctionParser supports, they only
44 change how the function is evaluated, potentially making it faster when
45 these functions are involved.
46 These will make the source code use asinh(), acosh(), atanh(), exp2()
49 //#define FP_SUPPORT_TR1_MATH_FUNCS
51 #ifdef FP_SUPPORT_TR1_MATH_FUNCS
52 #define FP_SUPPORT_ASINH
53 #define FP_SUPPORT_EXP2
54 #define FP_SUPPORT_LOG2
55 #define FP_SUPPORT_CBRT
56 #define FP_SUPPORT_HYPOT
60 Comment out the following line to enable the eval() function, which can
61 be used in the function string to recursively call the same function.
62 Note that enabling this function may be dangerous even if the maximum
63 recursion level is limited because it is still possible to write functions
64 using it which take enormous amounts of time to evaluate even though the
65 maximum recursion is never reached. This may be undesirable in some
67 Alternatively you can define the FP_ENABLE_EVAL precompiler constant in
68 your compiler settings.
70 #ifndef FP_ENABLE_EVAL
71 #define FP_DISABLE_EVAL
76 Maximum recursion level for eval() calls:
78 #define FP_EVAL_MAX_REC_LEVEL 1000
82 Whether to use shortcut evaluation for the & and | operators:
84 #ifndef FP_DISABLE_SHORTCUT_LOGICAL_EVALUATION
85 #define FP_ENABLE_SHORTCUT_LOGICAL_EVALUATION
89 Whether to enable optimizations that may ignore side effects
90 of if() calls, such as changing if(x,!y,0) into x&!y.
91 This is basically the polar opposite of "shortcut logical evaluation".
92 Disabled by default, because it makes eval() rather unsafe.
94 #ifdef FP_ENABLE_IGNORE_IF_SIDEEFFECTS
98 Comment out the following lines out if you are not going to use the
99 optimizer and want a slightly smaller library. The Optimize() method
100 can still be called, but it will not do anything.
101 If you are unsure, just leave it. It won't slow down the other parts of
104 #ifndef FP_NO_SUPPORT_OPTIMIZER
105 #define FP_SUPPORT_OPTIMIZER
110 Epsilon value used with the comparison operators (must be non-negative):
111 (Comment it out if you don't want to use epsilon in comparisons. Might
112 lead to marginally faster evaluation of the comparison operators, but
113 can introduce inaccuracies in comparisons.)
115 #define FP_EPSILON 1e-14
119 No member function of FunctionParser is thread-safe. Most prominently,
120 Eval() is not thread-safe. By uncommenting one of these lines the Eval()
121 function can be made thread-safe at the cost of a possible small overhead.
122 The second version requires that the compiler supports the alloca() function,
123 which is not standard, but is faster.
125 //#define FP_USE_THREAD_SAFE_EVAL
126 //#define FP_USE_THREAD_SAFE_EVAL_WITH_ALLOCA
129 Uncomment (or define in your compiler options) to disable evaluation checks.
130 (Consult the documentation for details.)
132 //#define FP_NO_EVALUATION_CHECKS