/*-*-C++-*------------------------------------------------------------------
 * gaol -- Just Another Interval Library
 *--------------------------------------------------------------------------
 * This file is part of the gaol distribution. Gaol was primarily 
 * developed at the Swiss Federal Institute of Technology, Lausanne, 
 * Switzerland, and is now developed at the Institut de Recherche 
 * en Informatique de Nantes, France.
 *
 * Copyright (c) 2001 Swiss Federal Institute of Technology, Switzerland
 * Copyright (c) 2002 Institut de Recherche en Informatique de Nantes, France
 *--------------------------------------------------------------------------
 * gaol is a software distributed WITHOUT ANY WARRANTY. Read the associated 
 * COPYING file for information.
 *--------------------------------------------------------------------------
 * CVS: $Id: gaol_limits.h,v 1.5 2006/03/22 08:35:12 goualard Exp $
 * Last modified: Wed Sep 15 20:20:05 2004 on victory.irin.sciences.univ-nantes.fr
 * By: Frédéric Goualard <Frederic.Goualard@lina.univ-nantes.fr>
 *--------------------------------------------------------------------------*/

/*!
  \file   gaol_limits.h
  \brief  

  <long description>

  \author Frédéric Goualard
  \date   2001-10-01
*/


#ifndef __gaol_limits_h__
#define __gaol_limits_h__

// To overcome problems with old versions of autoconf
#undef PACKAGE
#include "gaol/gaol_config.h"

#if HAVE_LIMITS
#  include <limits>
#else
namespace std {
  template<class T>
  class numeric_limits {
  public:
    static const bool is_specialized = false;
  };
  
  class numeric_limits<double> {
  public:
    static const bool is_specialized = true;
    inline static double min() {
      return 4.94065645841246544e-324;
    }
    inline static double max() {
      return 1.797693134862315708e+308;
    }
    inline static double epsilon() {
      return 2.2204460492503131e-16;
    }
    inline static double infinity() {
      return 1.0/0.0;
    }
  };
  
#if SIZEOF_INT==4
  class numeric_limits<int> {
  public:
    static const bool is_specialized = true;
    inline static int min() {
      return (-2147483647-1);
    }
    inline static int max() {
      return 2147483647; 
    }
    inline static int epsilon() {
      return 0;
    }
  };
#elif SIZEOF_INT==8
  class numeric_limits<int> {
  public:
    static const bool is_specialized = true;
    inline static int min() {
      return (-9223372036854775807LL-1);
    }
    inline static int max() {
      return 9223372036854775807LL; 
    }
    inline static int epsilon() {
      return 0;
    }
  };
#endif

} // namespace std
#endif /* HAVE_LIMITS */

#endif /* __gaol_limits_h__ */
