ASP Error: 70
Description: Permission denied
Source: Microsoft VBScript runtime error

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

Re: sum() function giving strange result

Subject: Re: sum() function giving strange result
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 14 Dec 2004 10:33:10 GMT
sum function in dom
> I am worried about the output 151.64999999999998. Why is it outputting this 
> value?

Most computers these days use binary arithmetic. This means that they
can not store a number such as 10.11 exactly (or rather, they could
store it exactly, but they don't) so as your input is not stored exactly
you shouldn't expect exact results (from any computer arithmetic).
You can use the format-number function to round the result to 2dp.

> <xsl:variable name="SubTotals">
>   <xsl:for-each  select="/documents/value">
>     <value><xsl:value-of select="." /></value>
>   </xsl:for-each>
> </xsl:variable>

don't do that, so this:

<xsl:variable name="SubTotals" select="/documents/value"/>
it's far more efficient and means that you would not need to use teh
node-set() extension to do the sum.


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.