Illustration einer tropischen Insel mit Palmen und einem hohen Berg

Java Blog für Programmierer

Java 8: Double/Float.isFinite(), Math.nextDown()

· Christian Ullenboom

Die Methode Double.isInfinite(double v) liefert true, falls v entweder POSITIVE_INFINITY oder NEGATIVE_INFINITY ist. In Float gibt es die gleiche Methode. Seit Java 8 testet Double.isFinite(double v), ob v nicht unendlich ist und auch nicht NaN ist – ähnliches gilt für Float.

Statt Math.nextAfter(d,Double.NEGATIVE_INFINITY) gibt es in Java 8 auch Math.nextDown().

Kategorien: Java 8

← Alle Beiträge