Example usage for java.lang Double NEGATIVE_INFINITY

List of usage examples for java.lang Double NEGATIVE_INFINITY

Introduction

In this page you can find the example usage for java.lang Double NEGATIVE_INFINITY.

Prototype

double NEGATIVE_INFINITY

To view the source code for java.lang Double NEGATIVE_INFINITY.

Click Source Link

Document

A constant holding the negative infinity of type double .

Usage

From source file:com.datumbox.framework.core.statistics.distributions.ContinuousDistributions.java

/**
 * Returns the z score of a specific pvalue for Gaussian
 * Partially ported from http://home.online.no/~pjacklam/notes/invnorm/impl/karimov/StatUtil.java
 * Other implementations http://home.online.no/~pjacklam/notes/invnorm/index.html#Java
 * /*from   ww w.  j av  a2s  .  com*/
 * @param p
 * @return 
 */
public static double gaussInverseCdf(double p) {
    final double P_LOW = 0.02425D;
    final double P_HIGH = 1.0D - P_LOW;
    final double ICDF_A[] = { -3.969683028665376e+01, 2.209460984245205e+02, -2.759285104469687e+02,
            1.383577518672690e+02, -3.066479806614716e+01, 2.506628277459239e+00 };
    final double ICDF_B[] = { -5.447609879822406e+01, 1.615858368580409e+02, -1.556989798598866e+02,
            6.680131188771972e+01, -1.328068155288572e+01 };
    final double ICDF_C[] = { -7.784894002430293e-03, -3.223964580411365e-01, -2.400758277161838e+00,
            -2.549732539343734e+00, 4.374664141464968e+00, 2.938163982698783e+00 };
    final double ICDF_D[] = { 7.784695709041462e-03, 3.224671290700398e-01, 2.445134137142996e+00,
            3.754408661907416e+00 };

    // Define break-points.
    // variable for result
    double z;

    if (p == 0) {
        z = Double.NEGATIVE_INFINITY;
    } else if (p == 1) {
        z = Double.POSITIVE_INFINITY;
    } else if (Double.isNaN(p) || p < 0 || p > 1) {
        z = Double.NaN;
    } else if (p < P_LOW) { // Rational approximation for lower region:
        double q = Math.sqrt(-2 * Math.log(p));
        z = (((((ICDF_C[0] * q + ICDF_C[1]) * q + ICDF_C[2]) * q + ICDF_C[3]) * q + ICDF_C[4]) * q + ICDF_C[5])
                / ((((ICDF_D[0] * q + ICDF_D[1]) * q + ICDF_D[2]) * q + ICDF_D[3]) * q + 1);
    } else if (P_HIGH < p) { // Rational approximation for upper region:
        double q = Math.sqrt(-2 * Math.log(1 - p));
        z = -(((((ICDF_C[0] * q + ICDF_C[1]) * q + ICDF_C[2]) * q + ICDF_C[3]) * q + ICDF_C[4]) * q + ICDF_C[5])
                / ((((ICDF_D[0] * q + ICDF_D[1]) * q + ICDF_D[2]) * q + ICDF_D[3]) * q + 1);
    } else { // Rational approximation for central region:
        double q = p - 0.5D;
        double r = q * q;
        z = (((((ICDF_A[0] * r + ICDF_A[1]) * r + ICDF_A[2]) * r + ICDF_A[3]) * r + ICDF_A[4]) * r + ICDF_A[5])
                * q
                / (((((ICDF_B[0] * r + ICDF_B[1]) * r + ICDF_B[2]) * r + ICDF_B[3]) * r + ICDF_B[4]) * r + 1);
    }

    return z;
}

From source file:net.sourceforge.jasa.report.HistoricalDataReport.java

protected void initialisePriceRanges() {
    highestBidPrice = Double.NEGATIVE_INFINITY;
    lowestAskPrice = Double.POSITIVE_INFINITY;

    highestUnacceptedBid = null;//from  ww  w  . j  a v  a 2 s. c o  m
    lowestUnacceptedAsk = null;
}

