lemon/math.h
author Alpar Juttner <alpar@cs.elte.hu>
Sat, 25 May 2013 06:59:31 +0200
changeset 1064 fc3854d936f7
parent 487 06787db0ef5f
child 1054 c40a9d94442d
permissions -rw-r--r--
Enable/disable options for LP/MIP backends (#465)
alpar@209
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
alpar@68
     2
 *
alpar@209
     3
 * This file is a part of LEMON, a generic C++ optimization library.
alpar@68
     4
 *
alpar@877
     5
 * Copyright (C) 2003-2010
alpar@68
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@68
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@68
     8
 *
alpar@68
     9
 * Permission to use, modify and distribute this software is granted
alpar@68
    10
 * provided that this copyright notice appears in all copies. For
alpar@68
    11
 * precise terms see the accompanying LICENSE file.
alpar@68
    12
 *
alpar@68
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@68
    14
 * express or implied, and with no claim as to its suitability for any
alpar@68
    15
 * purpose.
alpar@68
    16
 *
alpar@68
    17
 */
alpar@68
    18
alpar@68
    19
#ifndef LEMON_MATH_H
alpar@68
    20
#define LEMON_MATH_H
alpar@68
    21
alpar@68
    22
///\ingroup misc
alpar@68
    23
///\file
alpar@68
    24
///\brief Some extensions to the standard \c cmath library.
alpar@68
    25
///
alpar@68
    26
///Some extensions to the standard \c cmath library.
alpar@68
    27
///
alpar@68
    28
///This file includes the standard math library (cmath).
alpar@68
    29
alpar@68
    30
#include<cmath>
alpar@68
    31
alpar@68
    32
namespace lemon {
alpar@68
    33
alpar@68
    34
  /// \addtogroup misc
alpar@68
    35
  /// @{
alpar@209
    36
alpar@68
    37
  /// The Euler constant
alpar@68
    38
  const long double E       = 2.7182818284590452353602874713526625L;
alpar@68
    39
  /// log_2(e)
alpar@68
    40
  const long double LOG2E   = 1.4426950408889634073599246810018921L;
alpar@68
    41
  /// log_10(e)
alpar@68
    42
  const long double LOG10E  = 0.4342944819032518276511289189166051L;
alpar@68
    43
  /// ln(2)
alpar@68
    44
  const long double LN2     = 0.6931471805599453094172321214581766L;
alpar@68
    45
  /// ln(10)
alpar@68
    46
  const long double LN10    = 2.3025850929940456840179914546843642L;
alpar@68
    47
  /// pi
alpar@68
    48
  const long double PI      = 3.1415926535897932384626433832795029L;
alpar@68
    49
  /// pi/2
alpar@68
    50
  const long double PI_2    = 1.5707963267948966192313216916397514L;
alpar@68
    51
  /// pi/4
alpar@68
    52
  const long double PI_4    = 0.7853981633974483096156608458198757L;
alpar@68
    53
  /// sqrt(2)
alpar@68
    54
  const long double SQRT2   = 1.4142135623730950488016887242096981L;
alpar@68
    55
  /// 1/sqrt(2)
alpar@68
    56
  const long double SQRT1_2 = 0.7071067811865475244008443621048490L;
alpar@209
    57
alpar@470
    58
  ///Check whether the parameter is NaN or not
alpar@877
    59
alpar@470
    60
  ///This function checks whether the parameter is NaN or not.
alpar@470
    61
  ///Is should be equivalent with std::isnan(), but it is not
alpar@470
    62
  ///provided by all compilers.
alpar@487
    63
  inline bool isNaN(double v)
alpar@470
    64
    {
alpar@470
    65
      return v!=v;
alpar@470
    66
    }
alpar@68
    67
alpar@68
    68
  /// @}
alpar@68
    69
alpar@68
    70
} //namespace lemon
alpar@68
    71
alpar@68
    72
#endif //LEMON_TOLERANCE_H