Manually sort some includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / math / utilities.c
index 3babac712453991eceb5cf2f74492434d3a76516..c2df23ec2ee333d4cadb77154b0205d4c0e56439 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
-#include "gromacs/math/utilities.h"
+#include "gmxpre.h"
 
-#include "config.h"
+#include "utilities.h"
 
 #include <assert.h>
-#include <math.h>
 #include <limits.h>
+#include <math.h>
+
+#include "config.h"
+
 #ifdef HAVE__FINITE
 #include <float.h>
 #endif
@@ -171,6 +174,7 @@ static const double
 
 double gmx_erfd(double x)
 {
+#ifdef GMX_FLOAT_FORMAT_IEEE754
     gmx_int32_t hx, ix, i;
     double      R, S, P, Q, s, y, z, r;
 
@@ -276,11 +280,16 @@ double gmx_erfd(double x)
     {
         return r/x-one;
     }
+#else
+    /* No IEEE754 information. We need to trust that the OS provides erf(). */
+    return erf(x);
+#endif
 }
 
 
 double gmx_erfcd(double x)
 {
+#ifdef GMX_FLOAT_FORMAT_IEEE754
     gmx_int32_t hx, ix;
     double      R, S, P, Q, s, y, z, r;
 
@@ -401,6 +410,10 @@ double gmx_erfcd(double x)
             return two-tiny;
         }
     }
+#else
+    /* No IEEE754 information. We need to trust that the OS provides erfc(). */
+    return erfc(x);
+#endif
 }