List of usage examples for java.lang Double MIN_NORMAL
double MIN_NORMAL
To view the source code for java.lang Double MIN_NORMAL.
Click Source Link
From source file:org.apache.nifi.util.orc.TestOrcUtils.java
@Test public void test_putRowToBatch_optional_union() { final SchemaBuilder.FieldAssembler<Schema> builder = SchemaBuilder.record("testRecord") .namespace("any.data").fields(); builder.name("union").type().unionOf().nullType().and().floatType().endUnion().noDefault(); Schema testSchema = builder.endRecord(); GenericData.Record row = new GenericData.Record(testSchema); row.put("union", 2.0f); TypeDescription orcSchema = TypeDescription.createFloat(); VectorizedRowBatch batch = orcSchema.createRowBatch(); batch.ensureSize(2);/* w w w. j a v a 2 s. co m*/ OrcUtils.putToRowBatch(batch.cols[0], new MutableInt(0), 0, testSchema.getField("union").schema(), row.get("union")); assertTrue(batch.cols[0] instanceof DoubleColumnVector); DoubleColumnVector union = ((DoubleColumnVector) batch.cols[0]); // verify the value is in the union field of type 'int' assertEquals(2.0, union.vector[0], Double.MIN_NORMAL); }
From source file:org.calrissian.accumulorecipes.metricsstore.ext.stats.impl.AccumuloStatsMetricStoreTest.java
private static void checkStats(CloseableIterable<Stats> actual, int expectedNum, int expectedVal) { List<Stats> actualList = newArrayList(autoClose(actual)); assertEquals(expectedNum, actualList.size()); for (Stats stat : actualList) { assertEquals("group", stat.getGroup()); assertEquals("type", stat.getType()); assertEquals("name", stat.getName()); assertEquals("", stat.getVisibility()); assertEquals(1, stat.getMin());//from w w w .jav a2s .com assertEquals(1, stat.getMax()); assertEquals(expectedVal, stat.getCount()); assertEquals(expectedVal, stat.getSum()); assertEquals(1.0, stat.getMean(), Double.MIN_NORMAL); assertEquals(0.0, stat.getStdDev(true), Double.MIN_NORMAL); } }
From source file:org.calrissian.accumulorecipes.metricsstore.ext.stats.impl.AccumuloStatsMetricStoreTest.java
@Test public void testStatisticAccuracy() throws Exception { AccumuloStatsMetricStore metricStore = new AccumuloStatsMetricStore(getConnector()); Random random = new Random(); List<Long> sampleData = asList((long) random.nextInt(10000), (long) random.nextInt(10000), (long) random.nextInt(10000), (long) random.nextInt(10000), (long) random.nextInt(10000)); //use commons math as a SummaryStatistics sumStats = new SummaryStatistics(); for (long num : sampleData) sumStats.addValue(num);/*from w w w .j a va 2s .co m*/ final long timestamp = System.currentTimeMillis(); Iterable<Metric> testData = transform(sampleData, new Function<Long, Metric>() { @Override public Metric apply(Long num) { return new Metric(timestamp, "group", "type", "name", "", num); } }); metricStore.save(testData); List<Stats> stats = newArrayList(metricStore.queryStats(new Date(0), new Date(), "group", "type", "name", MetricTimeUnit.MINUTES, new Auths())); assertEquals(1, stats.size()); Stats stat = stats.get(0); assertEquals(sumStats.getMin(), stat.getMin(), Double.MIN_NORMAL); assertEquals(sumStats.getMax(), stat.getMax(), Double.MIN_NORMAL); assertEquals(sumStats.getSum(), stat.getSum(), Double.MIN_NORMAL); assertEquals(sumStats.getN(), stat.getCount(), Double.MIN_NORMAL); assertEquals(sumStats.getMean(), stat.getMean(), Double.MIN_NORMAL); assertEquals(sumStats.getPopulationVariance(), stat.getVariance(), 0.00000001); assertEquals(sumStats.getVariance(), stat.getVariance(true), 0.00000001); assertEquals(sqrt(sumStats.getPopulationVariance()), stat.getStdDev(), 0.00000001); assertEquals(sumStats.getStandardDeviation(), stat.getStdDev(true), 0.00000001); }
From source file:org.kalypsodeegree_impl.model.geometry.GM_Envelope_Impl.java
/** * Checks if this point is completly equal to the submitted geometry * /* www . j av a 2 s . co m*/ * @param exact * If <code>false</code>, the positions are compared by {@link GM_Position#equals(Object, false)} * @see GM_Position#equals(Object, boolean) */ @Override public boolean equals(final Object other, final boolean exact) { if (other == null || !(other instanceof GM_Envelope_Impl)) return false; final GM_Envelope otherEnvelope = (GM_Envelope) other; if (!ObjectUtils.equals(m_coordinateSystem, otherEnvelope.getCoordinateSystem())) return false; final double mute = exact ? Double.MIN_NORMAL : GM_Position.MUTE; if (Math.abs(m_minX - otherEnvelope.getMinX()) > mute) return false; if (Math.abs(m_minY - otherEnvelope.getMinY()) > mute) return false; if (Math.abs(m_maxX - otherEnvelope.getMaxX()) > mute) return false; if (Math.abs(m_maxY - otherEnvelope.getMaxY()) > mute) return false; return true; }
From source file:uk.ac.diamond.scisoft.analysis.fitting.functions.AFunction.java
/** * @param abs//from w ww . j a va2 s .c o m * @param rel * @param param * @param values * @return partial derivative up to tolerances */ protected double calcNumericalDerivative(double abs, double rel, IParameter param, double... values) { double delta = DELTA; double previous = numericalDerivative(delta, param, values); double aprevious = Math.abs(previous); double current = 0; double acurrent = 0; while (delta > Double.MIN_NORMAL) { delta *= DELTA_FACTOR; current = numericalDerivative(delta, param, values); acurrent = Math.abs(current); if (Math.abs(current - previous) <= abs + rel * Math.max(acurrent, aprevious)) break; previous = current; aprevious = acurrent; } return current; }
From source file:uk.ac.diamond.scisoft.analysis.fitting.functions.FanoGaussian.java
protected void calcCachedParameters() { r = getParameterValue(POSN);/* w w w . j a v a2 s .c om*/ double l = getParameterValue(FWHM) / 2.; double sigma = getParameterValue(FWHMG) / CONST; if (sigma < 5 * Double.MIN_NORMAL) { // fix Lorentzian limit sigma = 10 * Double.MIN_NORMAL; } fr = Math.sqrt(0.5) / sigma; zi = fr * l; ft = fr * getParameterValue(AREA) / Math.sqrt(Math.PI); double q = getParameterValue(FANO); fq = 2 * q / (q * q - 1); setDirty(false); }
From source file:uk.ac.diamond.scisoft.analysis.fitting.functions.Voigt.java
@Override protected void calcCachedParameters() { r = getParameterValue(POSN);// w w w .ja v a 2 s .c om double l = getParameterValue(FWHM) / 2.; double sigma = getParameterValue(FWHMG) / CONST; if (sigma < 5 * Double.MIN_NORMAL) { // fix Lorentzian limit sigma = 10 * Double.MIN_NORMAL; } fr = Math.sqrt(0.5) / sigma; zi = fr * l; ft = fr * getParameterValue(AREA) / Math.sqrt(Math.PI); height = ft * Faddeeva.erfcx(zi); setDirty(false); }
From source file:umich.ms.batmass.gui.viewers.map2d.components.BaseMap2D.java
/** */ private void initErrorFillingState() { this.totalIntensityMax = Double.MIN_NORMAL; //TODO: why did I do that MIN_NORMAL instead of zero??? don't remember this.totalIntensityMin = 0; this.totalIntensityMinNonZero = 0; }
From source file:umich.ms.batmass.gui.viewers.map2d.components.BaseMap2D.java
private void findMinMaxIntensities() { double d;/*w w w. j a v a2s. com*/ totalIntensityMax = Double.MIN_NORMAL; totalIntensityMin = Double.POSITIVE_INFINITY; totalIntensityMinNonZero = Double.POSITIVE_INFINITY; for (int i = 0; i < map.length; i++) { double[] ds = map[i]; for (int j = 0; j < ds.length; j++) { d = ds[j]; if (d > totalIntensityMax) totalIntensityMax = d; if (d < totalIntensityMin) totalIntensityMin = d; if (d > 0d && d < totalIntensityMinNonZero) totalIntensityMinNonZero = d; } } }