-
The exprtk C++ Mathematical Expression Toolkit Library makes a clever use of special functions to accelerate the evaluation of expressions. Is there an opportunity for stdlib to do the same, or does it have to be done with some pre-compiler? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
exprtk could be useful as part of a CAS; however, in terms of reducing the number of AST nodes for purposes of perf improvements, this is not always desirable, as these optimizations may lead to accuracy degradations. Given IEEE 754 floating-point format, operations which are theoretically commutative are not always commutative in practice. So anything which performs simplifications, reorderings, etc, may violate an algorithm's assumptions and result in decreased accuracy. It is not uncommon for transcendental function algorithms to assume (and exploit) certain properties of IEEE 754 to achieve results to a desired precision. This should also be a more general warning when translating/porting numerical algorithms: the order of operations matters and any change to that order can result in significant deviations in accuracy. |
Beta Was this translation helpful? Give feedback.
exprtk could be useful as part of a CAS; however, in terms of reducing the number of AST nodes for purposes of perf improvements, this is not always desirable, as these optimizations may lead to accuracy degradations. Given IEEE 754 floating-point format, operations which are theoretically commutative are not always commutative in practice. So anything which performs simplifications, reorderings, etc, may violate an algorithm's assumptions and result in decreased accuracy. It is not uncommon for transcendental function algorithms to assume (and exploit) certain properties of IEEE 754 to achieve results to a desired precision.
This should also be a more general warning when translating/por…