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

(long)(Double.NaN) should yield 0 but doesn't

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description

      The conversion from double to long is incorrect (according to the Java Language Specification section 5.1.3) when converting NaN. The spec says that the result should be 0, but instead is 9223372036854775807. To reproduce:

      public class Bug {
      public static void main(String[] args) {
      long lvalue = (long)Double.NaN;
      System.out.println("long value = " + lvalue);
      }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              apalanissunw Anand Palaniswamy (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: