// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_eqT #define tools_eqT namespace tools { template inline bool numbers_are_equal(const NUMBER& a_left,const NUMBER& a_right,const PREC& a_prec,PREC(*a_fabs)(const NUMBER&)) { NUMBER diff = a_left - a_right; if(a_fabs(diff)>=a_prec) return false; return true; } template inline bool is_zero(const NUMBER& a_left,const PREC& a_prec,PREC(*a_fabs)(const NUMBER&)) { if(a_fabs(a_left)>=a_prec) return false; return true; } template inline bool numbers_are_equal(const NUMBER& a_left,const NUMBER& a_right,const PREC& a_prec,PREC(*a_fabs)(NUMBER)) { NUMBER diff = a_left - a_right; if(a_fabs(diff)>=a_prec) return false; return true; } template inline bool vectors_are_equal(const VEC& a_1,const VEC& a_2,const PREC& a_prec,PREC(*a_fabs)(PREC)) { if(a_1.size()!=a_2.size()) return false; typedef typename VEC::size_type sz_t; sz_t sz = a_1.size(); //bool status = true; for(sz_t index=0;index inline bool vecvecs_are_equal(const VECVEC& a_1,const VECVEC& a_2,const PREC& a_prec,PREC(*a_fabs)(PREC)) { if(a_1.size()!=a_2.size()) return false; typedef typename VECVEC::size_type sz_t; sz_t sz = a_1.size(); for(sz_t index=0;index