Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1264179

compiler cannot provide the correct value of the floating point literal.

XMLWordPrintable

    • 1.1
    • sparc
    • generic
    • Not verified



      Name: ###@###.### Date: 08/19/96


      Java compiler cannot provide the correct value of the floating point literal
      in the first "if" statement. The second "if" statement contains more short
      floating point literal.

      Test:
      -----

      package javasoft.sqe.tests.lang.lex035.lex03501;
      import java.io.PrintStream;

      class lex03501 {
      public static void main (String args []) {
      System.exit(run(args,System.out));
      }

      public static int run(String args[],PrintStream out) {
        if(1.1e-1f==0000000000000000000000000000001.10E-0000000000000000000000000001F)
          System.out.println("1.1e-1f==0000000000000000000000000000001.10E-0000000000000000000000000001F");
        else
      System.out.println("1.1e-1f!=0000000000000000000000000000001.10E-0000000000000000000000000001F");
        if(1.1e-1f==0000000000000000000000000000001.10E-0000000000000000000000000001F)
          System.out.println("1.1e-1f==000000000000000000000000000001.10E-0000000000000000000000000001F");
        else
      System.out.println("1.1e-1f!=000000000000000000000000000001.10E-0000000000000000000000000001F");
        }
      }

      C and C++ compilers consider that the values of these floating-point literals
      are equal:
       
      #include <stdio.h>
      int main () {
      float i;
        if(1.1e-1f==0000000000000000000000000000001.10E-0000000000000000000000000001F)
          printf("1.1e-1f==0000000000000000000000000000001.10E-0000000000000000000000000001F");
        else
          printf("1.1e-1f!=0000000000000000000000000000001.10E-0000000000000000000000000001F");
      }


      novo31% !cc
      cc lex03501.c
      novo31% !a
      a.out
      1.1e-1f==0000000000000000000000000000001.10E-0000000000000000000000000001F
      novo31% !CC
      CC lex03501.c
      novo31% !a
      a.out
      1.1e-1f==0000000000000000000000000000001.10E-0000000000000000000000000001F

      ======================================================================

            fyellinsunw Frank Yellin (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: