Draft: Support non-finite checks in math modes with finite assumptions
Compilers often provide a "fast math" option that writes code that makes
certain assumptions about values. A common assumption is that the data
are always finite. In this case, it is possible that the system
operations like std::isnan
do not actually check anything but just
return false (as the assumption is that the values are finite). This is a
problem for code that usually has finite values but may use nonfinite
values for flags. We would like to make sure that the values are as
expected. This change uses custom comparisons to check for non-finites
even in fast math modes (assuming the compiler optimizer does not
outsmart us).
Backport: release