@@ -23,8 +23,8 @@ public class ExpressionInteger : Expression<int>
23
23
24
24
return new Bounds < int >
25
25
(
26
- leftBounds . LowerBound + rightBounds . LowerBound ,
27
- leftBounds . UpperBound + rightBounds . UpperBound
26
+ ( int ) Math . Max ( int . MinValue , Math . Min ( int . MaxValue , ( long ) leftBounds . LowerBound + rightBounds . LowerBound ) ) ,
27
+ ( int ) Math . Min ( int . MaxValue , Math . Max ( int . MinValue , ( long ) leftBounds . UpperBound + rightBounds . UpperBound ) )
28
28
) ;
29
29
} ,
30
30
propagator = ( first , second , enforce ) =>
@@ -74,8 +74,8 @@ public class ExpressionInteger : Expression<int>
74
74
75
75
return new Bounds < int >
76
76
(
77
- leftBounds . LowerBound - rightBounds . UpperBound ,
78
- leftBounds . UpperBound - rightBounds . LowerBound
77
+ ( int ) Math . Max ( int . MinValue , Math . Min ( int . MaxValue , ( long ) leftBounds . LowerBound - rightBounds . UpperBound ) ) ,
78
+ ( int ) Math . Min ( int . MaxValue , Math . Max ( int . MinValue , ( long ) leftBounds . UpperBound - rightBounds . LowerBound ) )
79
79
) ;
80
80
} ,
81
81
propagator = ( first , second , enforce ) =>
@@ -142,8 +142,8 @@ public class ExpressionInteger : Expression<int>
142
142
143
143
return new Bounds < int >
144
144
(
145
- leftBounds . LowerBound / rightBounds . UpperBound ,
146
- leftBounds . UpperBound / rightBounds . LowerBound
145
+ rightBounds . UpperBound == 0 ? ( leftBounds . LowerBound >= 0 ? int . MaxValue : int . MinValue ) : leftBounds . LowerBound / rightBounds . UpperBound ,
146
+ rightBounds . LowerBound == 0 ? ( leftBounds . UpperBound >= 0 ? int . MaxValue : int . MinValue ) : leftBounds . UpperBound / rightBounds . LowerBound
147
147
) ;
148
148
} ,
149
149
propagator = ( first , second , enforce ) =>
@@ -199,8 +199,8 @@ public class ExpressionInteger : Expression<int>
199
199
200
200
return new Bounds < int >
201
201
(
202
- leftBounds . LowerBound * rightBounds . LowerBound ,
203
- leftBounds . UpperBound * rightBounds . UpperBound
202
+ ( leftBounds . LowerBound == 0 || rightBounds . LowerBound == 0 ) ? 0 : ( ( leftBounds . LowerBound < 0 ) != ( rightBounds . LowerBound < 0 ) && Math . Abs ( ( long ) leftBounds . LowerBound ) > int . MaxValue / Math . Abs ( ( long ) rightBounds . LowerBound ) ) ? int . MinValue : leftBounds . LowerBound * rightBounds . LowerBound ,
203
+ ( leftBounds . UpperBound > 0 && rightBounds . UpperBound > 0 && leftBounds . UpperBound > int . MaxValue / rightBounds . UpperBound ) ? int . MaxValue : leftBounds . UpperBound * rightBounds . UpperBound
204
204
) ;
205
205
} ,
206
206
propagator = ( first , second , enforce ) =>
0 commit comments