~ubuntu-branches/ubuntu/raring/openwalnut/raring

« back to all changes in this revision

Viewing changes to src/core/common/WLimits.h

  • Committer: Package Import Robot
  • Author(s): Sebastian Eichelbaum
  • Date: 2012-12-12 11:26:32 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20121212112632-xhiuwkxuz5h0idkh
Tags: 1.3.1+hg5849-1
* Minor changes compared to 1.3.0 but included several bug fixes.
* See http://www.openwalnut.org/versions/4

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <stdint.h> // since <cstdint> is part of c++0x upcoming standard
29
29
 
30
30
#include <cstddef>
31
 
#include <limits>
32
31
 
33
32
#include <boost/math/special_functions/fpclassify.hpp> // isnan, isinf
34
33
 
35
34
/**
36
 
 * Project wide limits for different quantitities.
 
35
 * Project wide limits for different quantities.
37
36
 */
38
37
namespace wlimits
39
38
{
40
 
    static const double MAX_DOUBLE = std::numeric_limits< double >::max(); //!< Maximum double value
41
 
 
42
 
    static const float MAX_FLOAT = std::numeric_limits< float >::max(); //!< Maximum float value
43
 
 
44
 
    static const size_t MAX_SIZE_T = std::numeric_limits< size_t >::max(); //!< Maximum size value
45
 
 
46
 
    static const int32_t MAX_INT32_T = std::numeric_limits< int32_t >::max(); //!< Maximum int32_t value
47
 
 
48
 
    static const double MIN_DOUBLE = std::numeric_limits< double >::min(); //!< Positive minimum double value
 
39
    extern const double MAX_DOUBLE; //!< Maximum double value
 
40
 
 
41
    extern const float MAX_FLOAT; //!< Maximum float value
 
42
 
 
43
    extern const size_t MAX_SIZE_T; //!< Maximum size value
 
44
 
 
45
    extern const int32_t MAX_INT32_T; //!< Maximum int32_t value
 
46
 
 
47
    extern const double MIN_DOUBLE; //!< Positive minimum double value
49
48
 
50
49
    /**
51
50
     * Smallest double such: 1.0 + DBL_EPS == 1.0 is still true.
52
51
     */
53
 
    static const double DBL_EPS = std::numeric_limits< double >::epsilon();
 
52
    extern const double DBL_EPS;
54
53
 
55
54
    /**
56
55
     * Smallest float such: 1.0 + FLT_EPS == 1.0 is still true.
57
56
     */
58
 
    static const float FLT_EPS = std::numeric_limits< float >::epsilon();
 
57
    extern const float FLT_EPS;
59
58
 
60
59
    /**
61
60
     * Determines if a number is considered as NaN (aka Not a Number) or not.
66
65
     *
67
66
     * \return True if the value is a NaN, false otherwise.
68
67
     */
69
 
    template< typename T > bool isnan( T value );
 
68
    template< typename T > bool isNaN( T value );
70
69
 
71
70
    /**
72
71
     * Determines if a number is considered as infinity or not.
77
76
     *
78
77
     * \return True if the value is infinity, false otherwise.
79
78
     */
80
 
    template< typename T > bool isinf( T value );
 
79
    template< typename T > bool isInf( T value );
81
80
}
82
81
 
83
 
template< typename T > bool wlimits::isnan( T value )
 
82
template< typename T > bool wlimits::isNaN( T value )
84
83
{
85
84
    return boost::math::isnan( value );
86
85
}
87
86
 
88
 
template< typename T > bool wlimits::isinf( T value )
 
87
template< typename T > bool wlimits::isInf( T value )
89
88
{
90
89
    return boost::math::isinf( value );
91
90
}