~ubuntu-branches/ubuntu/saucy/rheolef/saucy

« back to all changes in this revision

Viewing changes to nfem/ptst/rounder.h

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Saramito
  • Date: 2011-03-23 11:14:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110323111426-cjvhey7lxt6077ty
Tags: 5.93-1
* New upstream release (minor changes):
  - some extra warning message deleted in heap_allocator
  - graphic output with mayavi2 fixed
  - add doc refman in .info and .pdf format

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
template <class T>
22
22
struct rounder_type : std::unary_function<T,T> {
23
23
  rounder_type (const T& prec) : _prec(prec) {}
24
 
  T operator() (const T& x) const { return _prec*T((long long int)(x/_prec+0.5)); }
 
24
  T operator() (const T& x) const { 
 
25
     T value = _prec*round(x/_prec);
 
26
     if (1+value == 1) value = 0;
 
27
     return value;
 
28
  }
 
29
#ifdef TO_CLEAN
 
30
  //T operator() (const T& x) const { return _prec*T((long long int)(x/_prec+0.5)); }
 
31
#endif // TO_CLEAN
25
32
  T _prec;
26
33
};
27
34
template <class T>