From 05ed514bcf7b8f182a9c1e9dd9df1ac37805aa8e Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 24 Mar 2016 11:07:30 +0100 Subject: [PATCH] + replace insecure x/fabs(x) with sgn function --- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 298cf2af5..3fc096e78 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -4721,15 +4722,17 @@ public: float dy = onSketchPos.fY - StartPos.fY; lx=0;ly=0;a=0; - if(fabs(dx) > fabs(dy)){ + double rev = 0; + if (fabs(dx) > fabs(dy)) { lx = dx; r = dy; - rev = dx/fabs(dx); - }else{ + rev = Base::sgn(dx); + } + else { ly = dy; r = dx; a = 8; - rev = dy/fabs(dy); + rev = Base::sgn(dy); } for (int i=0; i < 17; i++) { @@ -4881,7 +4884,7 @@ public: protected: BoxMode Mode; Base::Vector2D StartPos; - double lx,ly,r,a,rev; + double lx,ly,r,a; std::vector EditCurve; std::vector sugConstr1, sugConstr2; };