XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
allen watsonSubject: Math Error
Author: allen watson
Date: 17 Nov 2005 08:19 PM
Originally Posted: 02 Nov 2005 06:32 PM
11641.71 + 489.63 - 12131.34 = -0.00000000000181898940354586<br> <br> this should be zero. Is there a XSL processor patch? and how soon will the fix be ready? Here is the workaround: round(11641.71*100) + round(489.63*100) - round(12131.34*100) = 0 ugly but it worked.

Postnext
Clyde KesselSubject: Math Error
Author: Clyde Kessel
Date: 02 Nov 2005 08:52 PM
Sadly, the XSLT 1.0 spec requires the use of floating point arithmetic (what were they thinking?), and all compliant processors return the same result. I have applied to Lord Krishna for a fix to the laws of mathematics, but haven't heard back yet. There are various functions like round() and xsl:decimal-format() to help a bit. XSLT 2.0, of course, has a decimal data type.

Posttop
Clyde KesselSubject: Math Error
Author: Clyde Kessel
Date: 03 Nov 2005 04:30 AM
Happily, XSLT 2.0 will do the proper decimal arithmetic. Change the stylesheet element to 2.0

<xsl:stylesheet version="2.0" .....

and run it. You will need to select the Saxon xslt processor.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.