/usr/include/CGAL/Restricted_double.h is in libcgal-dev 4.2-5ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | // Copyright (c) 1999,2000 INRIA Sophia-Antipolis (France).
// 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) : Sylvain Pion
#ifndef CGAL_RESTRICTED_DOUBLE_H
#define CGAL_RESTRICTED_DOUBLE_H
// This file contains the description of the class Restricted_double.
// The goal of this class is to be run by some overloaded predicates,
// This is just a wrapper for a double, but with limited functionality,
// to detect non-intented use.
// It's the type over which is run the epsilon variant, and which throws
// the exceptions.
// TODO: I need to add some missing operators and functions, min/max...
#include <CGAL/basic.h>
// #include <CGAL/double.h>
namespace CGAL {
#ifdef CGAL_IA_CHECK_RESTRICT
struct Restricted_double
{
typedef Restricted_double Self;
struct unsafe_comparison {}; // Exception class.
Restricted_double () {}
Restricted_double (const double &d) : _d(d) {}
Restricted_double (const int &i) : _d(double(i)) {}
// Add operator= for efficiency.
Self operator+ (const Self &f) const { return _d+f._d; }
Self operator- (const Self &f) const { return _d-f._d; }
Self operator* (const Self &f) const { return _d*f._d; }
Self operator/ (const Self &f) const { return _d/f._d; }
Self operator- () const { return -_d; }
Self& operator+=(const Self &f) { return *this = _d + f._d; }
Self& operator-=(const Self &f) { return *this = _d - f._d; }
Self& operator*=(const Self &f) { return *this = _d * f._d; }
Self& operator/=(const Self &f) { return *this = _d / f._d; }
#if 0
bool operator< (const Self &f) const { return _d < f._d; }
#endif
double dbl () const { return _d; }
private:
double _d;
};
inline
Restricted_double
sqrt(const Restricted_double &f)
{ return std::sqrt(f.dbl()); }
inline
Restricted_double
abs(const Restricted_double &f)
{ return CGAL::abs(f.dbl()); }
inline
double
to_double(const Restricted_double &f)
{ return f.dbl(); }
#else
typedef double Restricted_double;
#endif
} //namespace CGAL
#endif // CGAL_RESTRICTED_DOUBLE_H
|