# HG changeset patch # User Alpar Juttner <alpar@cs.elte.hu> # Date 1240479875 -3600 # Node ID 0c8e5c688440b6b90b285cd9af3c22c699b34748 # Parent 85cb3aa71cced72f8915b8abf50f705037a76bb1 Fix usage of sqrt() (#268) diff -r 85cb3aa71cce -r 0c8e5c688440 demo/graph_to_eps_demo.cc --- a/demo/graph_to_eps_demo.cc Tue Apr 21 15:18:54 2009 +0100 +++ b/demo/graph_to_eps_demo.cc Thu Apr 23 10:44:35 2009 +0100 @@ -182,7 +182,7 @@ ListDigraph::NodeMap<int> hcolors(h); ListDigraph::NodeMap<Point> hcoords(h); - int cols=int(sqrt(double(palette.size()))); + int cols=int(std::sqrt(double(palette.size()))); for(int i=0;i<int(paletteW.size());i++) { Node n=h.addNode(); hcoords[n]=Point(1+i%cols,1+i/cols); diff -r 85cb3aa71cce -r 0c8e5c688440 lemon/network_simplex.h --- a/lemon/network_simplex.h Tue Apr 21 15:18:54 2009 +0100 +++ b/lemon/network_simplex.h Thu Apr 23 10:44:35 2009 +0100 @@ -381,7 +381,8 @@ const double BLOCK_SIZE_FACTOR = 2.0; const int MIN_BLOCK_SIZE = 10; - _block_size = std::max( int(BLOCK_SIZE_FACTOR * sqrt(_arc_num)), + _block_size = std::max( int(BLOCK_SIZE_FACTOR * + std::sqrt(double(_arc_num))), MIN_BLOCK_SIZE ); } @@ -457,7 +458,8 @@ const double MINOR_LIMIT_FACTOR = 0.1; const int MIN_MINOR_LIMIT = 3; - _list_length = std::max( int(LIST_LENGTH_FACTOR * sqrt(_arc_num)), + _list_length = std::max( int(LIST_LENGTH_FACTOR * + std::sqrt(double(_arc_num))), MIN_LIST_LENGTH ); _minor_limit = std::max( int(MINOR_LIMIT_FACTOR * _list_length), MIN_MINOR_LIMIT ); @@ -577,7 +579,8 @@ const double HEAD_LENGTH_FACTOR = 0.1; const int MIN_HEAD_LENGTH = 3; - _block_size = std::max( int(BLOCK_SIZE_FACTOR * sqrt(_arc_num)), + _block_size = std::max( int(BLOCK_SIZE_FACTOR * + std::sqrt(double(_arc_num))), MIN_BLOCK_SIZE ); _head_length = std::max( int(HEAD_LENGTH_FACTOR * _block_size), MIN_HEAD_LENGTH ); @@ -1225,7 +1228,7 @@ } // Store the arcs in a mixed order - int k = std::max(int(sqrt(_arc_num)), 10); + int k = std::max(int(std::sqrt(double(_arc_num))), 10); int i = 0; for (ArcIt e(_graph); e != INVALID; ++e) { _arc_ref[i] = e; diff -r 85cb3aa71cce -r 0c8e5c688440 tools/lgf-gen.cc --- a/tools/lgf-gen.cc Tue Apr 21 15:18:54 2009 +0100 +++ b/tools/lgf-gen.cc Thu Apr 23 10:44:35 2009 +0100 @@ -65,7 +65,7 @@ double totalLen(){ double tlen=0; for(EdgeIt e(g);e!=INVALID;++e) - tlen+=sqrt((coords[g.v(e)]-coords[g.u(e)]).normSquare()); + tlen+=std::sqrt((coords[g.v(e)]-coords[g.u(e)]).normSquare()); return tlen; } @@ -188,7 +188,7 @@ (q.x * q.x + q.y * q.y) * (r.x * p.y - p.x * r.y) + (r.x * r.x + r.y * r.y) * (p.x * q.y - q.x * p.y); - return d / (2 * a) + sqrt((d * d + e * e) / (4 * a * a) + f / a); + return d / (2 * a) + std::sqrt((d * d + e * e) / (4 * a * a) + f / a); } inline bool circle_form(const Point& p, const Point& q, const Point& r) { @@ -206,7 +206,7 @@ double a = q.x - p.x; double b = (q.x - sx) * p.y - (p.x - sx) * q.y; double d = (q.x - sx) * (p.x - sx) * (p - q).normSquare(); - return (b - sqrt(d)) / a; + return (b - std::sqrt(d)) / a; } struct YLess { @@ -813,7 +813,7 @@ std::cout << "Number of arcs : " << countEdges(g) << std::endl; double tlen=0; for(EdgeIt e(g);e!=INVALID;++e) - tlen+=sqrt((coords[g.v(e)]-coords[g.u(e)]).normSquare()); + tlen+=std::sqrt((coords[g.v(e)]-coords[g.u(e)]).normSquare()); std::cout << "Total arc length : " << tlen << std::endl; if(ap["eps"])