summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.lang/Float_2.java
blob: 5d019533d53f71c6f5631d1b91b89f0860205fec (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Test floating-point to integer conversion.  We do this twice, once
// with literal conversions that can be optimized away and once using
// a static field that can't.

public class Float_2
{
  public static double zero = 0.0;

  public static void main (String argv[])
  {
    {
      int itest = (int)(float)(0.0/0.0);
      if (itest != 0)
	System.err.println ("literal inf error 1: " + itest);	
    }
    {
      int itest = (int)(0.0/0.0);
      if (itest != 0)
	System.err.println ("literal inf error 2" + itest);	
    }
    {
      long ltest = (long)(0.0/0.0);
      if (ltest != 0)
	System.err.println ("literal inf error 3" + ltest);	
    }
    {
      long ltest = (long)(float)(0.0/0.0);
      if (ltest != 0)
	System.err.println ("literal inf error 4" + ltest);	
    }
      
    {
      int itest = (int)(float)(1.0/0.0);
      if (itest != Integer.MAX_VALUE)
	System.err.println ("literal max error 1: " + itest);	
    }
    {
      int itest = (int)(1.0/0.0);
      if (itest != Integer.MAX_VALUE)
	System.err.println ("literal max error 2" + itest);	
    }
    {
      long ltest = (long)(1.0/0.0);
      if (ltest != Long.MAX_VALUE)
	System.err.println ("literal max error 3" + ltest);	
    }
    {
      long ltest = (long)(float)(1.0/0.0);
      if (ltest != Long.MAX_VALUE)
	System.err.println ("literal max error 4" + ltest);	
    }
      
    {
      int itest = (int)(float)(-1.0/0.0);
      if (itest != Integer.MIN_VALUE)
	System.err.println ("literal min error 1: " + itest);	
    }
    {
      int itest = (int)(-1.0/0.0);
      if (itest != Integer.MIN_VALUE)
	System.err.println ("literal min error 2" + itest);	
    }
    {
      long ltest = (long)(-1.0/0.0);
      if (ltest != Long.MIN_VALUE)
	System.err.println ("literal min error 3" + ltest);	
    }
    {
      long ltest = (long)(float)(-1.0/0.0);
      if (ltest != Long.MIN_VALUE)
	System.err.println ("literal min error 4" + ltest);	
    }
      
    {
      int itest = (int)(float)(zero/zero);
      if (itest != 0)
	System.err.println ("calc inf error 1: " + itest);	
    }
    {
      int itest = (int)(zero/zero);
      if (itest != 0)
	System.err.println ("calc inf error 2" + itest);	
    }
    {
      long ltest = (long)(zero/zero);
      if (ltest != 0)
	System.err.println ("calc inf error 3" + ltest);	
    }
    {
      long ltest = (long)(float)(zero/zero);
      if (ltest != 0)
	System.err.println ("calc inf error 4" + ltest);	
    }
      
    {
      int itest = (int)(float)(1.0/zero);
      if (itest != Integer.MAX_VALUE)
	System.err.println ("calc max error 1: " + itest);	
    }
    {
      int itest = (int)(1.0/zero);
      if (itest != Integer.MAX_VALUE)
	System.err.println ("calc max error 2" + itest);	
    }
    {
      long ltest = (long)(1.0/zero);
      if (ltest != Long.MAX_VALUE)
	System.err.println ("calc max error 3" + ltest);	
    }
    {
      long ltest = (long)(float)(1.0/zero);
      if (ltest != Long.MAX_VALUE)
	System.err.println ("calc max error 4" + ltest);	
    }
      
    {
      int itest = (int)(float)(-1.0/zero);
      if (itest != Integer.MIN_VALUE)
	System.err.println ("calc min error 1: " + itest);	
    }
    {
      int itest = (int)(-1.0/zero);
      if (itest != Integer.MIN_VALUE)
	System.err.println ("calc min error 2" + itest);	
    }
    {
      long ltest = (long)(-1.0/zero);
      if (ltest != Long.MIN_VALUE)
	System.err.println ("calc min error 3" + ltest);	
    }
    {
      long ltest = (long)(float)(-1.0/zero);
      if (ltest != Long.MIN_VALUE)
	System.err.println ("calc min error 4" + ltest);	
    }
      
  }
}