ARC2_Store::query: function AVG fails sometimes, because it is rounding up #99
Open
Description
I don't expect this issue to be solved soon, but i want to document it because i need it for a pull request.
Given the following RDF:
@prefix : <http://www.example.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
:ints :int 1, 2, 3 .
:decimals :dec 1.0, 2.2, 3.5 .
:doubles :double 1.0E2, 2.0E3, 3.0E4 .
:mixed1 :int 1 ; :dec 2.2 .
:mixed2 :double 2E-1 ; :dec 2.2 .
The following query:
PREFIX : <http://www.example.org/>
SELECT (AVG(?o) AS ?avg)
WHERE {
?s :dec ?o
}
should return:
array {
'variables' => array { "avg" }
'rows' => array {
array {
'avg' => "2.22"
'avg type' => 'literal"
}
}
}
but returns
array {
'variables' => array { "avg" }
'rows' => array {
array {
'avg' => "2" // <=============== problem
'avg type' => 'literal"
}
}
}