[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: floor() and idiv

Subject: RE: floor() and idiv
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 6 Nov 2008 23:02:29 -0000
RE:  floor() and idiv
>     David> For xs:decimal values the number of digits of precision
>     David> returned by the numeric operators is
>     David> .implementation-defined.. If the number of digits in the
>     David> result exceeds the number of digits that the implementation
>     David> supports, the result is truncated or rounded in an
>     David> .implementation-defined. manner.
> 
> Oh. Well that's a bad decision, as you no longer have the 
> neat divide between exact arithmetic (requested by xs:integer 
> or xs:decimal) and inexact arithmetic (requested by xs:double 
> and xs:float) that you get in XML Schema.

Dividing two integers can produce a result that is not expressible in a
finite number of decimal digits. The spec chose therefore to say that the
number of digits in the result of (10 div 3), say, is
implementation-defined. I don't know if that's the reason for the effect
being observed here, but I suspect so. In which case the statement in the
spec about the equivalence of xs:int(x div y) and (x idiv y) is clearly
incomplete.

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.