Re: [xsl] XSL SUM BUG?

Subject: Re: [xsl] XSL SUM BUG?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 19 Feb 2004 15:05:28 -0500
At 2004-02-19 22:44 +0300, Andrew wrote:
I've following xml:
 <plan SUMM="700000.1"/>

execute sum(//plan/@SUMM) and you'll get 700000.09999...- what the ...?
but if you change 7 on 1 or 2 all works as expected- 1 preserved.
tested on .NET/xmlspy.

IEEE arithmetic is not always so precise.

If you do format-number(sum(//plan/@SUMM),'#.0') you will always get the .1 because the spec says to round lesser digits to the least significant digit.

I hope this helps.

..................... Ken

Public courses: upcoming world tour of hands-on XSL training events
Each week:    Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO
Washington, DC: 2004-03-15            San Francisco, CA: 2004-03-22
Hong Kong: 2004-05-17    Germany: 2004-05-24    England: 2004-06-07
World-wide on-site corporate, government & user group XML training!

G. Ken Holman                  mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. 
Box 266, Kars, Ontario CANADA K0A-2E0     +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness

XSL-List info and archive:

Current Thread