Next value
static double nextAfter(double start, double direction)
- Returns the floating-point number adjacent to the first argument in the direction of the second argument.
static float nextAfter(float start, double direction)
- Returns the floating-point number adjacent to the first argument in the direction of the second argument.
static double nextUp(double d)
- Returns the floating-point value adjacent to d in the direction of positive infinity.
static float nextUp(float f)
- Returns the floating-point value adjacent to f in the direction of positive infinity.
public class Main {
public static void main(String[] args) {
System.out.println(Math.nextAfter(2,1.2));
System.out.println(Math.nextUp(1.2));
}
}
The output:
1.9999999
1.2000000000000002
Home
Java Book
Essential Classes
Java Book
Essential Classes
Math:
- Math class
- Constant E and PI
- Get the absolute value
- sin, cos, tan: Trigonometric functions
- Cube root and square root
- Ceilling and flooring value
- Copy sign
- Raise the power
- Get exponent
- sqrt(x2 +y2)
- IEEE remainder
- logarithm
- Max, min value
- Next value
- Math Random
- Round to int to double
- Round a value to integer
- value * 2^ scaleFactor
- Get the sign
- Degree to Radian, and Radian to Degree
- Returns the size of an ulp of the argument