forked from PacktPublishing/Java-Coding-Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
22 lines (15 loc) · 636 Bytes
/
Copy pathMain.java
File metadata and controls
22 lines (15 loc) · 636 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package modern.challenge;
public class Main {
public static void main(String[] args) {
float f = 0.1f;
float nextdownf = Math.nextDown(f);
float nextupf = Math.nextUp(f);
System.out.println("float " + f + " next down is " + nextdownf);
System.out.println("float " + f + " next up is " + nextupf);
double d = 0.1d;
double nextdownd = Math.nextDown(d);
double nextupd = Math.nextUp(d);
System.out.println("double " + d + " next down is " + nextdownd);
System.out.println("double " + d + " next up is " + nextupd);
}
}