You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Ramya Vasanth (Jira)" <ji...@apache.org> on 2021/09/17 05:04:00 UTC
[jira] [Created] (OLINGO-1545) OData V4: Scientific notation value
of Edm.Double cannot be processed
Ramya Vasanth created OLINGO-1545:
-------------------------------------
Summary: OData V4: Scientific notation value of Edm.Double cannot be processed
Key: OLINGO-1545
URL: https://issues.apache.org/jira/browse/OLINGO-1545
Project: Olingo
Issue Type: Bug
Components: odata4-server
Affects Versions: (Java) V4 4.8.0
Reporter: Ramya Vasanth
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) {...
--
This message was sent by Atlassian Jira
(v8.3.4#803005)