#include <cstdint>
#include <cmath>

#include <iostream>

template <int32_t B, int32_t E>
struct Pow {
   static int32_t const value = Pow<B,E-1>::value * B;
};

template <int32_t B>
struct Pow<B,0> {
   static int32_t const value = 1;
};

template <int8_t E>
struct AcceptableError {
   static double const value = 1.0 / Pow<10,E>::value;
};


template <typename Error = AcceptableError<1> >
class Double {
private :
   double num;

public:

   Double( double value ) : num( value ) { }

   bool equals ( Double const & rhs ) const {
       return fabs (num - rhs.num ) < Error::value;
   }
};

int main() {

   using namespace std;

   Double<> a( 1e-1 ), b( 1e-2 );
   cout << boolalpha << a.equals(b) << endl;

   Double< AcceptableError<8> > c( 1e-1 ), d( 1e-2 );
   cout << boolalpha << c.equals(d) << endl;
}
