Skip to content

Code optimization may invalidate math, this should be tested with a run-time check #1

@Xunie

Description

@Xunie

Aggressive optimizing compilers may algebraically optimize Kahan's algorithm (and others) which may results invalid results. While compilers generally do not optimize math this way, users may still activate flags that enable this dangerous behavior.

We might be able to test for this as follows:

  • have some global variable get initialized by our own test_math() before main() runs
  • test_math() checks for correct functioning of the algorithms and throws an exception if not

I'm still not sure if this is a solution because compilers may optimize initialization code differently or not at all.

Does anyone have any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions