Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3275

MVEL Dialect: BigDecimal does not show the correct value

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.4.0.Beta2
    • 5.2.0.Final, 5.3.0.Final
    • drools-core
    • Workaround Exists
    • Hide

      Use toString explicitly:

      BigDecimal ale = 500.01B;
      System.out.println(ale.toString());

      Show
      Use toString explicitly: BigDecimal ale = 500.01B; System.out.println(ale.toString());

      MVEL Jira related: http://jira.codehaus.org/browse/MVEL-262

      MVEL does not show the correct value for BigDecimal instances, like:

      BigDecimal ale = 500.01B;
      System.out.println(ale);

      The result is: 500

      BigDecimal should invoke toString, like any Java instance to show values of variables instead of .intValue().

      The same happens to show result of arithmetic operations btw BigDecimals:
      BigDecimal test = new BigDecimal("50000");
      System.out.println(test / new BigDecimal("1.13"));

      The result is:
      44247

      ... instead of 44247.78761061946902654867256637168.

      Anyway, the internal representation is correct, only the method invoked to show the values is wrong.

      The result for:
      System.out.println( (test / new BigDecimal("1.13")) == 44247.78761061946902654867256637168B)

      is true.

              mfusco@redhat.com Mario Fusco
              rhn-support-alazarot Alessandro Lazarotti
              Archiver:
              rhn-support-ceverson Clark Everson

                Created:
                Updated:
                Resolved:
                Archived: