Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1545

OData V4: Scientific notation value of Edm.Double cannot be processed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • (Java) V4 4.8.0
    • None
    • odata4-server
    • None

    Description

      As per 

          https://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format:_binary64

      If a decimal string with at most 15 significant digits is converted to IEEE 754 double-precision representation, and then converted back to a decimal string with the same number of digits, the final result should match the original string*.* If an IEEE 754 double-precision number is converted to a decimal string with at least 17 significant digits, and then converted back to double-precision representation, the final result must match the original number.

      The string 5.9999999999999998e-01 parsed back to Double is equal to 0.6.

      These validations often fail and POST requests having payloads with values like as 0.5, 0.6, 1.1 will get converted to 5e-1, 5.99999e-1...

      The line causing the isue is in Edm.Single and Edm.Double classes

            if (result.isInfinite() || BigDecimal.valueOf(result).compareTo(bigDecimalValue) != 0) {...

      Attachments

        Activity

          People

            Unassigned Unassigned
            ramyav Ramya Vasanth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: