From 5d763cafcff5d733060f7f9e572daf6e5b99aec0 Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Sun, 10 Jun 2012 10:16:32 +0200
Subject: [PATCH] prefer std::abs over abs

use of abs is dangerous as on some systems this refers to
the C library function abs, which operates on ints and thus
truncates the floating point part of a number.
---
 modules/mol/base/src/coord_frame.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/mol/base/src/coord_frame.cc b/modules/mol/base/src/coord_frame.cc
index bbaa5ccab..97803e242 100644
--- a/modules/mol/base/src/coord_frame.cc
+++ b/modules/mol/base/src/coord_frame.cc
@@ -39,10 +39,10 @@ namespace ost { namespace mol {
     */
     Real Eval2AngleDist(Real phi, Real phi0, Real psi, Real psi0, Real delta)
     {
-      Real d1=abs(phi-phi0);
-      Real d2=abs(psi-psi0);
-      if (d1>M_PI) d1=abs(d1-2.*M_PI);
-      if (d2>M_PI) d1=abs(d2-2.*M_PI);
+      Real d1=std::abs(phi-phi0);
+      Real d2=std::abs(psi-psi0);
+      if (d1>M_PI) d1=std::abs(d1-2.*M_PI);
+      if (d2>M_PI) d1=std::abs(d2-2.*M_PI);
       Real d=(d1*d1+d2*d2)/(delta*delta);
       return 1.0/(1.0+d);
     }
-- 
GitLab