List of usage examples for java.lang Double NaN
double NaN
To view the source code for java.lang Double NaN.
Click Source Link
From source file:Util.java
public static final double[] interpLinear(double[] x, double[] y, double[] xi) throws IllegalArgumentException { if (x.length != y.length) { throw new IllegalArgumentException("X and Y must be the same length"); }//from w w w. j a v a 2 s . c o m if (x.length == 1) { throw new IllegalArgumentException("X must contain more than one value"); } double[] dx = new double[x.length - 1]; double[] dy = new double[x.length - 1]; double[] slope = new double[x.length - 1]; double[] intercept = new double[x.length - 1]; // Calculate the line equation (i.e. slope and intercept) between each point for (int i = 0; i < x.length - 1; i++) { dx[i] = x[i + 1] - x[i]; if (dx[i] == 0) { throw new IllegalArgumentException("X must be montotonic. A duplicate " + "x-value was found"); } if (dx[i] < 0) { throw new IllegalArgumentException("X must be sorted"); } dy[i] = y[i + 1] - y[i]; slope[i] = dy[i] / dx[i]; intercept[i] = y[i] - x[i] * slope[i]; } // Perform the interpolation here double[] yi = new double[xi.length]; for (int i = 0; i < xi.length; i++) { if ((xi[i] > x[x.length - 1]) || (xi[i] < x[0])) { yi[i] = Double.NaN; } else { int loc = Arrays.binarySearch(x, xi[i]); if (loc < -1) { loc = -loc - 2; yi[i] = slope[loc] * xi[i] + intercept[loc]; } else { yi[i] = y[loc]; } } } return yi; }
From source file:com.rapidminer.tools.expression.internal.function.trigonometric.ArcHyperbolicSine.java
@Override protected double compute(double value) { return Double.isNaN(value) ? Double.NaN : FastMath.asinh(value); }
From source file:com.rapidminer.tools.expression.internal.function.trigonometric.ArcHyperbolicCosine.java
@Override protected double compute(double value) { return Double.isNaN(value) ? Double.NaN : FastMath.acosh(value); }
From source file:com.rapidminer.tools.expression.internal.function.trigonometric.ArcHyperbolicTangent.java
@Override protected double compute(double value) { return Double.isNaN(value) ? Double.NaN : FastMath.atanh(value); }
From source file:com.cloudera.oryx.common.stats.IntegerWeightedMean.java
public IntegerWeightedMean() { this(0, 0, Double.NaN); }
From source file:info.debatty.jinu.SummaryStatistics.java
private static double calcMeanCI(final SummaryStatistics stats, final double level) { try {/*from w w w.j a va 2 s . c o m*/ // Create T Distribution with N-1 degrees of freedom TDistribution t_dist = new TDistribution(stats.getN() - 1); // Calculate critical value double crit_val = t_dist.inverseCumulativeProbability(1.0 - (1 - level) / 2); // Calculate confidence interval return crit_val * stats.getStandardDeviation() / Math.sqrt(stats.getN()); } catch (MathIllegalArgumentException e) { return Double.NaN; } }
From source file:org.hawkular.alerts.api.model.condition.ThresholdConditionEval.java
public ThresholdConditionEval() { super(Type.THRESHOLD, false, 0, null); this.value = Double.NaN; }
From source file:MathUtil.java
/** Arcus cos */ static public double acos(double x) { double f = asin(x); if (f == Double.NaN) { return f; }/*w w w. j a va 2 s . c om*/ return Math.PI / 2 - f; }
From source file:Float11.java
static public double acos(double x) { double f = asin(x); if (f == Double.NaN) return f; return Math.PI / 2 - f; }
From source file:de.bund.bfr.math.MathUtils.java
public static double nullToNan(Double d) { return d != null ? d : Double.NaN; }