diff --git a/Framework/Geometry/src/Surfaces/Cylinder.cpp b/Framework/Geometry/src/Surfaces/Cylinder.cpp
index f9c68d47e3ea066b6f1daa24dab5752f31bc7054..ee1d6fba81ec2005ec212391e69a2847dccfe22b 100644
--- a/Framework/Geometry/src/Surfaces/Cylinder.cpp
+++ b/Framework/Geometry/src/Surfaces/Cylinder.cpp
@@ -2,6 +2,7 @@
 #include "MantidKernel/Strings.h"
 #include "MantidKernel/Tolerance.h"
 #include <iostream>
+#include <limits>
 
 #ifdef ENABLE_OPENCASCADE
 // Opencascade defines _USE_MATH_DEFINES without checking whether it is already
@@ -397,8 +398,8 @@ void Cylinder::getBoundingBox(double &xmax, double &ymax, double &zmax,
     listOfPoints.push_back(zmaxPoint);
   }
   if (!listOfPoints.empty()) {
-    xmin = ymin = zmin = DBL_MAX;
-    xmax = ymax = zmax = DBL_MIN;
+    xmin = ymin = zmin = std::numeric_limits<double>::max();
+    xmax = ymax = zmax = std::numeric_limits<double>::min();
     for (std::vector<V3D>::const_iterator it = listOfPoints.begin();
          it != listOfPoints.end(); ++it) {
       //			std::cout<<(*it)<<'\n';
diff --git a/Framework/Geometry/src/Surfaces/Plane.cpp b/Framework/Geometry/src/Surfaces/Plane.cpp
index ade992ef9375ecaa9171d0c1d990a9767d556db3..5bf951c2b1bc0b9891412373d27526ceae78f0d5 100644
--- a/Framework/Geometry/src/Surfaces/Plane.cpp
+++ b/Framework/Geometry/src/Surfaces/Plane.cpp
@@ -3,6 +3,7 @@
 #include "MantidKernel/Strings.h"
 #include "MantidKernel/Tolerance.h"
 #include <iostream>
+#include <limits>
 
 #ifdef ENABLE_OPENCASCADE
 // Opencascade defines _USE_MATH_DEFINES without checking whether it is already
@@ -393,8 +394,8 @@ void Plane::getBoundingBox(double &xmax, double &ymax, double &zmax,
   // now sort the vertices to find the  mins and max
   //	std::cout<<listOfPoints.size()<<'\n';
   if (!listOfPoints.empty()) {
-    xmin = ymin = zmin = DBL_MAX;
-    xmax = ymax = zmax = -DBL_MAX;
+    xmin = ymin = zmin = std::numeric_limits<double>::max();
+    xmax = ymax = zmax = -std::numeric_limits<double>::max();
     for (std::vector<V3D>::const_iterator it = listOfPoints.begin();
          it != listOfPoints.end(); ++it) {
       //			std::cout<<(*it)<<'\n';