xsl-list
[Top] [All Lists]

## RE: [xsl] floor() and idiv

2008-11-06 18:02:59
```    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/

--~------------------------------------------------------------------
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>
--~--

```
 Current Thread Re: [xsl] floor() and idiv, (continued) Re: [xsl] floor() and idiv, Andrew Welch Re: [xsl] floor() and idiv, Colin Paul Adams Re: [xsl] floor() and idiv, Andrew Welch Re: [xsl] floor() and idiv, Colin Paul Adams Re: [xsl] floor() and idiv, Andrew Welch Re: [xsl] floor() and idiv, David Carlisle Re: [xsl] floor() and idiv, Colin Paul Adams Re: [xsl] floor() and idiv, David Carlisle Re: [xsl] floor() and idiv, Colin Paul Adams Re: [xsl] floor() and idiv, David Carlisle RE: [xsl] floor() and idiv, Michael Kay <= RE: [xsl] floor() and idiv, Michael Kay