[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

negative double, very small absolute value: strange s

Subject: negative double, very small absolute value: strange string conversion
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Thu, 18 Mar 2010 13:23:57 +0100
 negative double
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.