Example usage for java.lang Float isNaN

List of usage examples for java.lang Float isNaN

Introduction

In this page you can find the example usage for java.lang Float isNaN.

Prototype

public static boolean isNaN(float v) 

Source Link

Document

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Usage

From source file:juicebox.matrix.InMemoryMatrix.java

@Override
public float getLowerValue() {
    if (Float.isNaN(lowerValue)) {
        computeBounds();

    }
    return lowerValue;
}

From source file:org.esa.snap.core.jexp.impl.ExtMath.java

/**
 * Computes the signum of a given number. The method returns
 * <ul>//  w ww .  ja  v a2  s.c  o  m
 * <li>-1, if a is negative</li>
 * <li>+1, if a is positive</li>
 * <li>0, if a is zero</li>
 * <li>NaN, if a is NaN.</li>
 * </ul>
 *
 * @param a the number
 *
 * @return the signum of a
 */
public static float sign(float a) {
    if (Float.isNaN(a)) {
        return Float.NaN;
    }
    return a == 0.0f ? 0.0f : (a < 0.0f ? -1.0f : 1.0f);
}

From source file:com.facebook.react.views.drawer.ReactDrawerLayoutManager.java

@ReactProp(name = "drawerWidth", defaultFloat = Float.NaN)
public void getDrawerWidth(ReactDrawerLayout view, float width) {
    int widthInPx = Float.isNaN(width) ? ReactDrawerLayout.DEFAULT_DRAWER_WIDTH
            : Math.round(PixelUtil.toPixelFromDIP(width));
    view.setDrawerWidth(widthInPx);/*from   w w w  .j av  a2  s  .c o  m*/
}

From source file:de.metanome.algorithm_integration.ColumnConditionOr.java

@Override
public float getCoverage() {
    if (Float.isNaN(this.coverage)) {
        float coverage = 0;
        for (ColumnCondition subCondition : this.columnValues) {
            coverage += subCondition.getCoverage();
        }//from   www. j  a  v a  2s .  c  o  m
        return coverage;
    } else {
        return this.coverage;
    }
}

From source file:juicebox.matrix.InMemoryMatrix.java

@Override
public float getUpperValue() {
    if (Float.isNaN(upperValue)) {
        computeBounds();
    }
    return upperValue;
}

From source file:ru.histone.v2.rtti.RunTimeTypeInfo.java

public HistoneType getType(EvalNode node) {
    if (node == null) {
        throw new NullPointerException();
    }//  w  w w  .  j  a va2  s . c  o m
    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());
}

From source file:org.broad.igv.tools.Accumulator.java

public void add(float v) {
    if (!Float.isNaN(v)) {
        min = Float.isNaN(min) ? v : Math.min(min, v);
        max = Float.isNaN(max) ? v : Math.max(max, v);
        sum += v;/*from   w ww.j a va 2 s .c om*/
        nPts++;
    }
}

From source file:IntObjectHashMap.java

/**
 * Constructs an empty <tt>IntObjectHashMap</tt> with the specified initial
 * capacity and load factor./*ww  w .j  a  va  2  s  . com*/
 *
 * @param initialCapacity The initial capacity.
 * @param loadFactor      The load factor.
 * @throws IllegalArgumentException if the initial capacity is negative
 *                                  or the load factor is nonpositive.
 */
public IntObjectHashMap(int initialCapacity, float loadFactor) {
    if (initialCapacity < 0) {
        throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity);
    }
    if (initialCapacity > MAXIMUM_CAPACITY) {
        initialCapacity = MAXIMUM_CAPACITY;
    }
    if (loadFactor <= 0 || Float.isNaN(loadFactor)) {
        throw new IllegalArgumentException("Illegal load factor: " + loadFactor);
    }

    // Find a power of 2 >= initialCapacity
    int capacity = 1;
    while (capacity < initialCapacity) {
        capacity <<= 1;
    }

    this.loadFactor = loadFactor;
    threshold = (int) (capacity * loadFactor);
    table = new Entry[capacity];
}

From source file:org.broad.igv.data.ProcessingUtils.java

private static float computeMean(float[] data) {
    float sum = 0.0f;
    int nPts = 0;
    for (int i = 0; i < data.length; i++) {
        if (!Float.isNaN(data[i])) {
            sum += data[i];/*from  w w w . j  a v  a  2  s.co m*/
            nPts++;
        }
    }
    return (nPts == 0 ? Float.NaN : sum / nPts);
}

From source file:juicebox.matrix.SymmetricMatrix.java

public float getRowMean(int i) {
    float sum = 0;
    int count = 0;
    for (int j = 0; j < dim; j++) {
        float value = getEntry(i, j);
        if (!Float.isNaN(value)) {
            sum += value;//from   ww w. j  ava  2s .  c om
            count++;
        }
    }
    return count == 0 ? Float.NaN : sum / count;
}