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

Incorrect long comparison for specific long values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.3.1_05
    • 1.3.1_03, 1.4.0, 1.4.1
    • hotspot
    • None
    • 05
    • x86
    • windows_nt

        Windows systems are not able to deal with a given long
        which is namely: 9223372034707292160L.
        Several thousand numbers below or above are fine.

        The problem does not occur on Solaris. It seems to occur
        on most 1.3 releases and on 1.4 on Windows.
        The bug has been file against 1.3.1._03 and needs a fix there.

        Please check the simple testcase:

        public class LongCompTest {

          public static void main(String[] args) {
            System.out.println("\n--[2 Longs compare problem]--------------------");
            long l1 = 9223372034707292160L;
            long l2 = -9223372034707292160L;
            System.out.println("MAX_LONG: " + Long.MAX_VALUE );
            System.out.println("MIN_LONG: " + Long.MIN_VALUE );
            System.out.println("l1: " + l1);
            System.out.println("l2: " + l2);
            System.out.println("When comparing l1 with l2 - the result is [" + (l1 == l2
        )+"]...");
          }
        }

              azeemj Azeem Jiva
              stschnei Stefan Schneider (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: