1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef MVTOOLS_H_INCLUDED
#define MVTOOLS_H_INCLUDED

class MVException
{
public:
  enum ExceptionType
  {
    Unknown,
    DivByPosZero,
    DivByNegZero,
    PosInfValue,
    NegInfValue,
    DetNegative,
    DetCloseToZero
  };

  MVException() : type(Unknown) {}
  MVException(ExceptionType t) : type(t) {}

public:
  const char* getDescription() const;

public:
  /// type of exception
  ExceptionType type;
};

namespace MVTools
{
  bool isNearZero(float value);
  bool isNearPosZero(float value);
  bool isNearNegZero(float value);

  bool isNearInf(float value);
  bool isNearPosInf(float value);
  bool isNearNegInf(float value);

  double getMaxExpDouble();
  double getMaxPosDouble();
  double getMinPosDouble();

  bool isNearZero(double value);
  bool isNearPosZero(double value);
  bool isNearNegZero(double value);

  bool isNearInf(double value);
  bool isNearPosInf(double value);
  bool isNearNegInf(double value);

  float getMaxExpFloat();
  float getMaxPosFloat();
  float getMinPosFloat();

  bool isNearZero(int value);
  bool isNearPosZero(int value);
  bool isNearNegZero(int value);

  bool isNearInf(int value);
  bool isNearPosInf(int value);
  bool isNearNegInf(int value);

}; 
#endif