summaryrefslogtreecommitdiffstats
path: root/tests/pureJava/LiteralsCf.java
blob: 31f8e3513539cdac03548678cccdc525c28f5ab9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class LiteralsCf {
    public static void main(String[] args) {
        float f;
        double d;
        f = 3.4028235e+38f; //Why not error?
        f = 1.4023983e-45f; //Why not error?

        f = 1e39f; //ERR: rounds to +INF
        f = 0.0000000000000000000000000000000000000000000000001f; //ERR: rounds to 0
        f = -1234567890123456789012345678901234567890123f; //ERR: rounds to -INF
        d = -1e310; //ERR: rounds to -INF
        d = 1e500; //ERR: rounds to +INF

        int i, i1, i2, i3;
        long l, l1, l2, l3;

        i = 2147483648; //ERR: too big
        i = 0x1ffffffff; //ERR: too big
        i = 01234567012345670; //ERR: too big
        i2 = 0x800000000;
        i3 = 0200000000000;
        i2 = 0x100000000;
        i3 = 040000000000;

        i = -2147483649; //ERR: too small

        l = 9223372036854775808L; //ERR: too big
        l = -9223372036854775809L; //ERR: too small
        l2 = 0x80000000000000000L;
        l3 = 010000000000000000000000L;

        i = 09; //ERR: illegal octal

    }
}