List of usage examples for java.lang Double MIN_VALUE
double MIN_VALUE
To view the source code for java.lang Double MIN_VALUE.
Click Source Link
From source file:org.ballerinalang.stdlib.io.data.DataInputOutputTest.java
@DataProvider(name = "DoubleValues") public static Object[][] doubleValues() { return new Object[][] { { 0.0f, BIT_32 }, { 0.0f, BIT_64 }, { -1.0f, BIT_32 }, { -1.0f, BIT_64 }, { Float.MIN_VALUE, BIT_32 }, { Float.MIN_VALUE, BIT_64 }, { Float.MAX_VALUE, BIT_32 }, { Float.MAX_VALUE, BIT_64 }, { Double.MIN_VALUE, BIT_64 }, { Double.MAX_VALUE, BIT_64 } }; }
From source file:com.hurence.logisland.serializer.KuraProtobufSerializer.java
private Position buildFromProtoBuf(final KuraPayloadProto.KuraPayload.KuraPosition protoPosition) { final Position position = Position.from( protoPosition.hasAltitude() ? protoPosition.getAltitude() : Double.MIN_VALUE, protoPosition.hasHeading() ? protoPosition.getHeading() : Double.MIN_VALUE, protoPosition.hasLatitude() ? protoPosition.getLatitude() : Double.MIN_VALUE, protoPosition.hasLongitude() ? protoPosition.getLongitude() : Double.MIN_VALUE, protoPosition.hasPrecision() ? protoPosition.getPrecision() : Double.MIN_VALUE, protoPosition.hasSatellites() ? protoPosition.getSatellites() : Integer.MIN_VALUE, protoPosition.hasStatus() ? protoPosition.getStatus() : Integer.MIN_VALUE, protoPosition.hasSpeed() ? protoPosition.getSpeed() : Double.MIN_VALUE, protoPosition.hasTimestamp() ? new Date(protoPosition.getTimestamp()) : new Date(0)); return position; }
From source file:org.openmicroscopy.shoola.util.ui.NumericalTextField.java
/** * Sets to <code>true</code> if negative values are accepted, * to <code>false</code> otherwise. * * @param negativeAccepted The value to set. *///from www. j av a 2s . c o m public void setNegativeAccepted(boolean negativeAccepted) { this.negativeAccepted = negativeAccepted; if (negativeAccepted) { accepted += "-"; double min = document.getMinimum(); if (min >= 0) { if (numberType == null || Integer.class.equals(numberType)) min = Integer.MIN_VALUE; else if (Long.class.equals(numberType)) min = Long.MIN_VALUE; else if (Float.class.equals(numberType)) min = Float.MIN_VALUE; else min = Double.MIN_VALUE; document.setMinimum(min); } } }
From source file:eu.juniper.MonitoringLib.java
/** * Retrieving data of a given metric with condition of another metric * /*from ww w.j a v a2s .c om*/ * @param appId Application ID * @param metricGet Metric which values are to be obtained * @param metricCond Metric which values are conditions * @param metricCondValue MetricCond value as positive filter for metricGet values * @return ArrayList of all metrics collected for the given application * @throws ParseException * @throws FileNotFoundException * @throws IOException */ public ArrayList<String> getAppMetricsValuesByCondition(String appId, String metricGet, String metricCond, String metricCondValue) throws ParseException, FileNotFoundException, IOException { ArrayList<String> metricGetList = new ArrayList<String>(); ArrayList<String> metricCondList = new ArrayList<String>(); ArrayList<String> metricGetListSelected = new ArrayList<String>(); ArrayList<Double> metricGetListSelectedNum = new ArrayList<Double>(); String id = appId; String returnString = getResponse(monitoringServiceURL + id); metricGetList = parseJsonByTag(metricGetList, returnString, metricGet); metricCondList = parseJsonByTag(metricCondList, returnString, metricCond); iValue = 0; count = 0; min = Double.MAX_VALUE; max = Double.MIN_VALUE; avg = 0; sum = 0; System.out.println("metricCond = " + metricCond + "; metricCondValue = " + metricCondValue); for (int i = 0; i < metricGetList.size(); i++) { if (!metricGetList.get(i).equals("null")) { if (metricCondList.get(i).equals(metricCondValue) || metricCondList == null || metricCondValue == null) { metricGetListSelected.add(metricGetList.get(i)); iValue = new Double(metricGetList.get(i)); count++; if (iValue < min) min = iValue; if (iValue > max) max = iValue; sum = sum + iValue; metricGetListSelectedNum.add(iValue); } } avg = sum / count; } return metricGetListSelected; }
From source file:org.jfree.data.statistics.HistogramDatasetTest.java
/** * Some checks for bug 1553088. An IndexOutOfBoundsException is thrown * when a data value is *very* close to the upper limit of the last bin. */// www. ja v a 2 s . c om @Test public void test1553088() { double[] values = { -1.0, 0.0, -Double.MIN_VALUE, 3.0 }; HistogramDataset d = new HistogramDataset(); d.addSeries("S1", values, 2, -1.0, 0.0); assertEquals(-1.0, d.getStartXValue(0, 0), EPSILON); assertEquals(-0.5, d.getEndXValue(0, 0), EPSILON); assertEquals(1.0, d.getYValue(0, 0), EPSILON); assertEquals(-0.5, d.getStartXValue(0, 1), EPSILON); assertEquals(0.0, d.getEndXValue(0, 1), EPSILON); assertEquals(3.0, d.getYValue(0, 1), EPSILON); }
From source file:org.deidentifier.arx.criteria.EDDifferentialPrivacy.java
/** * Calculates delta/*from w ww .jav a 2 s. com*/ * @param k * @param epsilon * @param beta * @return */ private double calculateDelta(int k, double epsilon, double beta) { double gamma = calculateGamma(epsilon, beta); int n_m = (int) Math.ceil((double) k / gamma - 1.0d); double delta = Double.MIN_VALUE; double bound = Double.MAX_VALUE; for (int n = n_m; delta < bound; ++n) { delta = Math.max(delta, calculateA(n, epsilon, beta)); bound = calculateC(n, epsilon, beta); } return delta; }
From source file:com.velonuboso.made.core.common.Helper.java
/** * returns the maximun value os a given array and size. * * @param data the array of data/*from w ww. j av a 2 s . c om*/ * @param length the searchable length * @return the maximum value. Double.MIN_VALUE on zero length */ public static double getMax(final double[] data, int length) { if (length > data.length) { length = data.length; } if (length == 0) { return Double.MIN_VALUE; } double max = data[0]; for (int i = 1; i < length; i++) { double a = data[i]; if (a > max) { max = a; } } return max; }
From source file:ffx.numerics.fft.Complex3DCuda.java
/** * <p>// ww w. java 2 s .co m * main</p> * * @param args an array of {@link java.lang.String} objects. * @throws java.lang.Exception if any. */ public static void main(String[] args) throws Exception { int dimNotFinal = 64; int reps = 10; if (args != null) { try { dimNotFinal = Integer.parseInt(args[0]); if (dimNotFinal < 1) { dimNotFinal = 64; } reps = Integer.parseInt(args[1]); if (reps < 1) { reps = 10; } } catch (Exception e) { } } final int dim = dimNotFinal; System.out.println(String.format( " Initializing a %d cubed grid.\n" + " The best timing out of %d repititions will be used.", dim, reps)); final int dimCubed = dim * dim * dim; /** * Create an array to save the initial input and result. */ double orig[] = new double[dimCubed]; double answer[] = new double[dimCubed]; double data[] = new double[dimCubed * 2]; double recip[] = new double[dimCubed]; Random random = new Random(1); int index = 0; for (int k = 0; k < dim; k++) { for (int j = 0; j < dim; j++) { for (int i = 0; i < dim; i++) { orig[index] = random.nextDouble(); //recip[index] = orig[index]; recip[index] = 1.0; index++; } } } Complex3D complex3D = new Complex3D(dim, dim, dim); Complex3DParallel complex3DParallel = new Complex3DParallel(dim, dim, dim, new ParallelTeam(), IntegerSchedule.fixed()); complex3DParallel.setRecip(recip); Complex3DCuda complex3DCUDA = new Complex3DCuda(dim, dim, dim); Thread cudaThread = new Thread(complex3DCUDA); cudaThread.setPriority(Thread.MAX_PRIORITY); cudaThread.start(); complex3DCUDA.setRecip(recip); double toSeconds = 0.000000001; long parTime = Long.MAX_VALUE; long seqTime = Long.MAX_VALUE; long clTime = Long.MAX_VALUE; complex3D.setRecip(recip); for (int i = 0; i < reps; i++) { for (int j = 0; j < dimCubed; j++) { data[j * 2] = orig[j]; data[j * 2 + 1] = 0.0; } long time = System.nanoTime(); //complex3D.convolution(data); complex3D.fft(data); time = (System.nanoTime() - time); System.out.println(String.format(" %2d Sequential: %8.3f", i + 1, toSeconds * time)); if (time < seqTime) { seqTime = time; } } for (int j = 0; j < dimCubed; j++) { answer[j] = data[j * 2]; } for (int i = 0; i < reps; i++) { for (int j = 0; j < dimCubed; j++) { data[j * 2] = orig[j]; data[j * 2 + 1] = 0.0; } long time = System.nanoTime(); //complex3DParallel.convolution(data); complex3DParallel.fft(data); time = (System.nanoTime() - time); System.out.println(String.format(" %2d Parallel: %8.3f", i + 1, toSeconds * time)); if (time < parTime) { parTime = time; } } double maxError = Double.MIN_VALUE; double rmse = 0.0; for (int i = 0; i < dimCubed; i++) { double error = Math.abs(answer[i] - data[2 * i]); if (error > maxError) { maxError = error; } rmse += error * error; } rmse /= dimCubed; rmse = Math.sqrt(rmse); logger.info(String.format(" Parallel RMSE: %12.10f, Max: %12.10f", rmse, maxError)); DoubleBuffer cudaBuffer = complex3DCUDA.getDoubleBuffer(); for (int i = 0; i < reps; i++) { for (int j = 0; j < dimCubed; j++) { // data[j * 2] = orig[j]; // data[j * 2 + 1] = 0.0; cudaBuffer.put(j * 2, orig[j]); cudaBuffer.put(j * 2 + 1, 0.0); } long time = System.nanoTime(); //complex3DCUDA.convolution(data); complex3DCUDA.fft(data); time = (System.nanoTime() - time); System.out.println(String.format(" %2d CUDA: %8.3f", i + 1, toSeconds * time)); if (time < clTime) { clTime = time; } } maxError = Double.MIN_VALUE; double avg = 0.0; rmse = 0.0; for (int i = 0; i < dimCubed; i++) { double error = Math.abs(answer[i] - cudaBuffer.get(2 * i)); // double error = Math.abs(answer[i] / dimCubed - data[2 * i]); avg += error; if (error > maxError) { maxError = error; } rmse += error * error; } rmse /= dimCubed; avg /= dimCubed; rmse = Math.sqrt(rmse); logger.info(String.format(" CUDA RMSE: %12.10f, Max: %12.10f, Avg: %12.10f", rmse, maxError, avg)); complex3DCUDA.free(); complex3DCUDA = null; System.out.println(String.format(" Best Sequential Time: %8.3f", toSeconds * seqTime)); System.out.println(String.format(" Best Parallel Time: %8.3f", toSeconds * parTime)); System.out.println(String.format(" Best CUDA Time: %8.3f", toSeconds * clTime)); System.out.println(String.format(" Parallel Speedup: %15.5f", (double) seqTime / parTime)); System.out.println(String.format(" CUDA Speedup: %15.5f", (double) seqTime / clTime)); }
From source file:eu.qualimaster.monitoring.profiling.predictors.Kalman.java
/** * This method predicts the value of a time line one or multiple time step(s) ahead of the * last (via update) given value.//from w ww . j a va 2 s . c o m * @param steps Number of times steps to predict. * * @return Predictions for the last time step ahead as {@link Double} or Double.MIN_VALUE if the prediction failed. */ public double predict(int steps) { double prediction = Double.MIN_VALUE; if (lastUpdated != Long.MIN_VALUE) { try { if (steps > 0) { // Gap-Handling /* * As long as the time stamp of the last update and the time step to predict * are more than an allowed gap apart from each other ... */ long oldLastUpdated = lastUpdated; double oldLastUpdate = lastUpdate; boolean gap = false; while (((System.currentTimeMillis() + (steps - 1) * 1000) - (lastUpdated * 1000)) > allowedGap) { /* * ... simulate updates using the last prediction. * If an update must be simulated and there is no predicted value * to use instead of the measurement, 'defaultMeasurenment' value is used for the update. */ update(lastUpdated + 1, prediction == Double.MIN_VALUE ? lastUpdate : defaultMeasurement); prediction = predict(0); gap = true; } // Reset values overwritten by gap handling to make predict-updates non-persistent. if (gap) { lastUpdated = oldLastUpdated; lastUpdate = oldLastUpdate; } } filter.predict(controlVector); prediction = filter.getStateEstimation()[2]; predictedSinceUpdate = true; } catch (DimensionMismatchException e) { LogManager.getLogger(Kalman.class).error(e.getMessage(), e); prediction = Double.MIN_VALUE; } } else { System.err.println("Warning: Prediction should only be called after at least one update-call!"); } return prediction; }
From source file:dmh.kuebiko.view.NoteStackFrame.java
/** * Initialize the contents of the frame. The contents of this method was * generated by Window Builder Pro.// w w w . j a va 2s . c om */ private void initialize() { setTitle(buildTitle()); setBounds(100, 100, 450, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 0, 0, 0, 0 }; gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 }; gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE }; gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE }; getContentPane().setLayout(gridBagLayout); horizontalStrut = Box.createHorizontalStrut(20); horizontalStrut.setMinimumSize(new Dimension(3, 0)); horizontalStrut.setPreferredSize(new Dimension(3, 0)); horizontalStrut.setSize(new Dimension(3, 0)); GridBagConstraints gbc_horizontalStrut = new GridBagConstraints(); gbc_horizontalStrut.insets = new Insets(0, 0, 0, 0); gbc_horizontalStrut.gridx = 0; gbc_horizontalStrut.gridy = 0; getContentPane().add(horizontalStrut, gbc_horizontalStrut); GridBagConstraints gbc_stateImageLabel = new GridBagConstraints(); gbc_stateImageLabel.insets = new Insets(0, 0, 0, 0); gbc_stateImageLabel.anchor = GridBagConstraints.EAST; gbc_stateImageLabel.gridx = 1; gbc_stateImageLabel.gridy = 0; stateImageLabel.setBorder(null); stateImageLabel.setHorizontalAlignment(SwingConstants.CENTER); getContentPane().add(stateImageLabel, gbc_stateImageLabel); searchText = new JTextField(); GridBagConstraints gbc_searchText = new GridBagConstraints(); gbc_searchText.insets = new Insets(0, 0, 0, 0); gbc_searchText.fill = GridBagConstraints.HORIZONTAL; gbc_searchText.gridx = 2; gbc_searchText.gridy = 0; getContentPane().add(searchText, gbc_searchText); searchText.setColumns(10); if (SystemUtils.IS_OS_MAC_OSX) { // Make the text field look like the standard Mac OS X search // box control. searchText.putClientProperty("JTextField.variant", "search"); } splitPane = new JSplitPane(); splitPane.setBorder(null); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); GridBagConstraints gbc_splitPane = new GridBagConstraints(); gbc_splitPane.gridwidth = 3; gbc_splitPane.gridheight = 4; gbc_splitPane.insets = new Insets(0, 0, 0, 0); gbc_splitPane.fill = GridBagConstraints.BOTH; gbc_splitPane.gridx = 0; gbc_splitPane.gridy = 1; getContentPane().add(splitPane, gbc_splitPane); notePanel = new NotePanel(); notePanel.getHuxleyUiManager().setOnTextChangeCallback(new Callback<Boolean>() { @Override public void callback(Boolean input) { toggleUnsavedChangeIndicator(input); } }); splitPane.setRightComponent(notePanel); noteTableScroll = new JScrollPane(); noteTableScroll.setMinimumSize(new Dimension(23, 100)); splitPane.setLeftComponent(noteTableScroll); noteTable = newNoteTable(); noteTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); noteTableScroll.setViewportView(noteTable); ActionObserverUtil.registerEnMass(actionMngr, observable, notePanel.getHuxleyUiManager().getTextAction(TextAction.INSERT_DATE)); insertDateMenuItem = new JMenuItem(actionMngr.getAction(InsertDynamicTextAction.class)); insertDateMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.SHIFT_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); textMenu.add(insertDateMenuItem); }