Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2366

A integer precision error (2147483647 + 2 == -2147483647 is true?)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.5
    • 1.6-rc-2
    • None
    • None
    • any

    Description

      Just run the following statement, groovy will produces error results:

      a = 123456
      b = 234567
      println a * b

      println 123456 * 234567

      x = 2147483647
      y = 2
      println x + y

      println 2147483647 + 2 == -2147483647

      println 2147483647 * 2

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            goodsforyou goodsforyou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: