[xslt] floating point conversion
- From: Phil Shafer <phil juniper net>
- To: libxslt <xslt gnome org>
- Subject: [xslt] floating point conversion
- Date: Fri, 10 Sep 2010 12:26:40 -0400
I'm looking into an issue with floating point rounding, and
have hit an issue with number conversion.
The crux is that number("100.15") is not equal to 100.15.
% cat /tmp/test.xslt
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<op-script-results>
<output>
<xsl:value-of select="format-number('100.15', '####.################')"/>
</output>
<output>
<xsl:value-of select="format-number(100.15, '####.################')"/>
</output>
<output>
<xsl:value-of select="format-number(number('100.15') , '####.################')"/>
</output>
</op-script-results>
</xsl:template>
</xsl:stylesheet>
% xsltproc /tmp/test.xslt /tmp/test.xml
<?xml version="1.0"?>
<op-script-results>
<output>100.1500000000000057</output>
<output>100.1499999999999915</output>
<output>100.1500000000000057</output>
</op-script-results>
% xsltproc --version
Using libxml 20707, libxslt 10126 and libexslt 815
xsltproc was compiled against libxml 20707, libxslt 10126 and libexslt 815
libxslt 10126 was compiled against libxml 20707
libexslt 815 was compiled against libxml 20707
Can anyone point me in the right direction for tracking this down?
Thanks,
Phil
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]