Altova Mailing List Archives


Re: [xsl] floor() and idiv

From: David Carlisle <davidc@--------->
To:
Date: 11/6/2008 10:00:00 PM
> 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]. 



David

________________________________________________________________________
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. 
________________________________________________________________________

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.