473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XPath/XSLT and extended precision

Hello,

The XPath 1.0 recommendation says:

A number represents a floating-point number. A number can have any
double-precision 64-bit format IEEE 754 value [IEEE 754]. These
include a special "Not-a-Number" (NaN) value, positive and negative
infinity, and positive and negative zero. See Section 4.2.3 of [JLS]
for a summary of the key rules of the IEEE 754 standard.

It doesn't say many things concerning the operations, but it seems that
it also requires them to conform to the IEEE-754 standard (as this is
the case for the division: "The div operator performs floating-point
division according to IEEE 754.").

Now my question: is extended precision allowed as the "destination"
format (where "destination" is defined in the IEEE-754 standard)?
i.e. computations would be performed with exact rounding to extended
precision, then rounded to double precision (hence the results would
be rounded twice).

This is what happens with xsltproc (libxslt) on x86 processors:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" indent="no"/>

<xsl:template match="/">
<xsl:choose>
<xsl:when test="9007199254740992 + 1.00001 = 9007199254740992">
<xsl:text>equal</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>different</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
</xsl:template>

</xsl:stylesheet>

On an x86, the output is "equal", whereas on a PowerPC, it is
"different". So, is it a bug in libxslt or is it allowed by the
XPath recommendation?

--
Vincent Lefèvre <vi*****@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
Jul 20 '05 #1
4 1815
> This is what happens with xsltproc (libxslt) on x86 processors:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" indent="no"/>

<xsl:template match="/">
<xsl:choose>
<xsl:when test="9007199254740992 + 1.00001 = 9007199254740992">
<xsl:text>equal</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>different</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
</xsl:template>

</xsl:stylesheet>

On an x86, the output is "equal", whereas on a PowerPC, it is
"different". So, is it a bug in libxslt or is it allowed by the
XPath recommendation?


I cannot reproduce your problem. xsltProc gives me: "different" on my
Pentium 4.

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
Jul 20 '05 #2
In article <bi************@ID-152440.news.uni-berlin.de>,
Dimitre Novatchev <dn********@yahoo.com> wrote:
I cannot reproduce your problem. xsltProc gives me: "different" on my
Pentium 4.


Perhaps a different version for which the problem was fixed?
Here's mine:

greux:~> xsltproc --version
Using libxml 20508, libxslt 10030 and libexslt 720
xsltproc was compiled against libxml 20507, libxslt 10030 and libexslt 720
libxslt 10030 was compiled against libxml 20507
libexslt 720 was compiled against libxml 20507

FYI, this is the latest version of the Debian package (sid).

--
Vincent Lefèvre <vi*****@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
Jul 20 '05 #3
Mine is:

Using libxml 20504, libxslt 10027 and libexslt 718
xsltproc was compiled against libxml 20504, libxslt 10027 and libexslt 718
libxslt 10027 was compiled against libxml 20504
libexslt 718 was compiled against libxml 20504

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"Vincent Lefevre" <vi**********@vinc17.org> wrote in message
news:20*****************@vinc17.org...
In article <bi************@ID-152440.news.uni-berlin.de>,
Dimitre Novatchev <dn********@yahoo.com> wrote:
I cannot reproduce your problem. xsltProc gives me: "different" on my
Pentium 4.
Perhaps a different version for which the problem was fixed?
Here's mine:

greux:~> xsltproc --version
Using libxml 20508, libxslt 10030 and libexslt 720
xsltproc was compiled against libxml 20507, libxslt 10030 and libexslt 720
libxslt 10030 was compiled against libxml 20507
libexslt 720 was compiled against libxml 20507

FYI, this is the latest version of the Debian package (sid).

--
Vincent Lefèvre <vi*****@vinc17.org> - Web: <http://www.vinc17.org/> -

100% validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

Jul 20 '05 #4
In article <bi************@ID-152440.news.uni-berlin.de>,
Dimitre Novatchev <dn********@yahoo.com> wrote:
Mine is: Using libxml 20504, libxslt 10027 and libexslt 718
xsltproc was compiled against libxml 20504, libxslt 10027 and libexslt 718
libxslt 10027 was compiled against libxml 20504
libexslt 718 was compiled against libxml 20504


Older than mine. So, I've filled a bug on the Debian BTS, in case this
is a Debian(/unstable)-only bug.

--
Vincent Lefèvre <vi*****@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Patrick Reilly | last post by:
I am trying to implement a better method than I already have to document database schemas with XML, and use XSLT to both generate database DDL statements (CREATE TABLE, etc) and to transform to...
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
7
by: Sebastian Petzelberger | last post by:
Hi group, please give me an example of a xpath with regex or better a link with examples. Thanks in advance, Sebastian
1
by: DV | last post by:
Hello, can anyone tell me or point me to somewhere what the exact differences (in terms of when would I use what) between XPath, XLink, XPointer and DOM are? Does it require special software...
14
by: inquirydog | last post by:
Hi- One frusterating thing for me with xsl is that I don't know how to make xslt throw some sort of exception when a value-of path does not exist. For instance, suppose I have the following...
4
by: Son KwonNam | last post by:
In XSLT, is this possible to get value from xml using XPath which is in XSLT variable? I mean XPath strings can be dynamic while XSL Transforming. If possible, How?? Because I'm not a...
3
by: Kathy Burke | last post by:
Hi again, I'm using the following xpath (works in visualizer) with a SelectSingleNode("xpath") statement. //Station/(WI])]/@order Problem is I get an error "expression passed to this method...
1
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.