OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [Float_2.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
// Test floating-point to integer conversion.  We do this twice, once
2
// with literal conversions that can be optimized away and once using
3
// a static field that can't.
4
 
5
public class Float_2
6
{
7
  public static double zero = 0.0;
8
 
9
  public static void main (String argv[])
10
  {
11
    {
12
      int itest = (int)(float)(0.0/0.0);
13
      if (itest != 0)
14
        System.err.println ("literal inf error 1: " + itest);
15
    }
16
    {
17
      int itest = (int)(0.0/0.0);
18
      if (itest != 0)
19
        System.err.println ("literal inf error 2" + itest);
20
    }
21
    {
22
      long ltest = (long)(0.0/0.0);
23
      if (ltest != 0)
24
        System.err.println ("literal inf error 3" + ltest);
25
    }
26
    {
27
      long ltest = (long)(float)(0.0/0.0);
28
      if (ltest != 0)
29
        System.err.println ("literal inf error 4" + ltest);
30
    }
31
 
32
    {
33
      int itest = (int)(float)(1.0/0.0);
34
      if (itest != Integer.MAX_VALUE)
35
        System.err.println ("literal max error 1: " + itest);
36
    }
37
    {
38
      int itest = (int)(1.0/0.0);
39
      if (itest != Integer.MAX_VALUE)
40
        System.err.println ("literal max error 2" + itest);
41
    }
42
    {
43
      long ltest = (long)(1.0/0.0);
44
      if (ltest != Long.MAX_VALUE)
45
        System.err.println ("literal max error 3" + ltest);
46
    }
47
    {
48
      long ltest = (long)(float)(1.0/0.0);
49
      if (ltest != Long.MAX_VALUE)
50
        System.err.println ("literal max error 4" + ltest);
51
    }
52
 
53
    {
54
      int itest = (int)(float)(-1.0/0.0);
55
      if (itest != Integer.MIN_VALUE)
56
        System.err.println ("literal min error 1: " + itest);
57
    }
58
    {
59
      int itest = (int)(-1.0/0.0);
60
      if (itest != Integer.MIN_VALUE)
61
        System.err.println ("literal min error 2" + itest);
62
    }
63
    {
64
      long ltest = (long)(-1.0/0.0);
65
      if (ltest != Long.MIN_VALUE)
66
        System.err.println ("literal min error 3" + ltest);
67
    }
68
    {
69
      long ltest = (long)(float)(-1.0/0.0);
70
      if (ltest != Long.MIN_VALUE)
71
        System.err.println ("literal min error 4" + ltest);
72
    }
73
 
74
    {
75
      int itest = (int)(float)(zero/zero);
76
      if (itest != 0)
77
        System.err.println ("calc inf error 1: " + itest);
78
    }
79
    {
80
      int itest = (int)(zero/zero);
81
      if (itest != 0)
82
        System.err.println ("calc inf error 2" + itest);
83
    }
84
    {
85
      long ltest = (long)(zero/zero);
86
      if (ltest != 0)
87
        System.err.println ("calc inf error 3" + ltest);
88
    }
89
    {
90
      long ltest = (long)(float)(zero/zero);
91
      if (ltest != 0)
92
        System.err.println ("calc inf error 4" + ltest);
93
    }
94
 
95
    {
96
      int itest = (int)(float)(1.0/zero);
97
      if (itest != Integer.MAX_VALUE)
98
        System.err.println ("calc max error 1: " + itest);
99
    }
100
    {
101
      int itest = (int)(1.0/zero);
102
      if (itest != Integer.MAX_VALUE)
103
        System.err.println ("calc max error 2" + itest);
104
    }
105
    {
106
      long ltest = (long)(1.0/zero);
107
      if (ltest != Long.MAX_VALUE)
108
        System.err.println ("calc max error 3" + ltest);
109
    }
110
    {
111
      long ltest = (long)(float)(1.0/zero);
112
      if (ltest != Long.MAX_VALUE)
113
        System.err.println ("calc max error 4" + ltest);
114
    }
115
 
116
    {
117
      int itest = (int)(float)(-1.0/zero);
118
      if (itest != Integer.MIN_VALUE)
119
        System.err.println ("calc min error 1: " + itest);
120
    }
121
    {
122
      int itest = (int)(-1.0/zero);
123
      if (itest != Integer.MIN_VALUE)
124
        System.err.println ("calc min error 2" + itest);
125
    }
126
    {
127
      long ltest = (long)(-1.0/zero);
128
      if (ltest != Long.MIN_VALUE)
129
        System.err.println ("calc min error 3" + ltest);
130
    }
131
    {
132
      long ltest = (long)(float)(-1.0/zero);
133
      if (ltest != Long.MIN_VALUE)
134
        System.err.println ("calc min error 4" + ltest);
135
    }
136
 
137
  }
138
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.