- From: Michael Brundage <xquery@comcast.net>
- Date: Tue, 09 Dec 2003 23:14:32 -0800
- To: Damien Fisher <damien@sodatech.com>, "www-ql@w3.org 2" <www-ql@w3.org>
- Message-ID: <BBFC07D8.9CE%xquery@comcast.net>
Hi Damien, You may get a more prompt response from the W3C on public-qt-comments@w3.org. It is, of course, not possible to construct an irrational number in XQuery. Rational numbers in XQuery (like the answer to 1 idiv 3) are represented using the types xs:integer or xs:decimal, both of which are allowed to be arbitrary precision but are also allowed to have an implementation-defined limited precision. This used to be called out very clearly in previous XQuery drafts; in the current drafts, one place it is stated is in section 6.2 of the F&O draft: The number of digits of precision returned by various numeric functions is ·implementation dependent·. and the XML Schema specs say that implementations may limit the precision of these types. In my experience, most XQuery implementations limit xs:integer to either 32-bit or 64-bit integers, and xs:decimal to either 64-bit or 128-bit numbers (i.e., whatever the underlying implementation language ‹ typically Java, C#, C++, etc. ‹ supports natively or through built-in libraries). Hope this helps, Michael Brundage xquery@comcast.net Writing as Author, XQuery: The XML Query Language (Addison-Wesley, 2004) Co-author, Professional XML Databases (Wrox Press, 2000) not as Technical Lead Common Query Runtime/XML Query Processing WebData XML Team Microsoft On 12/9/03 6:00 PM, "Damien Fisher" <damien@sodatech.com> wrote: > op:numeric-divide has a special case when the two inputs are of type > xs:integer, and in this case returns an xs:decimal. > > > > What, then, is the answer to op:numeric-divide(1, 3)? Is it 0.3? 0.33? > 0.333? In other words, to what precision should irrational answers be > returned? And should rational answers always be returned exactly, even if > that requires an enormous amount of precision? > > >
Received on Wednesday, 10 December 2003 02:14:34 UTC