BaseXdb / basex

BaseX Main Repository.
http://basex.org
BSD 3-Clause "New" or "Revised" License
691 stars 265 forks source link

xs:decimal gt returns the wrong results #2112

Closed adamretter closed 2 years ago

adamretter commented 2 years ago

Description of the Problem

The following query returns (true, true) in BaseX.

xs:decimal(1.13) gt xs:double(1.13)
,
xs:decimal(1.13) gt xs:float(1.13)

In Saxon and eXist-db this returns (false, false).

Expected Behavior

I think the query should return (false, false)

As I understand https://www.w3.org/TR/xpath-31/#promotion then the xs:decimal should be promoted to an xs:double or xs:float.

Steps to Reproduce the Behavior

Run the query:

xs:decimal(1.13) gt xs:double(1.13)
,
xs:decimal(1.13) gt xs:float(1.13)

Do you have an idea how to solve the issue?

No response

What is your configuration?

BaseX 9.7.2 / OpenJDK 8 / macOS.

ChristianGruen commented 2 years ago

@adamretter With the revised comparison of numeric values in XQuery 4, I assume that the result of the comparisons will change again:

As the decimal representation of the double 1.13 is 1.12999999999999989341858963598497211933135986328125, xs:decimal(1.13) gt xs:double(1.13) will return true