Use NAN/INFINITY if available to init XPath NaN/Inf
I see that this has undergone multiple iterations already. So this change might not cover some known edge cases. It's just the minimal solution that works for me.
The current implementation raises SIGFPE
if called after something like feenableexcept(FE_ALL_EXCEPT)
, which is typical for scientific codebases since they have to be paranoid about all sorts of arithmetic exceptions. It is, of course, possible to surround the initialization of libxml2
in the user code with something like:
#if LIBXML_VERSION >= 20911
int ignored_exceptions = FE_DIVBYZERO | FE_INVALID;
int current_exceptions = fedisableexcept(ignored_exceptions);
#endif
// calls to libxml
#if LIBXML_VERSION >= 20911
feclearexcept(ignored_exceptions);
feenableexcept(current_exceptions);
#endif
but that doesn't feel right.
Is there any chance to run the current implementation only if there are no other options to get NaN
and Infinity
?
I guess @nwellnhof is the right person to mention in this MR.