Groovy
  1. Groovy
  2. GROOVY-5102

Unrelated changes cause BigDecimal division to return Double

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.8.3
    • Fix Version/s: 1.8.4, 2.0-beta-1
    • Component/s: bytecode, Compiler
    • Labels:
      None
    • Environment:
      OSX, Linux for sure, perhaps others

      Description

      In Groovy 1.8.3 the first test passes while the second fails. The return type of the second operation (and third, if it were to get to it) becomes a Double.

      The tests both pass in 1.8.2.

      class BigDecimalTest extends GroovyTestCase{
          public void testMath1() {
              assert BigDecimal == (3/2).getClass()
              assert BigDecimal == (7.0/8.0).getClass()
              assert BigDecimal == (new BigDecimal(3.0)/new BigDecimal(2.0)).getClass()
              true
          }
      
          public void testMath2() {
              assert BigDecimal == (3/2).getClass()
              assert BigDecimal == (7.0/8.0).getClass()
              assert BigDecimal == (new BigDecimal(3.0)/new BigDecimal(2.0)).getClass()
          }
      }
      

        Activity

        Shaun Jurgemeyer created issue -
        Jochen Theodorou made changes -
        Field Original Value New Value
        Priority Major [ 3 ] Blocker [ 1 ]
        Fix Version/s 1.8.4 [ 17852 ]
        Jochen Theodorou made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Jochen Theodorou [ blackdrag ]
        Fix Version/s 1.9-beta-5 [ 17925 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12734026 ] Default workflow, editable Closed status [ 12745847 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12971566 ] Default workflow, editable Closed status [ 12979403 ]

          People

          • Assignee:
            Jochen Theodorou
            Reporter:
            Shaun Jurgemeyer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development