From source file:org.opendatakit.ermodel.RelationTest.java

@Test
public void testCase8() throws ODKDatastoreException {

    MyRelation rel = new MyRelation(callingContext);
    rel = new MyRelation(callingContext);
    Entity e = rel.newEntity(callingContext);

    e.setAsString("secondField", "5");
    e.setAsString("thirdField", "3.3");
    e.setAsString("thirdApproxField", Double.toString(Double.NaN));
    e.setAsString("fourthField", (new Date()).toString());
    e.set("thisIsIt", "a simple long string");

    e.put(callingContext);//from   w  ww  .j  a  va  2s  .com

    Entity e2 = rel.newEntity(callingContext);

    e2.setAsString("secondField", "6");
    e2.setAsString("thirdApproxField", "6.81");
    e2.setAsString("fourthField", (new Date(0)).toString());
    e2.set("thisIsIt", "another simple long string");

    e2.put(callingContext);

    Entity e3 = rel.newEntity(callingContext);

    e3.setAsString("secondField", "7");
    e3.setAsString("thirdApproxField", Double.toString(Double.POSITIVE_INFINITY));
    e3.setAsString("fourthField", (new Date(0)).toString());
    e3.set("thisIsIt", "another simple long string");

    e3.put(callingContext);

    Entity e4 = rel.newEntity(callingContext);

    e4.setAsString("secondField", "8");
    e4.setAsString("thirdField", "3.3");
    e4.setAsString("thirdApproxField", Double.toString(Double.NEGATIVE_INFINITY));
    e4.setAsString("fourthField", (new Date(0)).toString());
    e4.set("thisIsIt", "another simple long string");

    e4.put(callingContext);

    Query query;
    List<Entity> entities;

    query = rel.query("DbTable.testCase8.fieldApproxDbl-notEqual", callingContext);
    query.addFilter(MyRelation.fieldApproxDbl.getName(), FilterOperation.NOT_EQUAL, Double.NaN);
    entities = query.execute();
    assertEquals(3, entities.size());

    query = rel.query("DbTable.testCase8.fieldApproxDbl-Equal", callingContext);
    query.addFilter(MyRelation.fieldApproxDbl.getName(), FilterOperation.EQUAL, Double.NaN);
    entities = query.execute();
    assertEquals(1, entities.size());
    assertEquals(e.getId(), entities.get(0).getId());

    query = rel.query("DbTable.testCase8.fieldApproxDbl-notEqual", callingContext);
    query.addFilter(MyRelation.fieldApproxDbl.getName(), FilterOperation.NOT_EQUAL, 6.81);
    entities = query.execute();
    assertEquals(3, entities.size());

    query = rel.query("DbTable.testCase8.fieldApproxDbl-Equal", callingContext);
    query.addFilter(MyRelation.fieldApproxDbl.getName(), FilterOperation.EQUAL, 6.81);
    entities = query.execute();
    assertEquals(1, entities.size());
    assertEquals(e2.getId(), entities.get(0).getId());

    query = rel.query("DbTable.testCase8.fieldDbl-notEqual", callingContext);
    query.addFilter(MyRelation.fieldApproxDbl.getName(), FilterOperation.NOT_EQUAL, Double.POSITIVE_INFINITY);
    entities = query.execute();
    assertEquals(3, entities.size());

    query = rel.query("DbTable.testCase8.fieldApproxDbl-Equal", callingContext);
    query.addFilter(MyRelation.fieldApproxDbl.getName(), FilterOperation.EQUAL, Double.POSITIVE_INFINITY);
    entities = query.execute();
    assertEquals(1, entities.size());
    assertEquals(e3.getId(), entities.get(0).getId());

    query = rel.query("DbTable.testCase8.fieldApproxDbl-notEqual", callingContext);
    query.addFilter(MyRelation.fieldApproxDbl.getName(), FilterOperation.NOT_EQUAL, Double.NEGATIVE_INFINITY);
    entities = query.execute();
    assertEquals(3, entities.size());

    query = rel.query("DbTable.testCase8.fieldApproxDbl-Equal", callingContext);
    query.addFilter(MyRelation.fieldApproxDbl.getName(), FilterOperation.EQUAL, Double.NEGATIVE_INFINITY);
    entities = query.execute();
    assertEquals(1, entities.size());
    assertEquals(e4.getId(), entities.get(0).getId());

    rel.dropRelation(callingContext);
}

From source file:com.datumbox.framework.statistics.distributions.ContinuousDistributions.java

/**
 * Returns the z score of a specific pvalue for Gaussian
 * Partially ported from http://home.online.no/~pjacklam/notes/invnorm/impl/karimov/StatUtil.java
 * Other implementations http://home.online.no/~pjacklam/notes/invnorm/index.html#Java
 * /*from w  ww .j  a va  2s  .  c o m*/
 * @param p
 * @return 
 */
public static double GaussInverseCdf(double p) {
    final double P_LOW = 0.02425D;
    final double P_HIGH = 1.0D - P_LOW;
    final double ICDF_A[] = { -3.969683028665376e+01, 2.209460984245205e+02, -2.759285104469687e+02,
            1.383577518672690e+02, -3.066479806614716e+01, 2.506628277459239e+00 };
    final double ICDF_B[] = { -5.447609879822406e+01, 1.615858368580409e+02, -1.556989798598866e+02,
            6.680131188771972e+01, -1.328068155288572e+01 };
    final double ICDF_C[] = { -7.784894002430293e-03, -3.223964580411365e-01, -2.400758277161838e+00,
            -2.549732539343734e+00, 4.374664141464968e+00, 2.938163982698783e+00 };
    final double ICDF_D[] = { 7.784695709041462e-03, 3.224671290700398e-01, 2.445134137142996e+00,
            3.754408661907416e+00 };

    // Define break-points.
    // variable for result
    double z = 0;

    if (p == 0) {
        z = Double.NEGATIVE_INFINITY;
    } else if (p == 1) {
        z = Double.POSITIVE_INFINITY;
    } else if (Double.isNaN(p) || p < 0 || p > 1) {
        z = Double.NaN;
    } else if (p < P_LOW) { // Rational approximation for lower region:
        double q = Math.sqrt(-2 * Math.log(p));
        z = (((((ICDF_C[0] * q + ICDF_C[1]) * q + ICDF_C[2]) * q + ICDF_C[3]) * q + ICDF_C[4]) * q + ICDF_C[5])
                / ((((ICDF_D[0] * q + ICDF_D[1]) * q + ICDF_D[2]) * q + ICDF_D[3]) * q + 1);
    } else if (P_HIGH < p) { // Rational approximation for upper region:
        double q = Math.sqrt(-2 * Math.log(1 - p));
        z = -(((((ICDF_C[0] * q + ICDF_C[1]) * q + ICDF_C[2]) * q + ICDF_C[3]) * q + ICDF_C[4]) * q + ICDF_C[5])
                / ((((ICDF_D[0] * q + ICDF_D[1]) * q + ICDF_D[2]) * q + ICDF_D[3]) * q + 1);
    } else { // Rational approximation for central region:
        double q = p - 0.5D;
        double r = q * q;
        z = (((((ICDF_A[0] * r + ICDF_A[1]) * r + ICDF_A[2]) * r + ICDF_A[3]) * r + ICDF_A[4]) * r + ICDF_A[5])
                * q
                / (((((ICDF_B[0] * r + ICDF_B[1]) * r + ICDF_B[2]) * r + ICDF_B[3]) * r + ICDF_B[4]) * r + 1);
    }

    return z;
}

From source file:com.taobao.weex.devtools.json.ObjectMapper.java

private Object getJsonValue(Object value, Class<?> clazz, Field field)
        throws InvocationTargetException, IllegalAccessException {
    if (value == null) {
        // Now technically we /could/ return JsonNode.NULL here but Chrome's webkit inspector croaks
        // if you pass a null "id"
        return null;
    }/*from ww  w  .j av  a  2  s.com*/
    if (List.class.isAssignableFrom(clazz)) {
        return convertListToJsonArray(value);
    }
    // Finally check to see if there is a JsonValue present
    Method m = getJsonValueMethod(clazz);
    if (m != null) {
        return m.invoke(value);
    }
    if (!canDirectlySerializeClass(clazz)) {
        return convertValue(value, JSONObject.class);
    }
    // JSON has no support for NaN, Infinity or -Infinity, so we serialize
    // then as strings. Google Chrome's inspector will accept them just fine.
    if (clazz.equals(Double.class) || clazz.equals(Float.class)) {
        double doubleValue = ((Number) value).doubleValue();
        if (Double.isNaN(doubleValue)) {
            return "NaN";
        } else if (doubleValue == Double.POSITIVE_INFINITY) {
            return "Infinity";
        } else if (doubleValue == Double.NEGATIVE_INFINITY) {
            return "-Infinity";
        }
    }
    // hmm we should be able to directly serialize here...
    return value;
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.ChartAxisFactory.java

private static Pair<Double, Double> calculateUpperAndLowerBounds(ValueSource valueSource,
        PlotInstance plotInstance) {//from www . j ava 2  s .  c  om

    Pair<Double, Double> minMax = new Pair<Double, Double>(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY);

    ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
    GroupCellSeriesData dataForAllGroupCells = valueSourceData.getSeriesDataForAllGroupCells();

    Map<Double, Double> stackedYValues = new HashMap<Double, Double>();

    // Loop all group cells and add data to dataset
    for (GroupCellKeyAndData groupCellKeyAndData : dataForAllGroupCells) {
        GroupCellData groupCellData = groupCellKeyAndData.getData();

        Map<PlotDimension, double[]> dataForUsageType = groupCellData
                .getDataForUsageType(SeriesUsageType.MAIN_SERIES);
        double[] xValues = dataForUsageType.get(PlotDimension.DOMAIN);
        double[] yValues = dataForUsageType.get(PlotDimension.VALUE);
        int rowCount = xValues.length;

        // Loop all rows and add data to series
        for (int row = 0; row < rowCount; ++row) {
            Double x = xValues[row];
            Double stackedYValue = stackedYValues.get(x);
            double d = yValues[row];
            if (!Double.isNaN(d)) {
                if (stackedYValue == null) {
                    stackedYValues.put(x, d);
                } else {
                    double value = stackedYValue + d;
                    stackedYValues.put(x, value);
                }
            }
        }
    }

    for (Double xValue : stackedYValues.keySet()) {
        Double yValue = stackedYValues.get(xValue);
        if (yValue > minMax.getSecond()) {
            minMax.setSecond(yValue);
        }
        if (yValue < minMax.getFirst()) {
            minMax.setFirst(yValue);
        }
    }

    return minMax;
}

From source file:ch.usi.inf.lidr.merging.SAFE.java

/**
 * Returns four different regression models, namely,
 * linear, log, square root and inverse linear.
 *//*  w  w w .  java 2  s. c om*/
private Regression[] getRegressions() {
    return new Regression[] { new Regression() {
        protected double f(double x) {
            return x;
        }
    }, new Regression() {
        protected double f(double x) {
            if (x <= 0) {
                return Double.NEGATIVE_INFINITY;
            }
            return Math.log(x);
        }
    }, new Regression() {
        protected double f(double x) {
            if (x < 0) {
                return 0;
            }
            return Math.sqrt(x);
        }
    }, new Regression() {
        protected double f(double x) {
            if (x == 0) {
                return 0;
            }
            return 1 / x;
        }
    } };
}

From source file:com.joliciel.jochre.lexicon.MostLikelyWordChooserImpl.java

@Override
public LetterSequence chooseMostLikelyWord(List<LetterSequence> heap, int n) {
    int i = 0;//from  ww w.ja v  a 2s.c  o  m
    double bestScore = Double.NEGATIVE_INFINITY;
    LetterSequence bestSequence = null;

    List<LetterSequence> sequences = new ArrayList<LetterSequence>(n);
    for (LetterSequence sequence : heap) {
        if (i >= n)
            break;
        sequences.add(sequence);

        StringBuilder sb = new StringBuilder();
        int j = 0;
        for (Letter outcome : sequence) {
            // we skip a dash which separates two rows if required
            if (outcome != null && j != sequence.getDashToSkip())
                sb.append(outcome.getString());
            j++;
        }
        String wordText = sb.toString();
        int minFrequency = this.getFrequency(wordText, sequence);

        sequence.setFrequency(minFrequency);
        double freqLog = this.getFrequencyAdjustment(minFrequency);

        double adjustedScore = sequence.getScore() * freqLog;
        sequence.setAdjustedScore(adjustedScore);
        if (LOG.isDebugEnabled())
            LOG.debug(sequence.toString() + ". Score: " + sequence.getScore() + ". Freq: " + minFrequency
                    + ". Adjusted: " + freqLog + ". Adjusted score: " + adjustedScore);
        if (adjustedScore > bestScore) {
            bestSequence = sequence;
            bestScore = adjustedScore;
        }
        i++;
    }
    if (LOG.isDebugEnabled())
        LOG.debug("Best: " + bestSequence.toString());

    return bestSequence;
}

From source file:com.linkedin.pinot.integration.tests.DefaultColumnsClusterIntegrationTest.java

@Test
public void testNewAddedColumns() throws Exception {
    String pqlQuery;//from w  w w .  j a va 2  s.c o m
    String sqlQuery;

    // Test queries with each new added columns.
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedIntMetric = 1";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedLongMetric = 1";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedFloatMetric = 0.0";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedDoubleMetric = 0.0";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedIntDimension < 0";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedLongDimension < 0";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedFloatDimension < 0.0";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedDoubleDimension < 0.0";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT COUNT(*) FROM mytable WHERE NewAddedStringDimension = 'newAdded'";
    sqlQuery = "SELECT COUNT(*) FROM mytable";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));

    // Test queries with new added metric column in aggregation function.
    pqlQuery = "SELECT SUM(NewAddedIntMetric) FROM mytable WHERE DaysSinceEpoch <= 16312";
    sqlQuery = "SELECT COUNT(*) FROM mytable WHERE DaysSinceEpoch <= 16312";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT SUM(NewAddedIntMetric) FROM mytable WHERE DaysSinceEpoch > 16312";
    sqlQuery = "SELECT COUNT(*) FROM mytable WHERE DaysSinceEpoch > 16312";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT SUM(NewAddedLongMetric) FROM mytable WHERE DaysSinceEpoch <= 16312";
    sqlQuery = "SELECT COUNT(*) FROM mytable WHERE DaysSinceEpoch <= 16312";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));
    pqlQuery = "SELECT SUM(NewAddedLongMetric) FROM mytable WHERE DaysSinceEpoch > 16312";
    sqlQuery = "SELECT COUNT(*) FROM mytable WHERE DaysSinceEpoch > 16312";
    runQuery(pqlQuery, Collections.singletonList(sqlQuery));

    // Test other query forms with new added columns.
    JSONObject response;
    JSONObject groupByResult;
    pqlQuery = "SELECT SUM(NewAddedFloatMetric) FROM mytable GROUP BY NewAddedStringDimension";
    response = postQuery(pqlQuery);
    groupByResult = response.getJSONArray("aggregationResults").getJSONObject(0).getJSONArray("groupByResult")
            .getJSONObject(0);
    Assert.assertEquals(groupByResult.getInt("value"), 0);
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(0), "newAdded");
    pqlQuery = "SELECT SUM(NewAddedDoubleMetric) FROM mytable GROUP BY NewAddedIntDimension";
    response = postQuery(pqlQuery);
    groupByResult = response.getJSONArray("aggregationResults").getJSONObject(0).getJSONArray("groupByResult")
            .getJSONObject(0);
    Assert.assertEquals(groupByResult.getInt("value"), 0);
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(0), String.valueOf(Integer.MIN_VALUE));
    pqlQuery = "SELECT SUM(NewAddedIntMetric) FROM mytable GROUP BY NewAddedLongDimension";
    response = postQuery(pqlQuery);
    groupByResult = response.getJSONArray("aggregationResults").getJSONObject(0).getJSONArray("groupByResult")
            .getJSONObject(0);
    Assert.assertEquals(groupByResult.getInt("value"), TOTAL_DOCS);
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(0), String.valueOf(Long.MIN_VALUE));
    pqlQuery = "SELECT SUM(NewAddedIntMetric), SUM(NewAddedLongMetric), SUM(NewAddedFloatMetric), SUM(NewAddedDoubleMetric) "
            + "FROM mytable GROUP BY NewAddedIntDimension, NewAddedLongDimension, NewAddedFloatDimension, "
            + "NewAddedDoubleDimension, NewAddedStringDimension";
    response = postQuery(pqlQuery);
    JSONArray groupByResultArray = response.getJSONArray("aggregationResults");
    groupByResult = groupByResultArray.getJSONObject(0).getJSONArray("groupByResult").getJSONObject(0);
    Assert.assertEquals(groupByResult.getInt("value"), TOTAL_DOCS);
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(0), String.valueOf(Integer.MIN_VALUE));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(1), String.valueOf(Long.MIN_VALUE));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(2),
            String.valueOf(Float.NEGATIVE_INFINITY));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(3),
            String.valueOf(Double.NEGATIVE_INFINITY));
    groupByResult = groupByResultArray.getJSONObject(1).getJSONArray("groupByResult").getJSONObject(0);
    Assert.assertEquals(groupByResult.getInt("value"), TOTAL_DOCS);
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(0), String.valueOf(Integer.MIN_VALUE));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(1), String.valueOf(Long.MIN_VALUE));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(2),
            String.valueOf(Float.NEGATIVE_INFINITY));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(3),
            String.valueOf(Double.NEGATIVE_INFINITY));
    groupByResult = groupByResultArray.getJSONObject(2).getJSONArray("groupByResult").getJSONObject(0);
    Assert.assertEquals(groupByResult.getInt("value"), 0);
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(0), String.valueOf(Integer.MIN_VALUE));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(1), String.valueOf(Long.MIN_VALUE));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(2),
            String.valueOf(Float.NEGATIVE_INFINITY));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(3),
            String.valueOf(Double.NEGATIVE_INFINITY));
    groupByResult = groupByResultArray.getJSONObject(3).getJSONArray("groupByResult").getJSONObject(0);
    Assert.assertEquals(groupByResult.getInt("value"), 0);
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(0), String.valueOf(Integer.MIN_VALUE));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(1), String.valueOf(Long.MIN_VALUE));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(2),
            String.valueOf(Float.NEGATIVE_INFINITY));
    Assert.assertEquals(groupByResult.getJSONArray("group").getString(3),
            String.valueOf(Double.NEGATIVE_INFINITY));
    pqlQuery = "SELECT * FROM mytable";
    runQuery(pqlQuery, null);
}

From source file:gedi.util.ArrayUtils.java

public static double max(double[] a, int start, int end) {
    double re = Double.NEGATIVE_INFINITY;
    for (int i = start; i < end; i++)
        re = Math.max(re, a[i]);/*from  www. j  a va  2 s . co m*/
    return re;
}