OSDN Git Service

2006-04-03 Andrew Haley <aph@redhat.com>
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Apr 2006 10:15:25 +0000 (10:15 +0000)
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Apr 2006 10:15:25 +0000 (10:15 +0000)
        * testsuite/libjava.lang/Float_2.java: New file.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112636 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/testsuite/libjava.lang/Float_2.java [new file with mode: 0644]
libjava/testsuite/libjava.lang/Float_2.out [new file with mode: 0644]

index 35c5c87..d5f175c 100644 (file)
@@ -1,3 +1,7 @@
+2006-04-03  Andrew Haley  <aph@redhat.com>
+
+       * testsuite/libjava.lang/Float_2.java: New file.
+
 2006-03-31  Andreas Tobler  <a.tobler@schweiz.ch>
 
        * posix.cc (_Jv_platform_nanotime): Declare id with clockid_t.
diff --git a/libjava/testsuite/libjava.lang/Float_2.java b/libjava/testsuite/libjava.lang/Float_2.java
new file mode 100644 (file)
index 0000000..5d01953
--- /dev/null
@@ -0,0 +1,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);        
+    }
+      
+  }
+}
diff --git a/libjava/testsuite/libjava.lang/Float_2.out b/libjava/testsuite/libjava.lang/Float_2.out
new file mode 100644 (file)
index 0000000..e69de29