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

isCase implementation for BigDecimals needed based on numerical value only

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.1-beta-2
    • groovy-jdk
    • None

    Description

      BigDecimals carry both a numerical value and a precision (scale).

      In Groovy, when BigDecimals are compared, only the numerical value is taken into account, but isCase() uses both value and scale.

      This should be consistent.

      assert 0.5 == 0.50000 // works
      switch(0.5) {
      case 0.50000: println "match" // doesn't match
      }

      Attachments

        1. GROOVY-1944.patch
          2 kB
          codex22

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: