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

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

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      sparc
    • OS:
      generic
    • Verification:
      Not verified

      Description



      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

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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: