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

DecimalValue(BigDecimal bigDecimal) constructor

    Details

    • Type: Bug
    • Status: Open
    • Priority: Default
    • Resolution: Unresolved
    • Affects Version/s: 1.0.0
    • Fix Version/s: None
    • Component/s: Message Object Model
    • Labels:
      None

      Description

      It seems to me that there should be a minus sign added to the exponent in DecimalValue(BigDecimal bigDecimal) constructor:

      public DecimalValue(BigDecimal bigDecimal)

      { this.mantissa = bigDecimal.unscaledValue().longValue(); this.exponent = bigDecimal.scale(); }

      should be replaced with:

      public DecimalValue(BigDecimal bigDecimal)

      { this.mantissa = bigDecimal.unscaledValue().longValue(); this.exponent = -bigDecimal.scale(); }

      This is because toBigDecimal() function reverses sign of exponent:

      public BigDecimal toBigDecimal()

      { return new BigDecimal(BigInteger.valueOf(mantissa), -exponent); }

        Attachments

          Activity

            People

            • Assignee:
              jacob_northey Jacob Northey
              Reporter:
              barlaw Bartosz Lawniczek
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: