Example usage for java.lang Double MIN_VALUE

List of usage examples for java.lang Double MIN_VALUE

Introduction

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

Prototype

double MIN_VALUE

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

Click Source Link

Document

A constant holding the smallest positive nonzero value of type double , 2-1074.

Usage

From source file:ffx.numerics.ModifiedBessel.java

/**
 * Returns Double.MAX_VALUE in place of Double.POSITIVE_INFINITY; Returns
 * Double.MIN_VALUE in place of Double.NEGATIVE_INFINITY
 *
 * @param x input parameter/*from  w w w  .  java  2  s . c om*/
 * @return exp(x)
 */
private static double eToThe(double x) {
    double res = exp(x);
    if (res == Double.POSITIVE_INFINITY) {
        return Double.MAX_VALUE;
    } else if (res == Double.NEGATIVE_INFINITY) {
        return Double.MIN_VALUE;
    }
    return res;
}

From source file:interpolation.Polyfit.java

public static ArrayList<Pair<Integer, Double>> loadsimple(final File file) {
    final ArrayList<Pair<Integer, Double>> points = new ArrayList<Pair<Integer, Double>>();
    final ArrayList<Pair<Integer, Double>> normalpoints = new ArrayList<Pair<Integer, Double>>();
    try {/*from  www  .  j a  va  2s. c om*/
        BufferedReader in = Util.openFileRead(file);

        while (in.ready()) {
            String line = in.readLine().trim();

            while (line.contains("\t\t"))
                line = line.replaceAll("\t\t", "\t");

            if (line.length() >= 3 && line.matches("[0-9].*")) {
                final String[] split = line.trim().split("\t");

                final int frame = (int) Double.parseDouble(split[0]);
                final double length = Double.parseDouble(split[1]);

                points.add(new ValuePair<Integer, Double>(frame, length));
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }

    double maxlength = Double.MIN_VALUE;
    for (Pair<Integer, Double> point : points) {

        double length = point.getB();
        if (length > maxlength)
            maxlength = length;
    }
    for (Pair<Integer, Double> point : points) {
        Pair<Integer, Double> newpoint = new ValuePair<Integer, Double>(point.getA(), point.getB());
        normalpoints.add(newpoint);
    }

    return normalpoints;
}

From source file:co.turnus.profiling.util.ProfilingWeightsEstimator.java

public ProfilingWeights estimate(ProfilingData data) {
    ProfilingFactory f = ProfilingFactory.eINSTANCE;
    ProfilingWeights netWeights = f.createProfilingWeights();
    netWeights.setNetwork(data.getNetwork());

    Table<Actor, Action, ActionProfilingData> table = data.asTable();
    double networkCost = estimateNetworkCost(data);

    for (Actor actor : table.rowKeySet()) {
        ActorProfilingWeights actorWeights = f.createActorProfilingWeights();
        actorWeights.setActor(actor);//  w  w  w.  j ava  2  s . c  o m
        double actorCost = 0;

        for (Entry<Action, ActionProfilingData> actionEntry : table.row(actor).entrySet()) {

            ActionProfilingData aData = actionEntry.getValue();
            ActionProfilingWeights actionWeights = f.createActionProfilingWeights();
            actionWeights.setAction(actionEntry.getKey());

            EMap<Operator, StatisticalData> opsMap = aData.getOperatorsCall();
            int samples = opsMap.size();

            double mean = 0;
            double min = 0;
            double max = 0;
            double sum = 0;

            if (samples > 0) {
                min = Double.MAX_VALUE;
                max = Double.MIN_VALUE;

                for (Entry<Operator, StatisticalData> entry : opsMap.entrySet()) {
                    double c = operatorsWeightMap.get(entry.getKey());
                    sum += c * entry.getValue().getMean();
                    min = FastMath.min(min, c * entry.getValue().getMin());
                    max = FastMath.max(max, c * entry.getValue().getMax());
                }

                mean = sum / samples;
            }

            // set clock cycles
            actionWeights.setClockcycles(mean);
            actionWeights.setClockcyclesMin(min);
            actionWeights.setClockcyclesMax(max);

            // set workload
            actionWeights.setWorkload(sum / networkCost * 100);
            actorCost += sum;

            // finally, add it to the list
            actorWeights.getActionsWeights().add(actionWeights);
        }

        // set workload
        actorWeights.setWorkload(actorCost / networkCost * 100);

        // finally, add it to the list
        netWeights.getActorsWeights().add(actorWeights);

    }

    return netWeights;
}

From source file:org.graphstream.algorithm.Spectrum.java

public double getLargestEigenvalue() {
    double[] values = decomposition.getRealEigenvalues();
    double max = Double.MIN_VALUE;

    if (values != null)
        for (int i = 0; i < values.length; i++)
            max = Math.max(max, values[i]);

    return max;//from w  w w. j  ava2 s .c om
}

From source file:org.um.feri.ears.problems.Task.java

public Task(EnumStopCriteria stop, int eval, long allowedTime, int maxIterations, double epsilon, Problem p,
        int precisonOfRealNumbers) {
    precisionOfRealNumbersInDecimalPlaces = precisonOfRealNumbers;
    stopCriteria = stop;/*  w  ww .ja  va2s .  com*/
    maxEvaluations = eval;
    numberOfEvaluations = 0;
    this.epsilon = epsilon;
    this.maxIterations = maxIterations;
    isStop = false;
    isGlobal = false;
    this.p = p;
    this.allowedCPUTime = TimeUnit.MILLISECONDS.toNanos(allowedTime);

    // set initial best eval
    bestEval = p.isMinimum() ? Double.MAX_VALUE : Double.MIN_VALUE;
}

From source file:org.stockchart.series.SeriesBase.java

public double[] getMaxMinPrice2(int startIndex, int endIndex) {
    double max = Double.MIN_VALUE;
    double min = Double.MAX_VALUE;

    for (int i = startIndex; i <= endIndex; i++) {
        AbstractPoint p = getPointAt(i);

        double[] maxMin = p.getMaxMin();
        if (maxMin[0] > max)
            max = maxMin[0];// w w  w  . j a v  a 2 s.  c o m

        if (maxMin[1] < min)
            min = maxMin[1];
    }

    return new double[] { max, min };
}

From source file:co.turnus.trace.scheduler.devs.DevsTraceScheduler.java

public void run() {
    if (simulationId == null) {
        throw new TurnusRuntimeException("DEVS Trace scheduler not configured!");
    }/*from w w w . ja  va  2 s .c  o  m*/

    TurnusLogger.info("Starting simulation \"" + simulationId + "\"");

    // set remaining parameters and variables
    Simulator sim = new Simulator(model);
    double t = sim.nextEventTime();
    double simTimer = -Double.MIN_VALUE;
    SimpleTimer cpuClock = new SimpleTimer();
    cpuClock.reset();

    // simulate
    while (t < Double.MAX_VALUE) {

        if (exportGantt) {
            long scaledT = getGanttTime(t);
            if (scaledT != scaledTime) {
                scaledTime = scaledT;
                logStatus(scaledTime);
            }
        }

        simTimer = t;

        sim.execNextEvent();
        t = sim.nextEventTime();
    }

    logStatus(getGanttTime(simTimer));

    boolean deadlock = checkDeadlock();

    TurnusLogger.info("Simulation \"%s\" done (deadlock: %b)", simulationId, deadlock);
    TurnusLogger.info("Throughput: " + simTimer);
    TurnusLogger.info("CPU timer : " + cpuClock.getElapsedTime());

    if (exportGantt) {
        TurnusLogger.info("Finalizing gantt chart...");
        ganttBuilder.end(getGanttTime(simTimer));
    }
}

From source file:com.sillelien.dollar.api.types.DollarInfinity.java

@Override
public var $as(@NotNull Type type) {
    if (type.equals(Type.BOOLEAN)) {
        return DollarStatic.$(true);
    } else if (type.equals(Type.STRING)) {
        return DollarStatic.$(positive ? "infinity" : "-infinity");
    } else if (type.equals(Type.LIST)) {
        return DollarStatic.$(Arrays.asList(this));
    } else if (type.equals(Type.MAP)) {
        return DollarStatic.$("value", this);
    } else if (type.equals(Type.DECIMAL)) {
        return DollarStatic.$(positive ? Double.MAX_VALUE : Double.MIN_VALUE);
    } else if (type.equals(Type.INTEGER)) {
        return DollarStatic.$(positive ? Long.MAX_VALUE : Long.MIN_VALUE);
    } else if (type.equals(Type.VOID)) {
        return $void();
    } else if (type.equals(Type.DATE)) {
        return this;
    } else if (type.equals(Type.RANGE)) {
        return DollarFactory.fromValue(new Range($(0), $(0)));
    } else {//from  ww  w. j  a va 2 s. c o  m
        return DollarFactory.failure(ErrorType.INVALID_CAST, type.toString(), false);
    }
}

From source file:com.thalespf.dip.DeblurringTest.java

public static void normalizeToMaxAbsValue(Complex[] data, int width, int height, double value) {
    double max = Double.MIN_VALUE;

    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            Complex c = data[x + y * width];
            double abs = Math.sqrt(c.getReal() * c.getReal() + c.getImaginary() * c.getImaginary());
            max = Math.max(max, abs);
        }//  w  ww .jav a  2s .  c o m
    }

    for (int x = 0; x < data.length; x++) {
        data[x] = data[x].multiply(value / max);
    }
}

From source file:org.protempa.proposition.value.InequalityNumberValue.java

@Override
public double doubleValue() {
    if (comp == ValueComparator.EQUAL_TO) {
        return val.doubleValue();
    } else if (comp == ValueComparator.LESS_THAN) {
        return val.doubleValue() - Double.MIN_VALUE;
    } else {/*from  w w  w . j a  v a  2s  .  c o m*/
        return val.doubleValue() + Double.MIN_VALUE;
    }
}