/** * Checks whether the float value is the special NaN value. * * @return true if NaN */ public boolean isNaN() { return Float.isNaN(value); }
/** * Checks whether the float value is the special NaN value. * * @return true if NaN */ public boolean isNaN() { return Float.isNaN(value); }
/** * Checks whether the value is the special NaN value. */ public boolean isNaN() { return Float.isNaN(value); }
@Override protected boolean isNan(Float number) { return number.isNaN(); }
public static boolean hasNaN(float[] a) { for (float x : a) { if (Float.isNaN(x)) return true; } return false; }
@Override public boolean isNaN() { return Float.isNaN(_value) || Float.isInfinite(_value); }
@Override public boolean isNaN() { return Float.isNaN(_value) || Float.isInfinite(_value); }
@Override protected Number getNormalizedValue() { if (value.isNaN() || value.isInfinite()) { return value; } return new BigDecimal(getValue().floatValue()).round(new MathContext(precision)).floatValue(); } }
@Override public void writeNumber(float f) throws IOException { if (_cfgNumbersAsStrings || // [JACKSON-139] (isEnabled(Feature.QUOTE_NON_NUMERIC_NUMBERS) && ((Float.isNaN(f) || Float.isInfinite(f))))) { writeString(String.valueOf(f)); return; } // What is the max length for floats? _verifyValueWrite(WRITE_NUMBER); writeRaw(String.valueOf(f)); }
@Override public void writeNumber(float f) throws IOException { if (_cfgNumbersAsStrings || // [JACKSON-139] (isEnabled(Feature.QUOTE_NON_NUMERIC_NUMBERS) && ((Float.isNaN(f) || Float.isInfinite(f))))) { writeString(String.valueOf(f)); return; } // What is the max length for floats? _verifyValueWrite(WRITE_NUMBER); writeRaw(String.valueOf(f)); }
@Override public void writeNumber(float f) throws IOException { if (_cfgNumbersAsStrings || // [JACKSON-139] (((Float.isNaN(f) || Float.isInfinite(f)) && Feature.QUOTE_NON_NUMERIC_NUMBERS.enabledIn(_features)))) { writeString(String.valueOf(f)); return; } // What is the max length for floats? _verifyValueWrite(WRITE_NUMBER); writeRaw(String.valueOf(f)); }
@Override public void writeNumber(float f) throws IOException { if (_cfgNumbersAsStrings || // [JACKSON-139] (((Float.isNaN(f) || Float.isInfinite(f)) && Feature.QUOTE_NON_NUMERIC_NUMBERS.enabledIn(_features)))) { writeString(String.valueOf(f)); return; } // What is the max length for floats? _verifyValueWrite(WRITE_NUMBER); writeRaw(String.valueOf(f)); }
@Override public boolean onScale(ScaleGestureDetector detector) { float scaleFactor = detector.getScaleFactor(); if (Float.isNaN(scaleFactor) || Float.isInfinite(scaleFactor)) return false; if (scaleFactor >= 0) { mListener.onScale(scaleFactor, detector.getFocusX(), detector.getFocusY()); } return true; }
public void testIsFinite() { for (float value : NUMBERS) { assertEquals(!(Float.isInfinite(value) || Float.isNaN(value)), Floats.isFinite(value)); } }
@Test public void testNanHash() { int[] nanRepresentations = {floatToIntBits(Float.NaN), 0xffc00000, 0x7fc00000, 0x7fc01234, 0xffc01234}; for (int nanRepresentation : nanRepresentations) { assertTrue(isNaN(intBitsToFloat(nanRepresentation))); assertEquals(RealOperators.hashCode(nanRepresentation), RealOperators.hashCode(nanRepresentations[0])); } } }
public boolean touchDown (int screenX, int screenY, int pointer, int button) { if (!Float.isNaN(time)) // if "walking" was interrupted by this touch down event startPosition.set(getPosition(time)); // set startPosition to the current position targetPosition.set(stage.screenToStageCoordinates(targetPosition.set(screenX, screenY))); time = 0; return true; }
@Override protected void calcMinMax(BarEntry e) { if (e != null && !Float.isNaN(e.getY())) { if (e.getYVals() == null) { if (e.getY() < mYMin) mYMin = e.getY(); if (e.getY() > mYMax) mYMax = e.getY(); } else { if (-e.getNegativeSum() < mYMin) mYMin = -e.getNegativeSum(); if (e.getPositiveSum() > mYMax) mYMax = e.getPositiveSum(); } calcMinMaxX(e); } }
public void testMax() { assertEquals(GREATEST, Floats.max(GREATEST)); assertEquals(LEAST, Floats.max(LEAST)); assertEquals( (float) 9, Floats.max((float) 8, (float) 6, (float) 7, (float) 5, (float) 3, (float) 0, (float) 9)); assertEquals(0f, Floats.max(-0f, 0f)); assertEquals(0f, Floats.max(0f, -0f)); assertEquals(GREATEST, Floats.max(NUMBERS)); assertTrue(Float.isNaN(Floats.max(VALUES))); }
public void testMin() { assertEquals(LEAST, Floats.min(LEAST)); assertEquals(GREATEST, Floats.min(GREATEST)); assertEquals( (float) 0, Floats.min((float) 8, (float) 6, (float) 7, (float) 5, (float) 3, (float) 0, (float) 9)); assertEquals(-0f, Floats.min(-0f, 0f)); assertEquals(-0f, Floats.min(0f, -0f)); assertEquals(LEAST, Floats.min(NUMBERS)); assertTrue(Float.isNaN(Floats.min(VALUES))); }