groovy
  1. groovy
  2. GROOVY-5102

Unrelated changes cause BigDecimal division to return Double

    Details

    • Type: Bug Bug
    • Status: Closed 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
    • Testcase included:
      yes
    • Number of attachments :
      0

      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

        blackdrag blackdrag made changes -
        Field Original Value New Value
        Fix Version/s 1.8.4 [ 17852 ]
        Priority Major [ 3 ] Blocker [ 1 ]
        Hide
        blackdrag blackdrag added a comment -

        fixed

        Show
        blackdrag blackdrag added a comment - fixed
        blackdrag blackdrag made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Jochen Theodorou [ blackdrag ]
        Fix Version/s 1.9-beta-5 [ 17925 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: