Browse Source

PrismUtils: findMaxFinite

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@12108 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 9 years ago
parent
commit
810f149e88
  1. 18
      prism/src/prism/PrismUtils.java

18
prism/src/prism/PrismUtils.java

@ -213,6 +213,24 @@ public class PrismUtils
return doublesAreCloseAbs(d1, d2, epsilonDouble);
}
/**
* Return the maximum finite value in a double array, looking at
* those entries with indices given bit the integer iterator.
*/
public static double findMaxFinite(double[] soln, PrimitiveIterator.OfInt indices)
{
double max_v = Double.NEGATIVE_INFINITY;
while (indices.hasNext()) {
int i = indices.nextInt();
double v = soln[i];
if (v < Double.POSITIVE_INFINITY) {
max_v = Double.max(v, max_v);
}
}
return max_v;
}
/**
* Format a large integer, represented by a double, as a string.
*/

Loading…
Cancel
Save