xsl-list
[Top] [All Lists]

Re: [xsl] floor() and idiv

2008-11-06 17:00:30

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 ·implementation-defined·. 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
·implementation-defined· 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 ·must· select from the
following options: 

    *

      They ·may· choose to always raise an error [err:FOAR0002].
    *

      They ·may· provide an ·implementation-defined·
      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. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>