List of usage examples for java.lang Float isFinite
public static boolean isFinite(float f)
From source file:com.facebook.presto.operator.aggregation.TestFloatRegrSlopeAggregation.java
private void testNonTrivialAggregation(Float[] y, Float[] x) { SimpleRegression regression = new SimpleRegression(); for (int i = 0; i < x.length; i++) { regression.addData(x[i], y[i]);/*from www . j av a 2s.com*/ } float expected = (float) regression.getSlope(); checkArgument(Float.isFinite(expected) && expected != 0.0f, "Expected result is trivial"); testAggregation(expected, createFloatsBlock(y), createFloatsBlock(x)); }
From source file:com.facebook.presto.operator.aggregation.TestRealRegrSlopeAggregation.java
private void testNonTrivialAggregation(Float[] y, Float[] x) { SimpleRegression regression = new SimpleRegression(); for (int i = 0; i < x.length; i++) { regression.addData(x[i], y[i]);/*www.j ava 2 s. co m*/ } float expected = (float) regression.getSlope(); checkArgument(Float.isFinite(expected) && expected != 0.0f, "Expected result is trivial"); testAggregation(expected, createBlockOfReals(y), createBlockOfReals(x)); }
From source file:com.facebook.presto.operator.aggregation.TestFloatRegrInterceptAggregation.java
private void testNonTrivialAggregation(Float[] y, Float[] x) { SimpleRegression regression = new SimpleRegression(); for (int i = 0; i < x.length; i++) { regression.addData(x[i], y[i]);//from w w w .ja v a2s .c o m } float expected = (float) regression.getIntercept(); checkArgument(Float.isFinite(expected) && expected != 0.f, "Expected result is trivial"); testAggregation(expected, createFloatsBlock(y), createFloatsBlock(x)); }
From source file:com.facebook.presto.operator.aggregation.TestRealRegrInterceptAggregation.java
private void testNonTrivialAggregation(Float[] y, Float[] x) { SimpleRegression regression = new SimpleRegression(); for (int i = 0; i < x.length; i++) { regression.addData(x[i], y[i]);//from ww w.j a v a 2s . c om } float expected = (float) regression.getIntercept(); checkArgument(Float.isFinite(expected) && expected != 0.f, "Expected result is trivial"); testAggregation(expected, createBlockOfReals(y), createBlockOfReals(x)); }
From source file:ru.histone.v2.evaluator.EvalUtils.java
public static boolean isNumeric(StringEvalNode evalNode) { try {/*from w ww . ja va2s . c o m*/ final Float value = parseFloat(evalNode.getValue()); return !Float.isNaN(value) && Float.isFinite(value); } catch (NumberFormatException e) { return false; } }
From source file:ru.histone.v2.rtti.RunTimeTypeInfo.java
public HistoneType getType(EvalNode node) { if (node == null) { throw new NullPointerException(); }//from w w w . jav a2 s .c om if (node instanceof NullEvalNode) { return T_NULL; } else if (node instanceof FloatEvalNode) { final Float valueFloat = ((FloatEvalNode) node).getValue(); if (valueFloat == null || Float.isNaN(valueFloat) || !Float.isFinite(valueFloat)) { return T_UNDEFINED; } return T_NUMBER; } else if (node instanceof LongEvalNode) { return T_NUMBER; } else if (node instanceof MapEvalNode) { return T_ARRAY; } else if (node instanceof BooleanEvalNode) { return T_BOOLEAN; } else if (node instanceof StringEvalNode) { return T_STRING; } else if (node instanceof EmptyEvalNode) { return T_UNDEFINED; } else if (node instanceof RegexEvalNode) { return T_REGEXP; } else if (node instanceof MacroEvalNode) { return T_MACRO; } else if (node instanceof GlobalEvalNode) { return T_GLOBAL; } throw new NotImplementedException(node.toString()); }