[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: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 6 Nov 2008 22:00:03 GMT
Re:  floor() and idiv
> That's talking about representing decimals in floating-point binary -
> but you can't do that for xs:decimal -it's not allowed.

actually  I think you can implement decimal however you like, and to a
=an arbitrary fixed precision. Saxon no doubt documents what it does
somewhere but I didin't look up the details I just guessed that if I
stretched it far enough that rounded decimal division would crack before
integer division, and it did.

Is it really the case in gestalt that the two always give the same, or
may thay differ eventually at the edges of some finite range of
supported values?

F&O spec says:

For xs:decimal values the number of digits of precision returned by the
numeric operators is 7implementation-defined7. If the number of
digits in the result exceeds the number of digits that the
implementation supports, the result is truncated or rounded in an
7implementation-defined7 manner. 

integer div integer is defined as using xsl:decimal arithmetic so falls
under this, whereas if you use very big integers with idiv, you are
subject to the different rules 


For xs:integer operations, implementations that support
limited-precision integer operations 7must7 select from the
following options: 


      They 7may7 choose to always raise an error [err:FOAR0002].

      They 7may7 provide an 7implementation-defined7
      mechanism that allows users to choose between raising an error and
      returning a result that is modulo the largest representable
      integer value. See [ISO 10967]. 


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread


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.
First Name
Last Name
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.