Subject: [xsl] negative double, very small absolute value: strange string conversion From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx> Date: Thu, 18 Mar 2010 13:23:57 +0100 |
Just playing with double arithmetic (xsl is below), I notice that the end of the output of this artless stylesheet is this: ... -9.556619453472961E-299 -9.332636185032189E-302 -9.113902524445497E-305 -8.900295434028806E-308 --8.6916947597938E-311 --8.4879831639E-314 --8.289046E-317 --8.0948E-320 --7.9E-323 -0 -0 ... So why are there double '-' in front of the last few values != -0 ? $ java -version java version "1.6.0_0" OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu12) OpenJDK Server VM (build 14.0-b08, mixed mode) java -cp /extra/saxon/saxon9he.jar net.sf.saxon.Transform -it:iter -xsl:foo.xsl count=120 start=-1.0 <?xml version="1.0"?><!--foo.xsl--> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wl="wolfgang.laun"> <xsl:param name="start" as="xs:double"/> <xsl:param name="count" as="xs:integer"/> <xsl:function name="wl:div2"> <xsl:param name="num" as="xs:double"/> <xsl:param name="count" as="xs:integer"/> <xsl:if test="$count > 0"> <xsl:value-of select="$num"/><xsl:text> </xsl:text> <xsl:value-of select="wl:div2($num div 1024,$count - 1)"/> </xsl:if> </xsl:function> <xsl:template name="iter"> <xsl:value-of select="wl:div2($start,$count)"/> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] sorting strings (not defa, G. Ken Holman | Thread | RE: [xsl] negative double, very sma, Michael Kay |
Re: [xsl] exslt random:random-seque, Martin Honnen | Date | RE: [xsl] exslt random:random-seque, Michael Kay |
Month |