This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XPath floating point arithmetic


At 4:40 PM +0000 3/20/02, Richard Jinks wrote:
>Hi
>
>Can someone ease a bit of confusion for me, please?
>
>In relation to XPath, what would the answer be to the following operation:
>
>5.46 mod 2.6
>
>Should it be
>
>a) 1 (implying the numbers are rounded to nearest integer, then 'mod'ed)
>b) 0.26 (implying some sort of floating point mod operation)
>c) something else (implying I've got my sums wrong and need to learn how to
>use a calculator)
>


The spec says "This is the same as the % operator in Java and 
ECMAScript" and in Java 5.46 mod 2.6 is indeed 0.26 (modulo rounding 
error) If libxml isn't giving you that, then it's a bug.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]