Re: [xsl] floor() and idiv

Subject: Re: [xsl] floor() and idiv
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 6 Nov 2008 22:00:03 GMT
> 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