Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Special functions for expression evaluations #379

Answered by kgryte
ghalimi asked this question in Q&A
Discussion options

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?

You must be logged in to vote

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...

Replies: 1 comment

Comment options

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.

You must be logged in to vote
0 replies
Answer selected by kgryte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Question General question. Math Issue or pull request specific to math functionality.
2 participants

AltStyle によって変換されたページ (->オリジナル) /