Subject: RE: [xsl] single precision bug From: "Michael Kay" <mhk@xxxxxxxxx> Date: Tue, 17 Aug 2004 14:20:38 +0100 |
> A better inspection learns me that the XSLT processor makes a > mistake here > totalDebit - sum(./debitAmount) gives me a value of: > > -0.00000000005820766091346741 whereas this should be 0. > > MsXML, Saxon,Xalan, XT all have this error only Sablotron returns the > correct value. > > What do you all think of this? > Since the XSLT/XPath specification is very precise about how numeric arithmetic should work, it's more likely that MSXML, Saxon, Xalan, and xt are getting it right and Sablotron is getting it wrong. Generally, floating point arithmetic is likely to involve rounding errors when converting between decimal and binary representations. Ideally you would do this arithmetic in decimal (you can do this in 2.0). Alternatively, try converting the amounts to pence/cents by multiplying by 100 and rounding, before doing the arithmetic comparison. Michael Kay
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] single precision bug, ronald | Thread | Re: [xsl] single precision bug, David Carlisle |
AW: [xsl] Split HTML File Into XML , christof.hoeke | Date | Re: [xsl] modes and temp trees (was, Bruce D'Arcus |
Month |