Uploaded image for project: 'OpenFAST'
  1. OpenFAST
  2. FAST-36

BigDecimals are not correctly interpreted in DecimalValue constructor

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.0.3
    • Component/s: Types
    • Labels:
    • Environment:
      JRE 1.6, Windows and Linux

      Description

      BigDecimal scale is mis-interpreted as being identical to exponent, resulting in incorrect number conversion. According to java doc for BigDecimal the value is: unscaledValue × 10^(-scale), whereas for openfast DecimalValue the value is: mantissa x 10^(exponent). Therefore exponent = -bigDecimal.scale (and not bigDecimal.scale).

      To test this, encode BigDecimal(2.4) then decode the byte stream and you'll get 240 (24 x 10^1, but should be 24 x 10^(-1)).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jacob_northey Jacob Northey
                Reporter:
                pgribben Paul Gribben
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: