virtuoso-opensource icon indicating copy to clipboard operation
virtuoso-opensource copied to clipboard

Issue handling xsd:double and xsd:decimal

Open jakubklimek opened this issue 11 years ago • 4 comments
trafficstars

In develop/6, I have issue with loading xsd:double and xsd:decimal datatypes. When I load "50.08332824707031"^^xsd:double using SPARQL update, when I look at the value using fct or simply by querying, I get "50.0833"^^xsd:double. However, if I load it as "50.08332824707031"^^xsd:decimal, I get "50.08332824707031"^^xsd:double.

I think both cases are wrong. The second one has the effect that when I dump the graph and load it again, it goes through case 1) loosing precision.

jakubklimek avatar Dec 09 '13 07:12 jakubklimek

I have asked development to look into this and will let you know what they report back ...

HughWilliams avatar Dec 15 '13 22:12 HughWilliams

Was there any progress on this? While xsd:decimal should be lossless, Virtuoso implements it as lossy. Observe:

SELECT ?value
WHERE {
  VALUES ?value {
    0.00262335315960871
  }
}

When provided with 0.00262335315960871 Virtuoso returns 0.002623353159609.

Tested on Virtuoso 07.20.3218.

jindrichmynarz avatar Apr 03 '17 07:04 jindrichmynarz

I have reported to development to look into ...

HughWilliams avatar Apr 22 '17 18:04 HughWilliams

Any progress on this? The XSD standard requires to at least maintain a precision of 16 for xsd:decimal for limited conformance, and arbitrary precision for full conformance. Currently, Virtuoso maintains a precision of 15 (example query), which is the precision preserved by doubles. Therefore I guess, decimals are currently implemented with doubles internally.

jmkeil avatar Jun 07 '22 09:06 jmkeil