// Copyright (c) 2005 Stanford University (USA). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 3 of the License, // or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ // $Id$ // // // Author(s) : Daniel Russel #ifndef CGAL_POLYNOMIAL_INTERNAL_WRAPPED_DOUBLE_H #define CGAL_POLYNOMIAL_INTERNAL_WRAPPED_DOUBLE_H #include namespace CGAL { namespace POLYNOMIAL { namespace internal { template struct Double_with_infinity_default { static double value(){return (std::numeric_limits::max)();}; }; template struct Double_with_infinity_default { static double value(){return std::numeric_limits::signaling_NaN();}; }; template<> struct Double_with_infinity_default { static double value(){return std::numeric_limits::quiet_NaN();}; }; struct Double_with_infinity { static double get_default() { return Double_with_infinity_default::has_signaling_NaN, std::numeric_limits::has_quiet_NaN>::value(); } Double_with_infinity(): d_(get_default()){} Double_with_infinity(double d): d_(d){} operator const double&() const { return d_; } bool is_rational() const { return true; } double to_rational() const {return d_;} bool is_even_multiplicity() const { return false; } std::pair isolating_interval() const { return std::make_pair(d_, d_); } protected: double d_; }; } } } //namespace CGAL::POLYNOMIAL::internal namespace std { template <> class numeric_limits: public numeric_limits { public: static const bool is_specialized = true; static const bool has_infinity=true; static double infinity() throw() {return (std::numeric_limits::max)();} }; } namespace CGAL { inline double to_double(CGAL_POLYNOMIAL_NS::internal::Double_with_infinity d) { return to_double(static_cast(d)); } } //namespace CGAL #endif