It does seem odd-I filed a bug on the MarkLogic side and we'll take a look.

In the mean time, as David pointed out, casting it to a double seems to work 
around it.

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Alex Milowski
Sent: Wednesday, March 20, 2013 9:53 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Simple Math Issue


Testing other XQuery processors (e.g. Saxon 9.4 via XProc):


<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc";
   xmlns:c="http://www.w3.org/ns/xproc-step"; version="1.0">
   <p:output port="result"/>
   <p:xquery>
      <p:input port="source">
         <p:empty/>
      </p:input>
      <p:input port="parameters">
         <p:empty/>
      </p:input>
      <p:input port="query">
         <p:inline>
            <c:query>
               element result { 180 div 2.5, 5 div 2.5 }
            </c:query>
         </p:inline>
      </p:input>
   </p:xquery>
</p:declare-step>

Output: <result>72 2</result>
MarkLogic: <result>71.99999999999999601 1.999999999999999889</result>


--
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to