lemon/math.h
changeset 1177 3c00344f49c9
parent 1092 dceba191c00d
     1.1 --- a/lemon/math.h	Mon Jul 16 16:21:40 2018 +0200
     1.2 +++ b/lemon/math.h	Wed Oct 17 19:14:07 2018 +0200
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2010
     1.8 + * Copyright (C) 2003-2013
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -65,8 +65,13 @@
    1.13        return v!=v;
    1.14      }
    1.15  
    1.16 +  ///Round a value to its closest integer
    1.17 +  inline double round(double r) {
    1.18 +    return (r > 0.0) ? std::floor(r + 0.5) : std::ceil(r - 0.5);
    1.19 +  }
    1.20 +
    1.21    /// @}
    1.22  
    1.23  } //namespace lemon
    1.24  
    1.25 -#endif //LEMON_TOLERANCE_H
    1.26 +#endif //LEMON_MATH_H