Skip to content

Commit a3911b6

Browse files
committed
Fix: Double.MIN_VALUE -> -Double.MAX_VALUE in max.col and other places
1 parent bc21e67 commit a3911b6

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/EdgeDetection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ static Point rectEdge(double xmin, double ymin, double xmax, double ymax, double
128128
static Point polygonEdge(double[] x, double[] y, int n, double theta) {
129129
// centre of the polygon
130130
double xmin = fmin(Double.MAX_VALUE, x);
131-
double xmax = fmax(Double.MIN_VALUE, x);
131+
double xmax = fmax(-Double.MAX_VALUE, x);
132132
double ymin = fmin(Double.MAX_VALUE, y);
133-
double ymax = fmax(Double.MIN_VALUE, y);
133+
double ymax = fmax(-Double.MAX_VALUE, y);
134134
double xm = (xmin + xmax) / 2;
135135
double ym = (ymin + ymax) / 2;
136136

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/GridTextNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ public Object gridText(RAbstractStringVector textVec, RAbstractVector x, RAbstra
120120
int boundsCount = 0;
121121
Point edge = null;
122122
double xmin = Double.MAX_VALUE;
123-
double xmax = Double.MIN_VALUE;
123+
double xmax = -Double.MAX_VALUE;
124124
double ymin = Double.MAX_VALUE;
125-
double ymax = Double.MIN_VALUE;
125+
double ymax = -Double.MAX_VALUE;
126126
int ntxt = 0; // number of texts that were actually used for bounds computation
127127
EdgeDetection.Rectangle[] bounds = null;
128128
if (checkOverlap || !draw) {

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/Unit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ protected Double visitArithmeticUnit(ArithmeticUnit expr, Integer index) {
296296
case "min":
297297
return fmin(Double.MAX_VALUE, values);
298298
case "max":
299-
return fmax(Double.MIN_VALUE, values);
299+
return fmax(-Double.MAX_VALUE, values);
300300
case "sum":
301301
return sum(values);
302302
}
@@ -580,7 +580,7 @@ protected Double visitArithmeticUnit(ArithmeticUnit expr, UnitConversionArgs arg
580580
case "min":
581581
return GridUtils.fmin(Double.MAX_VALUE, values);
582582
case "max":
583-
return GridUtils.fmax(Double.MIN_VALUE, values);
583+
return GridUtils.fmax(-Double.MAX_VALUE, values);
584584
case "sum":
585585
return GridUtils.sum(values);
586586
default:

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MaxCol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ RAbstractIntVector findMaxCol(RAbstractContainer x, int tieArg,
7676
boolean tieLast = tie == TIE_LAST;
7777
boolean tieRandom = tie == TIE_RANDOM;
7878
double[] maxVals = new double[nrows];
79-
Arrays.fill(maxVals, Double.MIN_VALUE);
79+
Arrays.fill(maxVals, -Double.MAX_VALUE);
8080
int[] cols = new int[nrows];
8181
int resultIdx = 0;
8282
int colIdx = 1; // R indexing

0 commit comments

Comments
 (0)