Skip to content

Commit

Permalink
Restore workaround for floating-point division by zero in SimulationX
Browse files Browse the repository at this point in the history
  • Loading branch information
beutlich committed Jan 4, 2025
1 parent 4d1eabf commit 2cb7189
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ExternData/Resources/C-Sources/libxml2/xpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@
* *
************************************************************************/

#ifdef ITI_NO_FP_EXC
#ifndef _HUGE_ENUF
#define _HUGE_ENUF 1e+300 // _HUGE_ENUF*_HUGE_ENUF must overflow
#endif

#define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF))
#define NAN ((float)(INFINITY * 0.0F))
#endif

double xmlXPathNAN = 0.0;
double xmlXPathPINF = 0.0;
double xmlXPathNINF = 0.0;
Expand Down Expand Up @@ -171,8 +180,13 @@ xmlInitXPathInternal(void) {
#else
/* MSVC doesn't allow division by zero in constant expressions. */
double zero = 0.0;
#ifdef ITI_NO_FP_EXC
xmlXPathNAN = NAN;
xmlXPathPINF = INFINITY;
#else
xmlXPathNAN = 0.0 / zero;
xmlXPathPINF = 1.0 / zero;
#endif
xmlXPathNINF = -xmlXPathPINF;
#endif
}
Expand Down

0 comments on commit 2cb7189

Please sign in to comment.