Skip to content

Commit dfdd492

Browse files
committed
fix min inf
1 parent 5d5aec5 commit dfdd492

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

include/maxplus/algebra/mptype.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#include <cmath>
5151

5252
#define MPTIME_MAXVAL 1.0e+30
53-
#define MPTIME_MIN_INF_VAL -1.0e+20
53+
#define MPTIME_MIN_INF_VAL -1.0e+30
5454

5555
namespace MaxPlus {
5656

@@ -113,9 +113,10 @@ inline CDouble MP_MIN(CDouble a, CDouble b) { return CDouble(MP_MIN(MPTime(a), M
113113

114114
// the quick and dirty way of representing -infinity
115115
const MPTime MP_MINUSINFINITY = MPTime(-1.0e+30);
116-
117-
inline bool MP_ISMINUSINFINITY(CDouble a) { return a < MPTIME_MIN_INF_VAL; }
118-
inline bool MP_ISMINUSINFINITY(MPTime a) { return a < MP_MINUSINFINITY; }
116+
const MPTime MP_MINUSINFINITY_THR = MPTime(-0.5e+30);
117+
const CDouble MPTIME_MIN_INF_VALPTHR = -0.5e+30;
118+
inline bool MP_ISMINUSINFINITY(CDouble a) { return a <= MPTIME_MIN_INF_VALPTHR; }
119+
inline bool MP_ISMINUSINFINITY(MPTime a) { return a <= MP_MINUSINFINITY_THR; }
119120

120121
inline MPTime MP_PLUS(CDouble a, CDouble b) {
121122
return (MP_ISMINUSINFINITY(a) || MP_ISMINUSINFINITY(b)) ? MP_MINUSINFINITY

0 commit comments

Comments
 (0)