[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] XPath floating point arithmetic
Subject: Re: [xsl] XPath floating point arithmetic
From: Elliotte Rusty Harold <elharo@xxxxxxxxxxxxxxx>
Date: Wed, 20 Mar 2002 12:10:24 -0500
|
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@xxxxxxxxxxxxxxx | 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
|