// Copyright (c) 2007-2009 Inria Lorraine (France). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL: https://github.com/CGAL/cgal/blob/v5.1/Number_types/include/CGAL/Gmpfr.h $ // $Id: Gmpfr.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author: Luis Peñaranda #ifndef CGAL_GMPFR_H #define CGAL_GMPFR_H #include #include namespace CGAL{ template <> class Algebraic_structure_traits: public Algebraic_structure_traits_base{ public: typedef Tag_false Is_exact; typedef Tag_true Is_numerical_sensitive; typedef bool Boolean; struct Is_zero: public CGAL::cpp98::unary_function{ Boolean operator()(const Type &x)const{ return x.is_zero(); } }; struct Is_one: public CGAL::cpp98::unary_function{ Boolean operator()(const Type &x)const{ return x.is_one(); } }; struct Square: public CGAL::cpp98::unary_function{ Type operator()(const Type &x)const{ return x.square(); }; }; struct Is_square: public CGAL::cpp98::binary_function{ Boolean operator()(const Type &x,Type &y)const{ return x.is_square(y); }; Boolean operator()(const Type &x)const{ return x.is_square(); }; }; struct Sqrt: public CGAL::cpp98::unary_function{ Type operator()(const Type &x)const{ return x.sqrt(); }; }; struct Kth_Root: public CGAL::cpp98::binary_function{ Type operator()(int k,const Type &x)const{ return (k==3?x.cbrt():x.kthroot(k)); }; }; }; template <> class Real_embeddable_traits: public INTERN_RET::Real_embeddable_traits_base{ typedef Algebraic_structure_traits AST; public: typedef Tag_true Is_real_embeddable; typedef bool Boolean; typedef CGAL::Comparison_result Comparison_result; typedef CGAL::Sign Sign; typedef AST::Is_zero Is_zero; struct Is_finite: public CGAL::cpp98::unary_function{ inline Boolean operator()(const Type &x)const{ return(x.is_number()); }; }; struct Abs: public CGAL::cpp98::unary_function{ inline Type operator()(const Type &x)const{ return x.abs(); }; }; struct Sgn: public CGAL::cpp98::unary_function{ inline Sign operator()(const Type &x)const{ return x.sign(); }; }; struct Is_positive: public CGAL::cpp98::unary_function{ inline Boolean operator()(const Type &x)const{ return(x.sign()==POSITIVE); }; }; struct Is_negative: public CGAL::cpp98::unary_function{ inline Boolean operator()(const Type &x)const{ return(x.sign()==NEGATIVE); }; }; struct Compare: public CGAL::cpp98::binary_function{ inline Comparison_result operator() (const Type &x,const Type &y)const{ return x.compare(y); }; CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result) }; struct To_double: public CGAL::cpp98::unary_function{ inline double operator()(const Type &x)const{ return x.to_double(); }; }; struct To_interval: public CGAL::cpp98::unary_function >{ inline std::pairoperator()(const Type &x)const{ return x.to_interval(); }; }; }; } namespace Eigen { template struct NumTraits; template<> struct NumTraits { typedef CGAL::Gmpfr Real; typedef CGAL::Gmpfr NonInteger; typedef CGAL::Gmpfr Nested; typedef CGAL::Gmpfr Literal; static inline Real epsilon() { return 0; } static inline Real dummy_precision() { return 0; } enum { IsInteger = 0, IsSigned = 1, IsComplex = 0, RequireInitialization = 1, ReadCost = 6, AddCost = 50, MulCost = 50 }; }; } #include #include #endif // CGAL_GMPFR_H // vim: tabstop=8: softtabstop=8: smarttab: shiftwidth=8: expandtab