After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 72150 - numbers should be represented as 64-bit real
numbers should be represented as 64-bit real
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
1.0.10
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2002-02-21 17:34 UTC by jonathan.zaid
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description jonathan.zaid 2002-02-21 17:34:35 UTC
Daniel,

Here is a problem with format-number.

In the following example:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="format-number(100000000000,'#,##0.##')"/>|
<xsl:value-of select="format-number(2147483647,'#,##0.##')"/>|
<xsl:value-of select="format-number(2147483648,'#,##0.##')"/>|
<xsl:value-of select="format-number(4294967296,'#,##0.##')"/>|
</xsl:template>
</xsl:stylesheet>

I would expect the following output:

100,000,000,000|
2,147,483,647|
2,147,483,648|
4,294,967,296|

Instead the latest version (1.0.12) gives:

1,215,752,192|
2,147,483,647|
-2,147,483,648|
0|

It's clear from the results that numbers are implemented as longs in 
libXSLT (or at least they are processed in format-number as longs). 
According to the XSLT standard, which makes reference to the XPATH Number 
definition:
"A number can have any double-precision 64-bit format IEEE 754 value [IEEE 
754]."
(see http://www.w3.org/TR/xpath#numbers)

TIA
Jon Zaid

P.S. Sorry I didn't get back to you about the other decimal-format bug 
(68759) that you fixed. The results are now correct.

P.P.S. Keep up the excellent work and thanks for the great product!
Comment 1 Daniel Veillard 2002-03-07 08:56:31 UTC
Hum, numbers are represented as 64 bits real. But I had a
serious problem with gcc on the XPath parser at some points
(explanations at http://veillard.com/gcc.bug , enjoy !)
and as a result when compiling the XPath parser with gcc
I was moving the temporary value to an int to avoid the problem.
I changed the way to deal with this problem and it now seems to
work as expected:

paphio:~/XSLT/tests/general -> xsltproc bug-75.xsl ../docs/bug-75.xml 
<?xml version="1.0"?>
100,000,000,000|
2,147,483,647|
2,147,483,648|
4,294,967,296|

paphio:~/XSLT/tests/general -> 

Patch in CVS (against libxml2):
http://cvs.gnome.org/bonsai/cvsquery.cgi?module=gnome-xml&branch=HEAD&branchtype=match&dir=gnome-xml&file=&filetype=match&who=veillard&whotype=match&sortby=Date&hours=&date=explicit&mindate=03%2F07%2F02+03%3A35&maxdate=03%2F07%2F02+03%3A37&cvsroot=%2Fcvs%2Fgnome

 thanks for the report,

Daniel
 
Comment 2 Daniel Veillard 2002-03-18 21:39:41 UTC
This should be fixed in the recent releases,

 thanks,

Daniel