Scippy

SCIP

Solving Constraint Integer Programs

portab.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2018 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file portab.h
17  * @brief Portable defintions
18  * @author Thorsten Koch
19  *
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef PORTAB_H
25 #define PORTAB_H
26 
27 #include <limits.h>
28 #include <math.h>
29 #include <float.h>
30 
31 #define EPSILON 1e-06
32 
33 #ifndef TRUE
34 #define TRUE 1
35 #endif
36 #ifndef FALSE
37 #define FALSE 0
38 #endif
39 
40 #ifndef SUCCESS
41 #define SUCCESS 0
42 #endif
43 #ifndef FAILURE
44 #define FAILURE (-1)
45 #endif
46 
47 #ifndef Max
48 #define Max(a, b) (((a) >= (b)) ? (a) : (b))
49 #endif
50 #ifndef Min
51 #define Min(a, b) (((a) <= (b)) ? (a) : (b))
52 #endif
53 
54 #define EPS_ZERO (DBL_EPSILON * 1e4)
55 
56 #ifndef Fsgn
57 #define Fsgn(x) ((((x) > -EPS_ZERO) && ((x) < EPS_ZERO)) ? 0 : (((x) < 0.0) ? -1 : 1))
58 #endif /* fsgn */
59 
60 /* Hi Fortran !
61  */
62 #define EQ(a, b) (fabs((a) - (b)) <= EPS_ZERO)
63 #define NE(a, b) (fabs((a) - (b)) > EPS_ZERO)
64 #define LT(a, b) (((a) - (b)) < -EPS_ZERO)
65 #define LE(a, b) (((a) - (b)) < EPS_ZERO)
66 #define GT(a, b) (((a) - (b)) > EPS_ZERO)
67 #define GE(a, b) (((a) - (b)) > -EPS_ZERO)
68 
69 #ifdef __GNUC__
70 #define does_not_return __attribute__((noreturn))
71 #else
72 #define does_not_return /**/
73 #define inline /**/
74 #endif
75 
76 #if defined(MSDOS) || defined(WIN32)
77 #define DIRSEP "\\"
78 #else
79 #define DIRSEP "/"
80 #endif
81 
82 #endif /* PORTAB_H */