Subject: Re: [xsl] XSL SUM BUG? From: "Andrew" <asd@xxxxxxxxxx> Date: Thu, 19 Feb 2004 23:21:11 +0300 |
Thanks, this works of course but wrap every number in format-number() is too cumbersome... besides it seems only XSL understand IEEE this way ;-) ----- Original Message ----- From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, February 19, 2004 11:05 PM Subject: Re: [xsl] XSL SUM BUG? > At 2004-02-19 22:44 +0300, Andrew wrote: > >I've following xml: > ><aa> > > <plan SUMM="700000.1"/> > ></aa> > > > >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. http://www.CraneSoftwrights.com/s/ > Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) > Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL SUM BUG?, G. Ken Holman | Thread | RE: [xsl] XSL SUM BUG?, Andreas L. Delmelle |
Re: [xsl] XSL SUM BUG?, J.Pietschmann | Date | Re: [xsl] FW: Troubleshooting a sor, David Carlisle |
Month |